cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube USB device driver interrupt handler fails to clear TxState, leaving CDC unable to send IN transfers

philip239955
Associate
Posted on December 15, 2015 at 20:08

I've found a bug where the order of the interrupt handlers causes the HAL driver to get stuck in TxState==1, causing CDC_Transmit_FS() to always return USBD_BUSY leaving it unable to send any more IN transfers.

The bug sometimes occurs when the USB IN interrupt is triggered with flags 0x81 (USB_OTG_DIEPINT_XFRC and USB_OTG_DIEPINT_TXFE). The transfer complete flag is cleared before the call to PCD_WriteEmptyTxFifo(), which can lead to TxState never being cleared. I resolved it in my repository by moving the if block that handles USB_OTG_DIEPINT_XFRC to the end of the ep_intr handling section.

This is happening on an STM32F405RG, attached to a ThinkPad running Windows 7, with PuTTY attached to the COM port supplied by the ST Virtual comport driver.

#bug #cdc #usb #stm32cube
0 REPLIES 0