This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM: second USBH_Initialize not working

Hi,
(STM32F429, Middleware 6.2.0-6.5.0)

I have device with USB host and slave. User choose what to do and I initialize one or another.
Just like that:

- user choose device:
USBD_Initialize()
...work...
USBD_UnInitialize()

- than user choose host:
USBH_Initialize()
...work...
USBH_UnInitialize()

And it's working. Problem is when user second time selects host. USBH_Initialize() returns usbOK but program cannot connect with pendrive.

I have found one solution:
- I set up memory address for USB library to fixed address (for USB_CM3_L.lib)
- just after program starts I save 16 first bytes of that memory
- before every USBH_Initialize() I reset first 1024 bytes from that memory and restore saved 16 (don't ask me why 16; I just figured it out some time ago)
And it's working. With that "patch" everything is working correctly.

To be honest - it's stupid and no one normal should do that in release application. So - what I need to do to reset library without restarting program? Is it bug in libraries or I missed something important in documentation?