STM32 USB MSD Initialize but don't mount a volume
Posted: Thu Feb 11, 2021 11:15 pm
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.
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.