AnsweredAssumed Answered

USB CDC flow contol

Question asked by Trevor on Feb 22, 2013
Latest reply on Feb 26, 2013 by Chinzei.Tsuneo
I’m using a slightly modified version of the USB CDC example on STM32F205. The modification is that I’m terminating the STM32 end with a simple command line rather than tunnelling to and from a UART. This is a full speed (FS) device (not OTG). All works well if receiving small amounts of data. However when the PC sends more data to the device there seems to be no flow control implemented i.e. unless we can consume the data in the USB receive interrupt as fast as it arrives we lose data.
I can’t (and don’t want to) wait around in the USB receive interrupt until all the data has been processed as sometimes the data needs to be saved to external flash which isn’t quick. I need to process the data in another task i.e. not in the interrupt. The root of the problem is that the data is arriving much faster than it can be dealt with. So I need some way of “holding the data back” from the sender -- like a flow control mechanism.
I need some way of “telling” the sending USB end that I’m getting near the limit of what I can receive so that it can stop sending more data - just like what would happen with hardware handshaking over a normal serial port.

Anyone else come accross this issue? Any ideas?

Interestingly on our STM32103 projects this works fine  --  I think because with that USB library you have to poll for new data and if you don’t poll fast enough there is some form of flow control.

Regards
Trevor

My setup:
Rowley Crossworks for ARM 2.3.0
Windows 7
STM32F205
ARM-USB-TINY JTAG

Outcomes