I'm trying to set up my first project on an STM32F4 and I encounter a problem which consists on how to pass the measures I took from the MEMS accelerometer from the STM32F4 to the computer.

I'm using the IAR workbench as a development environment.
Can you help me please?

  • \$\begingroup\$ Google about USB-CDC: it is a simplest way to communicate with STM32 without a need of writing soft working with libusb. Your device would be just like a simple COM-port, and you even can work with it by reading/writing to /dev/ttyUSB* \$\endgroup\$
    – Eddy_Em
    Mar 19, 2013 at 12:02
  • \$\begingroup\$ I gave up on the USB connection, and just went with one of these, using the USART hardware on PA8 and PA9. \$\endgroup\$
    – Eric
    Mar 19, 2013 at 12:49
  • \$\begingroup\$ It can be done and there's cabling simplicity to the result, but it's tricky to get right especially if you don't have a CDC example for the specific processor varient of interest. And the serial solution has the advantage of being able to generate debug output even when the firmware is mostly failing - making it useful when trying to get the USB version working. \$\endgroup\$ Mar 19, 2013 at 15:29
  • \$\begingroup\$ Thanks for your response! But i would like to ask you about how to recover the data that i took from the accelerometer of STM32F4 after going over the cable? and do i need just one cable? \$\endgroup\$ Mar 19, 2013 at 15:40
  • \$\begingroup\$ So are you are asking how to use/set up the STM32F4 USB library? What do you mean by "just one cable"? Are you referring to the USB cable? \$\endgroup\$
    – Oli Glaser
    Mar 19, 2013 at 15:45

1 Answer 1


I think you better take this in steps:

  1. Is your development environment completely setup and working? If not verify and interface switches and LEDs first.

  2. Is your sensor interfaced correctly? Verify whatever protocol you are using to connect to it.

  3. Is your UART working properly? Try coding an echo + 1 example.

  4. Connect steps 2 and 3.

There are plenty of examples online about working with STM boards.


Your Answer

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

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