Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
Problem in Sending 64 bytes / Maximum Payload Size Packet in USBUART Component – KBA89052
Question: When trying to send a packet of maximum payload size (64 bytes) in USBUART, no data is seen on the serial port application even though the data was transferred and seen on the USB bus. What is causing the problem? What is the solution?
When you send data in maximum payload size packets, no data is seen on the serial port application because the data is stored in the application data buffer. As per the USB specification, when the packets are sent with maximum payload size, the USB host considers the transfer complete only when it receives a short-length packet (packet of length less than the maximum payload size) or zero-length packet at the end of the transfer.
Any serial port application will not display the received data until the transfer is finished, or the application’s data buffer overflows. This is what happens when you continuously send maximum packet size data to the serial port application. After the application data buffer gets full, the application displays the last received data on the terminal and stores the new data in the buffer. This leads you to think that the data is accepted when you continuously send maximum packet size data, but not accepted when you send only a few packets with data of maximum payload size.
To solve the problem: If the data to send has length that is equal to or a multiple of the maximum payload size, send a last zero-length /short length packet to end the transfer. Use the PutString() API to send a zero length packet at the end of the transfer by keeping the length argument as zero.