We are currently prototyping a project that periodically spins up a USB drive to store data. We took advantage of the example msd fatfs project.
Because this is a low power application, the program loop is roughly:
1. Run at a lower speed recording data and sleeping as much as possible
2. When a buffer fills, change clock speeds and components to support a USB MSD device
3. Call USB Host Init
4. Call USB Tasks in a loop until the device attaches.
5. Write Data
6. Detach the disk
7. USB Host Deinit
This above program loop works great...for the first 8 attachments. After that, the USB Tasks ALWAYS fail with an enumeration failed error.
What is the proper way to detach and deinitialize ? One things I had to do in order to get it to work more than once was to manually set the .occupied field to 0. Because of the 8 successes, I'm guessing something is getting used and not correctly freed. However, I have been unsuccessful in all my attempts to get it to "correctly" detach or remove the device.
The example program only initializes and then runs in a loop, so I haven't been able to find any examples that show bringing down the USB stack and bringing it back up.
Thanks in advance,
Chandler
Hi,
First of all, sorry for the later reply.
During the loop test, if the USB disc is really deattached from USB Host board?
Have tried with RT EVK board?
Mike