This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28377D: USB(Serial Mode) Communication, how to directly transmit the data of write buffer.

Part Number: TMS320F28377D

Tool/software:

In my case, follow as

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
uint32_t
RxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue,
void *pvMsgData)
{
uint32_t ui32Count;
//
// Which event are we being sent?
//
switch(ui32Event)
{
//
// A new packet has been received.
//
case USB_EVENT_RX_AVAILABLE:
{
//
// Feed some characters into the SCI TX FIFO and enable the
// interrupt so we are told when there is more space.
//
int i;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Parcing_UsbData(rxData, usbRxSize)
{
if(rxData[3] == 0x01)
{
txData[0] = 0x7E;
txData[1] = 0x7E;
.....
txData[14] = 0x81;
txData[15] = 0x81;
int i;
for(i = 0; i < 16; i++)
{
while(USBBufferSpaceAvailable((tUSBBuffer *)&g_sTxBuffer) == 0) {}
USBBufferWrite((tUSBBuffer *)&g_sTxBuffer, &txData[i], 1);
}
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

in PC, I transmit the data to the board, then board receviced the data correctly.

then, using Parcing_usbData(), the board transmit the return data.

USBWriteBuffer Function pushes the data to ring buffer. but not transmit the buffer data.

In PC, it has to send it twice in a row to receive data from the board.

1) Why not transmit the data in USBBufferWrite() immediately?

2) How can i transmit the data immediately?