We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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?
If somebody has the same problem: USBH_Initialize() ... // wait for stick while(USBH_MSC_GetDeviceStatus != usbOK)... // working on data fmount ... funmount ... // WAIT FOR UNPLUGGING stick! while(USBH_MSC_GetDeviceStatus == usbOK)... USBH_UnInitialize()
Problem is when you call USBH_Uninitialize with connected stick. You have to force user to unplug it.