cancel
Showing results for 
Search instead for 
Did you mean: 

USB Host sesets with a device plugged in at power on.

LPode.1
Associate II

Hi,

I developing on stm32F4 and I having a problem with a USB Key Mass Storage Device.

I using the MX library host usb as is, stand alone without other procedures.

If I plug the usb key AFTER power on all is OK.

If I power on with the usb key plugged in, then a reset happens.

Debugging step by step I could see that then problem happens as soon as vbus start.

Some suggestion?

Thanks

1 REPLY 1
LPode.1
Associate II

Hi everyone,

I fixed it and I go posting the way I did.

STM CUBE MX auto source look so:

int main(void)

...

MX_USB_HOST_Init();

...

/* USER CODE */

Then VBus will be set in mx_usb_host_init();

I fixed my problem removing the VBus setting form the library, and moving it before in the program.

This way:

int main(void)

...

MY_USB_VBusOn(); // (this is user procedure, not from library)

...

MX_USB_HOST_Init();

...

/* USER CODE */

So all works now, both with usb key plugged at power and plugging it after power on.

I not have a concrete understaning of what happen but I will see further.

Maybe a short timings that crossing vbus and stack frame on strm32 go crashing.