Hello all, I have an STM32 with a composite USB device configured, one CDC and one MSD. The MSD lets you mount an SD card, while also communicating over CDC. This all works great. However, if the user removes the SD card, Windows gets unhappy.
Ideally I'd like it to behave like a normal SD reader: when you plug in USB it enumerates as an MSD, but doesn't enumerate any volumes. Then, if you stick a card in, it notifies the OS that a volume is now present (which the OS then mounts/reads/writes/whatever).
My problem is that if I don't call `msdStart`, Windows in particular has trouble using the CDC until some timeout occurs and it gives up on mass storage.
Does the API exist in the MSD driver to fully initialize the interface, but not actually mount a volume? I can sort of hack it by mounting a tiny ramdisk, but that's of course not ideal since Windows still pops the notification about a drive being connected, asks you to format it (which fails), etc.
STM32 USB MSD Initialize but don't mount a volume
Moderators: RoccoMarco, barthess
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: STM32 USB MSD Initialize but don't mount a volume
Frankly I don't know how removable devices should be handled, the answer is buried in the MSD documentation probably.
Giovanni
Giovanni
Re: STM32 USB MSD Initialize but don't mount a volume
Ok, I've figured out a solution to my problem! After some comparison of usbpcap traces between a normal SD reader and my device, I figured out that it's actually a SCSI problem, not an MSD problem. My solution is to create a block device that reports "no media" and reports success for all other operations.
Here's my implementation: https://github.com/rusefi/rusefi/blob/m ... device.cpp
Here's my implementation: https://github.com/rusefi/rusefi/blob/m ... device.cpp
Who is online
Users browsing this forum: No registered users and 24 guests