AnsweredAssumed Answered

USB lib CDC example COM buffer overflow

Question asked by van_thielen.bart on Nov 14, 2012
Latest reply on Nov 20, 2012 by Chinzei.Tsuneo
I want to use the VCP_CDC example in the STM32_USB-Host-Device_Lib_V2.1.0 to send ADC data, via the serial port to SciLab (a MATLAB like PC program)

My problem is that the original example doesn't use any flow control, because its data comes from a slow USART and is sent through a fast USB connection, which guarantees that the APP_Rx_Buffer in the VCP_DataTx() routine in usbd_cdc_vcp.c will never overrun.

Because I have faster data coming in, and SciLab can be slow in processing the COM buffer contents, there is a buffer overrun, and I lose a lot of data.

Is there some kind of status variable/function in the library with which I can see if data that is currently in the APP_Rx_Buffer buffer has been successfully transferred to the PC COM buffer without causing a buffer overrun, and the next data can be sent?

Or is this supposed to be done at the higher level, using the regular serial flow control (RTS/CTS or DTR/DSR) being passed by the ST VCP driver through the command endpoint and ending up in the VCP_Ctrl() function?

I would prefer the first solution, because I do not seem to get anything back through the  command endpipe when the PC COM buffer overruns. (maybe my com port settings are wrong)

Outcomes