I bought a STM32F103C8T6 evaluation board (which I have not received yet). See link

But I'm a bit lost in how to start with it. I have some experience with Arduino Uno/Mega.

I found already that the Arduino IDE supports them, so that's a good starting point.

However, even before seeing one, I have some questions I cannot find:

  1. Do I need more to program than an evaluation board? I mean with the Arduino, it's a matter of just connecting an USB cable from the PC to the Arduino. Can I do the same for an STM32 eval board?
  2. Do I need an USB-TTL adapter?
  3. I cannot find information what the meaning of the pins is ... they are similar to the chip itself, but not all of them. And there is a lot of info about the chip, but not about the board itself.
  4. also I have trouble finding generic information, like simple examples/starting guide.

note: buying this STM32 is just to find out if I can use it. For my (hobby) project I need eventually something with at least 128 KB RAM (thus an STM32F4...).


regarding 1.

1a. Why is an STLINK needed ?

1b. And which one with emulator or without?

without emulator with emulator

My eval board + STM32 is only 3 euro, this will add relatively much cost

  • 1
    \$\begingroup\$ github.com/dwelch67/stm32_samples I have some and there are an endless supply of samples out there not sure why you cant find them. sometimes the HAL and other libraries take more work than just programming the part directly, I recommend trying each approach and finding your personal preference, and every so often re-do this experiment as the HAL libraries, etc change (but the individual chips dont until they become obsolete). \$\endgroup\$ – old_timer Jul 14 '17 at 13:37

I wrote a series on getting started on quite a few popular mcus. specifically for the stm32f1, I wrote a page on getting it started with CoIDE, Keil and Arduino.




I also implemented arduino on a few ARM chips (ARMduino), including the STM32F100: https://dannyelectronics.wordpress.com/2017/05/27/armduino-a-generic-approach-to-porting-arduino-to-arm-cortex-m-chips/

you may find them helpful.

as to your questions:

  1. you don't need st-link. but it makes your life much easier.
  2. you don't need a usb-ttl. you can use st-link instead.
  3. it is a minimalist implementation so those pins are just what they are: pins.
  4. the datasheet is your best friend. depending on what you are starting with (SPL, HAL, or rolling your own), the examples can be vastly different.

The use of a vendor library is usually one of the first decisions you have to make. The IDE/compiler decisions are relatively simple.

  1. Yes, you need a ST-Link.

  2. no

  3. The pins are the same as on the chip with an additional 5V pin which is coming from the usb port.

  4. It's just the chip + voltage regulator + reset button + crystal + RTC clock + LED (Pin PC13). The boot jumpers are connected to Pins BOOT0 / BOOT1, but are unimportant if you're not flashing a bootloader.

Since it's not an actual evaluation board but more of a very cheap minimum circuit, there is no starting guide or anything of that sort. You can use STM32CubeMX to get an overview of functions and pinout.

  • \$\begingroup\$ Could you please also answer 1a / 1b (as result of your answer) ? THanks! \$\endgroup\$ – Michel Keijzers Jul 14 '17 at 12:15
  • 1
    \$\begingroup\$ you shouldnt need to care about the differences between those two stlink boards, one has a male usb connector so you need long cables or a usb extension cable the other you dont. if they are truly stlink clones then just run openocd and either should work just fine. \$\endgroup\$ – old_timer Jul 14 '17 at 12:41
  • \$\begingroup\$ I will check also what openocd means ... thanks for the clarification \$\endgroup\$ – Michel Keijzers Jul 14 '17 at 13:59

You get what you pay for on this one. For a few more bucks you could have had an st discovery or nucleo board with lots of documentation.

You dont need an stlink, the stm32 has a bootloader. usb to ttl (3.3v) is very desirable no matter what (for a breakout board like this). You can program the chip with the usb to ttl using the stm32 bootloader read the documentation for the chip fairly easy to write your own, may take less time than trying to get an already written one working but YMMV.

if you want to use an stlink then go right ahead, you found a cheap one but a nucleo board or discovery board gives you two things one a debug front end you can use on other stm32 chips or other brands, and two you get the mcu on that board if you want to play with it...

In general though your toolbox should include a usb-ttl (3.3v as well as a 5v for arduinos or other, can get cheap ones for $2 with a jumper) some sort of stlink solution (or swd in general, can get jlink clones for $10 on ebay that work quite well with openocd) and an led with a resistor, a charlieplexed board is what I have been using lately I dont have to sort out the positive and negative end of the led for a loose led...

  • 1
    \$\begingroup\$ the discovery/nucleo is $10 the first board you showed was $15 us for a real one and the other you mentioned is not worth the price nor worth mentioning for a real one. you are not using these for usb to ttl you are using these for stlink, for usb ttl you get an ftdi breakout board or cable which are anywhere from $2 to around $15, you will eventually need these if you continue this work. arduinos are traditionally 5V but not a hard and fast rule you ideally dont want to overvoltage your pins. \$\endgroup\$ – old_timer Jul 14 '17 at 13:15
  • 1
    \$\begingroup\$ you CAN just buy the right ftdi breakout and use it for both uart and swd but you need one with two ports and mpsse (ft2232 is the classic one but they have others) and these pins/ports broken out. you are then doing generic SWD not stlink, but thats fine using openocd it doesnt matter stlink or not. \$\endgroup\$ – old_timer Jul 14 '17 at 13:17
  • 1
    \$\begingroup\$ just get/use a usb-ttl 3.3v and the stm32 bootloader to start, under $2 on ebay, probably similar on alibaba, if you have this for your arduino already then there you go. www.ebay.com/itm/1pc-Basic-Breakout-Board-For-FTDI-FT232RL-USB-to-Serial-IC-For-Arduino-DP-/112066610531 okay over $2 at the moment, different than the ones I bought 10 at a time, wonder if the 5v pin is really based on the switch or not... \$\endgroup\$ – old_timer Jul 14 '17 at 13:21
  • 1
    \$\begingroup\$ with a usb-ttl 3.3v only you can both program the board and use that uart to watch your program run (have uart output in your program). with swd solution you can program your board but cannot watch the output of the program, you can later stop the processor and dump memory to see what happened. the combination of having both is you can (unless you hang it right) can program at will with swd and watch the program run with the uart without having to move a boot0 jumper or button each time. \$\endgroup\$ – old_timer Jul 14 '17 at 14:14
  • 1
    \$\begingroup\$ and there are some solutions that provide both swd and uart like some but not all stlinks...think of the stlink as an swd (think jtag) debugger/programmer. \$\endgroup\$ – old_timer Jul 14 '17 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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