Showing results for 
Search instead for 
Did you mean: 

Writing to a USB stick from STM32G474Cx MCU


I would like to preface with the fact that I am fairly new to hardware programming and electronics hardware design so bear with me if I am making some beginner mistakes.

I am trying to write data to a USB stick using the PA11(33) pin and the PA12(34) pin. The data would be a couple of integer values every 5ms. They are listed as USB_DM and USB_DP pins respectively. In the documentation on the internal USB controller, it says that it is "a full-speed USB device peripheral compliant" controller which to my understanding (please correct me if I'm wrong) means that I can't directly write data to a stick because the controller is just meant for "peripherals." I would need an external USB controller that takes an SPI output from the MCU and then writes that to the USB Stick.


My other option for recording this data would be an SD/MicroSD Card. From what I understand this is a bit of a bigger headache from a hardware side but espcially from a software side. Another issue that I think would be present with the SD option is durability. The card would undergo many mating cycles and have data being writen to it in 5ms intervals for potentially hours at a time, which if I understand correctly could shorten the life span to weeks at best.


In your alls expereince what are the pro/cons here of going USB vs SD? Am I correct about needing an external USB controller if I go the USB route?