cancel
Showing results for 
Search instead for 
Did you mean: 

Mysterious delay in USB_SetCurrentMode in F7 USB LL driver

Asaad Kaadan
Associate
Posted on December 06, 2017 at 22:11

Hello,

The title says it all. There's a a mysterious delay in USB_SetCurrentMode in F7 USB LL driver (stm32f7xx_ll_usb.c V1.2.2):

0690X00000608z4QAA.png

Does any one know the origin/need of this delay? There's no comment (or time units) about this. It was causing the USB device to timeout on descriptors initialization when the MCU boots up while USB is already plugged in. I removed the delay and everything seems to work fine on my PC. However, I want to make sure it's not required for some systems/hosts?

Thanks 

#usb-device #stm32-f7 #f7 #delay #timeout
1 REPLY 1
Khouloud GARSI
Lead II
Posted on January 16, 2018 at 10:00

Hello

Kaadan.Asaad

‌,

The FDMOD/FHMOD in the OTG USB configuration register are used to force the core to device/host mode.

After setting the convenient force bit, the application must wait

at least 25ms before the change takes effect (This information is mentioned in the reference manual when describing the bits).

-> This delay is mandatory

However, the behavior you're describing is unexpected. Are using an ST board or your own hardware? Have you developed your own software?

Khouloud.