cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot switch between USB device and USB host mode on STM32H7A3-nucleo without cycling power

slime
Associate II

I am using a stm32h7a3-nucleo board to do proof of concept of this MCU supporting both USB Host as a MSD and USB Device as CDC. Using code from ST sample projects, it is setup to go to host mode if user button is held after a board reset. Both host and device modes work,

If device mode is selected after reset, then later the user resets the board, and tries to put it to host mode, the device does not properly init the USB drive connection. Since both modes start after a board reset, why do I need to pull power supply from the board to get USB host to work again? It does not matter if the USB drive is plugged in or not at the time of reset.

1 REPLY 1
Imen.D
ST Employee

Hello @slime​ ,

Do you have a pullup on the line? Use internal pull-ups on the ID pin, if there's no external one.

You need to stop ("xxxDeinit") the stack in one mode, and switch the mode. Then start the whole stack of the other mode, when the ID pin state changes.

If my answer satisfy your need, please select it as Best so that this thread will marked as solved.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen