cancel
Showing results for 
Search instead for 
Did you mean: 

USB lib CDC example COM buffer overflow

bart239955
Associate II
Posted on November 14, 2012 at 16:15

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)

#usb-lib #cdc #vcp
1 REPLY 1