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 (串行模式)通信、如何直接传输写入缓冲区的数据。

Guru**** 1952840 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1449168/tms320f28377d-usb-serial-mode-communication-how-to-directly-transmit-the-data-of-write-buffer

器件型号:TMS320F28377D

工具与软件:

在本例中、按照中所示

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

在 PC 中、我将数据传输到电路板、然后电路板正确地重新传输数据。

然后,使用 Parcing_usbData (),电路板传输返回数据。

USBWriteBuffer 函数将数据压入环形缓冲区。 缓冲区数据。

在 PC 中、为了接收来自电路板的数据、它必须连续发送两次。

1)为什么不立即在 USBBufferWrite()中传输数据?

2) 2)如何立即传输数据?

x 出现错误。请重试或与管理员联系。