Showing results for 
Search instead for 
Did you mean: 

USB OTG (ULPI) Interrupt hits continuously after connecting the USB drive

Associate III

Hai All,

I am using USB OTG using ULPI protocol in my STM32F series controller.I entered a print statement inside the USB interrupt handler to monitor the interrupt. Then I found that whenever I connect USB drive the interrupt is hitting continuously until I remove the USB drive.Whether it will happen or not.I am confused about this.Please give me an answer. 

ST Employee

It is certainly not a good idea to write anything with printf in an interrupt routine. Typically you write something to a console connected via UART, but even with a high baud rate this takes far too long.

Always keep in mind that interrupt routines (usually) need to be very fast, so you should think about an alternative. This could be, for example, a set flag that triggers a printf in the main routine as soon as there is time for it.

Hope that helps?


In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

@Peter BENSCH Thanks for your reply.

My doubt is ,as long as I keep the USB drive in connected state,whether the USB interrupt will hit continuously? We know that , in GPIO interrupt, while the key is pressing interrupt will generate but if I keep the button in pressed state it will not trigger any interrupt.Otherwise I need to release the button and press it once again.Here When I connect USB drive , that moment onwards interrupt starts to hit continuously till I remove the USB.