cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 USB CDC and MSC class to be used for both Device-to-Host communication and Device microSD reading ? Or only CDC ?

eBirdman
Senior

This question is related to the code design in such a scenario when host and device communicate over USB for two purposes: two-way communication (CDC) and also host is reading the content of the Device' microSD card. The CDC mode is required in this scenario to provide dialog between their end points after the RESET but after the Host sends a "read from microSD" command to the Device, what is the best way to implement a follow up reading from microSD card? This can still be done in the same USB CDC mode - reading line-by-line the ASCII bytes from the card file or is it better (less code / faster) to force the Device to reconfigure it's USB end point to the MSC class, then read file and then force the Device to reconfigure it's USB back to CDC class for further communication?

Any input from your coding experience would be appreciated.

2 REPLIES 2

For commercial projects consider chatting with your local sales contacts and FAE.

MTP Class might be more appropriate for two independent/concurrent connections to the same media. Windows and FAT have coherency/corruption issues, so better the device serve and arbitrate access to files.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ESami
Associate II

Hi @Vlad Blanshey

I have the same issue; could you find an appropriate way to perhaps switch between USB MSC and USB CDC (virtual come port)?

Edmond