cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupts stop on USBD CDC while usbmon shows EPROTO -71

FastestCuber
Visitor

Occasionally after several hours our USBD CDC will get stuck in a state where "CDC_Transmit_FS" always returns "USBD_BUSY" due to the "TxState" flag never being cleared. During this time the USB IRQ "HAL_PCD_IRQHandler" is never called even though IRQs are still enabled. 

I am using "STM32Cube FW_F4 V1.25.2" but have tried copying "STM32Cube FW_F4 V1.28.2" with no luck.

MCU is STM32F405RGT6. 

The only remedy is to reset USB by calling HAL_PCD_DeInit & HAL_PCD_Stop, then reinitializing with HAL_PCD_Init, USBD_Start, and MX_USB_DEVICE_Init.

 

This issue can be recreated by attaching a UART (non-USB) to the board which seems to provide additional 5V power potentially causing a disturbance in the USB. Doing so recreates the issue fairly quickly, however this can also happen without UART attached after several hours. 

I also noticed that I can get into this state if I call CDC_Transmit_FS multiple times and bypass the "TxState" flag, effectively calling "USBD_CDC_TransmitPacket" multiple times. Our code does not appear to call this multiple times as it is only called from one thread. Here is a link to another STM user with similar issues. This led me to attempt calling transmit multiple times, ignoring the TxState flag. 

 

Question: 

1. Can an EMI disturbance on USB communication cause the USB peripheral to go into a locked state like this? (no interrupts and stuck in USBD_BUSY)

2. What registers can I check if it is in this locked state? 

3. Any remedy to this issue? i.e. Slowing down the bus, checking registers periodically, etc. 
Resetting USB causes too much disruption.

0 REPLIES 0