AnsweredAssumed Answered

A potential bug in USB VCP example in STM32_USB-Host-Device_Lib_V2.1.0

Question asked by bauer.jack.001 on Feb 5, 2014
Latest reply on May 30, 2014 by Clive One
Hi all,

I a using an STM32F407 device with ST standard library and USB lib.
In Handle_USBAsynchXfer() function in usbd_cdc_core.c file:
There is a potential bug when roll-back occurs.
Two pointers are used:
APP_Rx_ptr_in: is incremented when data received over UART
APP_Rx_ptr_out: is incremented when received data over UART are sent over USB
Let's have an example:
if APP_Rx_ptr_in = 3 and APP_Rx_ptr_out = 2047
==> this means that I have received 4 data over UART (I have to send them over USB)
But as states the code below if APP_Rx_ptr_out > APP_Rx_ptr_in, the size is
APP_RX_DATA_SIZE - APP_Rx_ptr_out => 2048 - 2047 = 1 !!
I think it should be (APP_RX_DATA_SIZE - APP_Rx_ptr_out) + APP_Rx_ptr_in
What do you think?