STM32f0 with Arduino IDE

Hi, I am using arduino from nearly a year, and now have good hand on UNO, MEGA and more specifically Arduino IDE, I also love Arduino forum a lot! I am working in a industry where I need to code for diff project, where few are time critical where I also need fast controllers with low cost for that case I am planning to use STM 32f0 controller series as it is fast have many timers it is a 32 bit plus compatible to 40Mhz crystal! But as I mention earlier I realy like arduino a lot and realy going to miss the most active forum! Is there any way we can use our arduino ide to code STM 32F0? I know there is a board with STM32F4 series compatible with arduino but those are costly one so is there any way we can code STM 32f0 with arduino? Also if you guys have any good link on it please share it! Thanks in advance!

I don't know about a project for the F0, but for the F1, F3 and F4 there is a project: F1 boards are dirt cheap :)

septillion: I don't know about a project for the F0, but for the F1, F3 and F4 there is a project: F1 boards are dirt cheap :)

F3 boards are dirt cheap also :) Here one of them with the price only 1.5$

But looking for another Arduino core instead of your mentioned. I've tried with it however took me lot of time just to upload a sketch into STM32F103 board. Do you know any other solution?

jts33: Here one of them with the price only 1.5$

But that's a F1...

But no, don't know any other Arduino STM project. Doubt there is another for such a niche market... But worked fine here. Which step did take a lot of time?

Better spend sometime learning a bit of ARM and STM32 HAL libraries.

Use native tools like Cube MX for MCU config and code initialisation and generate code to use with a real IDE like SW4STM32 or Atollic, or even CooCox. All are free and will provide full toolchain with real-time debugging. I normally use SW4STM32 but should be moving to Atollic soon as is more of market standard together with Keil and IAR - those last two are quite expensive.

This way you're not locked on the Arduino IDE or limited libraries and can take advantage of very cool ARM features.

Yeah, you're right. But I still find it hard to choose the right toolchain and setting it up and getting it to work a big pain. Even after programming in Altera VHDL etc...

I agree with that can take a bit more time to start seeing results where Arduino you can make a LED blink is 10seconds... to speed up a bit I normally have one or two simple projects that I use to play with. So I only start a new project from scratch (Cube MX) after have defined a few things...

Yeah, but that all the choices while making a new project and what is all does etc takes a lot of time / I find poorly documented. Half of the tutorials/help just day, yeah, click this this and this and default is bad and the other half do explain it but then you should have knowledge about the complete IDE already. So it always takes some time to get up and running as a newbie to the platform :D

Ok so as per your suggestions I will switch to new environment of STM, But can you guys can give me any specific link/tutorial/platform from where should I start? Also Which one should I prefer in STM series? Which burner is good for it?

I would suggest you to get a "Nucleo Board", they are "official", ultra cheap and come with a free ST-LINK V2.1

Have a look on those starting videos: (part 1) (part 2)

also for the Discovey Board: and

Don't worry much about the board, I personally find the STM32F103 Nucleo the best value for money for general stuff. The official Dev Boards available are Nucleo, Discovery and Eval boards, from the more simple to the more complex boards - in terms of the built-in features. The CPU might be the same but they have different peripherals assembled on the board.

For the code development, there is a stepper curve compared to Arduino and that's mostly because there's no such thing as STM32 IDE. Also, the code will look more like a proper C code instead of a script. People use what they prefer and that can slow down things a bit for until you have your environment setup. Even the libraries, STM32 used to have the old "Standard Library" and now they offer the "HAL Libraries" via CubeMX. Some developers might even touch the registers directly (like we do for Arduino from time-to-time). Anyway, is like Arduino, once you start getting used with the Libraries and the code model things start to flow.

Once you see how CubeMX works you'll be sold to it... the flexibility to configure the Pins, Clock and initialize code is amazing. You'll see that there's no such thing as "PINs 8/9 are TX/RX", you can easily move pin allocations around. Also make sure you program your software withing the delimited "comment" areas of the generated code, so you can re-run the CubeMX to change something without overwriting your code.

The fact is that there are some many ARM chips out there that is better pick one or two to play with and only pick another one if you really need the resources. ST says that if you program using their HAL Libraries you should be able to move your code from a STM32F1 to a STM32F4 with no need for changes.

Regarding the "burner", those boards, like Nucleo, come with a built-in "burner" or programmer called STLink-V2. You can even use the built-in programmer to program a bare MCU or another board that don't have the burner - like the $3 STM32F103 boards you can buy on eBay (

The STLink V2 allows you to program it via a native USB drive and also allow real-time debugging with code break-points, step-in/over, registers and memory access - this is called SWD interface and replaces the old JTAG. Once you do a step-by-step debugging you also never want use "println" for that...

There's also a SDO interface where you can use to output/print data, similar to the Serial but can be used even withing fast Interrupts. Finally, you also have a virtual serial on the ST-LINK, or if you prefer, you can use a real UART from the MCU pins to "print messages" as the Arduino debugging style.

Ops.. don't forger that every STM32 has at least a "built-in" Serial bootloader so you can upload your code via serial (some have even a CAN Bus bootloader...) - This is not like an Arduino where the bootloader is a piece of code you can upload, this is part of the hardware, so it'll be always there if you don't need or don't want to user a SWD programmer.

Finally, don't forget those MCUs are 3.3V and they can't provide/drain as much current as an ATMega328p can. Although many pins are 5V tolerant, it's important to keep this in mind when start connecting things.

STM released an official core for some Nucleo boards. take a look at the STM32duino forum

Hello musskopf,

thanks a lot for your detailed explanations!

I am also interested in this topic (getting into STM32 programming).

I am pretty confident with programming the Arduino, but the STM32 is new territory for me. I got myself a Naze32 flightcontroller (STM32F103CB, IMU, gyro, magnetometer, ...) and I managed to setup cross compilation under Windows (with cygwin, gcc, ...), modify and compile the software, plus download it to the STM32F103CB (with the Cleanflight Chrome App).

Now I would like to write my first program for the STM32 platform from scratch. I find it much harder to get into this topic compared to getting into Arduino programming. Could you recommend me tutorials for that? I am especially interested in (1) setting up an efficient development environment and (2) debugging.

I got myself an ST-Link V2 from eBay: Do you think this is sufficient to start with?

cheers, Zealot

Hi Zealot,

To start a program from scratch I would first recommend you to get a Dev. Board… get a Nucleo Board. Install the ST-Link software, Cube MX and for the IDE give a go to the Atollic (… it’s backed by a commercial so you do have the option to move to the “Pro” version in case things get more serious. I just found those videos on their site:

Alternatively try the SW4STM32, but I had some little issues setting this up a year ago, but I believe it has been fixed by now.

The videos I posted before are great starting points… also, there are some official examples for the STM Nucleo Boards shipped together with the Cube MX (HAL Libraries).

Try it and post your finds here to help others!


Hi Musskopf,

(1) there is a ton of Nucleo Boards out there - which one would you recommend?

Usually I would go for a high performance board, like the NUCLEO-F411RE (with the STM32F411RET6). Besides speed, amount of free memory, etc. - does it make any difference in the basic programming which board to choose?

(2) And what is the difference between Nucleo-64 and Nucleo-144 boards?

(3) I also found some references to the Discovery boards. Which ones are better: Nucleo or Discovery?


Hi Zealot,

You're right, there are lots of Nucleo Boards... basically because there are lots of different ARM MCUs with different features and peripherals. Here all boards:

Regarding -64 and -144, you also have the -32. That's basically the "chip" package size. So more or less pins, but normally also come with more power and memory the bigger chips.

I personally would pick the Nucleo-F103rb if you don't have any special peripheral requirement. That's because you can find lots of STM32F103 boards on eBay and other places for very low costs. Those are stand-alone boards without the built-in ST-Link but if you have a Nucleo Board with the same or similar MCU, you can easily upload the same firmware for the other board.... see it as Nucleo being and Arduino Uno and the eBay STM32F103 boards being an Arduino Pro ;)

One important thing: if you wanna know all features of a Nucleo Board, you actually need to have a look at the MCU used in it and not in the Board Specs itself. For example for the Nucleo-F103rb, you need to look at:

For the discovery boards, they are also simple Dev boards, normally with one or two extra feature, maybe a few extra LEDs, but the Nucleos have better PIN headers and has similar form factor of an Arduino Uno, as well it's more common to find people former Arduino owners using it.

Recently there was a review of a Discovery board (32L152CDISCOVERY) on EEVblog:

What do you think about this board?

I haven't used it... But there's no right or wrong choice. Just get one and give it a go! They are not expensive and after you play a few months with one you'll have an idea what suits you better.

OK. I will.

Two last questions:

In the STM User Manual for this board, chapter "Getting stared with software development toolchains", they only mention: * IAR Embedded Workbench * Microcontroller Development Kit by Keil * TrueSTUDIO by Atollic * TASKING VX by Altium

Unfortunately GCC is not mentioned. Dave/eevBlog ended up downloading IAR, but the free version only allows to produce code up to 32kb.

(1) Which IDE would you choose?

(2) I figured out that the free IDE "CooCox" uses GCC. What do you think about CooCox?

cheers, Zealot

Hey Zealot,

I've mentioned a few others IDEs before like SW4STM32 and Atollic, both free and using GCC. Again, I've never tried CooCox, but pretty much I believe is based on Eclipse and probably uses Openocd for debugging.

Anyway, that's the problem with ARM universe, so many options and people get confused and unsure about what to use. The reality there's no correct answer, try a few and sticky with whatever works for you... that's not like marriage where you get in trouble when start looking for other options down the track.