AnsweredAssumed Answered

STM32F401 USB CDC stuck in IRQ loop

Question asked by Gordon Williams on Feb 18, 2015
Latest reply on Feb 20, 2015 by lowpowermcu

I'm using the USB Host library 2.1.0 (with USB_OTG_FS) on an STM32F401CD. Using the USB CDC code I'm having the following issue:

When the STM32 is connected to a PC but no application on the PC has the port open, the STM32 gets stuck in an interrupt loop:

  • USBD_OTG_ISR_Handler (at inepint handler)
  • DCD_HandleInEP_ISR (at emptyintr handler)
  • DCD_WriteEmptyTxFifo

Every single time the interrupt exits, it is called again - meaning absolutely no other code is able to run until a terminal application is connected.

It's all open source and on GitHub - the relevant function is here:

Do you have any idea what could be causing this problem?

I also have a second question about turning off the USB peripheral. When it's disconnected from USB my device goes to sleep - and obviously USB needs powering down to reduce power consumption. Are there any examples of doing this? Whenever I have tried I haven't get been able to power down USB and bring it back up in a usable state.


- Gordon