Correct use of tud_cdc_tx_complete_cb #2523
Unanswered
MikeEmbedded
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All.
This is my first project with TinyUSB.
It was generated by CubeMX for CubeIDE and after that I added TinyUSB stack to the project.
HW configuration STM32H723 + USB3320.
FW configuration: FreeRTOS + three CDC.
Project settings are:
All three CDC instances are enumerated at PC side. My board receives data from PC with succes.
The problem is when I try to send data packets with size more that 512 bytes. In this case I send first chunck of 512 data bytes using tud_cdc_n_write() function and inside of tud_cdc_tx_complete_cb() callback I send rest of 512 bytes shuncks using tud_cdc_n_write() also. In this case I have data loss on PC side sometimes.
After that I modified my code in such a way that the second and so on chunks of data are sent in task after a RTOS semaphore is signaled in tud_cdc_tx_complete_cb() callback. It works perfectly and there is no any data loss on PC side but total speed of data transfer is less then the case were I send data inside tud_cdc_tx_complete_cb().
So my question are:
Beta Was this translation helpful? Give feedback.
All reactions