I'm a beginner in STM32F4 and I want to design a data-acquiring system to send ADC results over USB to my PC. But I'm completely confused with the STM32 USB library. My questions are:

  1. Which USB Class should I choose? Assert I have 16 or 24 ADC channels, 12 bits and the sample rate is not less than 9600 Hz. That needs a 2~3 Mbps speed.
  2. Which function in the USB library should I call to send data?

1 Answer 1


Simplest is to make USB to virtual serial port (USB VCP), you have a library for that as well the example and drivers for windows. Once you plug it, you will see a serial port at your PC. Then in mcu program you can send it in orther you want with print function.
If you are familiar with Matlab then you can use STM32-MAT/TARGET and have possibility to use STM32 with Matlab/Simulink.

PS: 2-3Mbit that would be a little difficult with this approach. But do you really can process such stream of data at the PC side?

  • \$\begingroup\$ Is VCP the save with RS232? \$\endgroup\$ Nov 3, 2015 at 9:22
  • \$\begingroup\$ Don't understand what do you mean by 'save'. Your board will function as USB<->RS232 converter, but without additional hardware, the converter is implemented in STM32, and yes you can use the device as RS232 device then. \$\endgroup\$ Nov 3, 2015 at 9:25
  • \$\begingroup\$ Sorry, I meant the "same" with RS232. I just worry whether RS232 can meet the speed of 2~3 Mbps. \$\endgroup\$ Nov 3, 2015 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.