AnsweredAssumed Answered

Delay functions in STM32F4 USB Peripheral Library and USB-Unknown device issues

Question asked by senanayake.pradeepa on Jun 22, 2015
Latest reply on Jun 23, 2015 by senanayake.pradeepa
Hello,

We are using STM32F415RG76 chip in one of our products and we are facing a very confusing USB issue. The issue comes when we switch the microcontroller from the bootloader to application-firmware.

In some of the USB controllers, when we switch from bootloader to application-firmware we get Unknown Device issue. We analyzed the Unknown Device issue and we are certain that it is not caused by any driver. We believe that this happens due to some timing issue. We properly reset interrupts, vector tables, etc. when we do the switching. At the moment we see this issue only in "Intel® 6 Series/C200 Series Chipset Family USB Enhance Host Controller"s. That makes it even harder to debug.

When we check the USB Library provided by ST we found out few delay functions, Namely,

USB_OTG_BSP_mDelay
USB_OTG_BSP_uDelay

But both these functions are internally using while loops to generate delays, which as we know depends on the core clock. We noticed that when we change the SYSCLK to 168 MHz the Unknown Device issue does not come but if we use 72 MHz clock the Unknown Device issue comes. But still we are not sure that the root cause for the issue is the way that delay functions were implemented. We would like to know your opinion on this issue? We are still investigating and we'll be posting our findings here as well.

Important:

Please note that this issue does not come always and does not come in every USB controller. Which is why it is very hard to debug. But we are certain that there are PCs which gives this issue which makes our product not usable to them unless we fix it. 

Thank you.

Outcomes