Most of the STM32 boards support ARDUINO programs. We need to configure them to do so and in this tutorial I am going to show you How to use STM32 as ARDUINO.
So I am using Nucleo F401-RE, It’s a Cortex-M4 device with 84 MHz clock frequency and of course can be programmed as an Arduino.
To get started, first we need to download Arduino. You can download the latest version from HERE
Now open the IDE and goto File->Preferences. It will look like the picture below
Next we need to download some board manager files, so just paste
https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/master/STM32/package_stm_index.json for M4 series or http://dan.drown.org/stm32duino/package_STM32duino_index.json for M3 series, in the highlighted area above.
Click OK and go to Tools-> Boards-> Board manager and let it refresh.
Now in the search box, type STM32 and you will see your board as highlighted in the picture below
If you see your board, just click install and wait for it to finish.
Now connect the board to the computer and in the Arduino IDE, goto Tools-> Board:. Here you select your board. You can choose the Variant and CPU SPEED if it is available.
Next click Upload Method and choose Serial.
Next click the Port and choose the Port to which your board is connected.
This is it Now go to File -> Examples -> Basic -> Blink and upload the sketch to your board. Once the uploading is done, you can see the LED blinking.
NOTE that in case of STM32F103C8T6, LED is connected to PC13. So you have to replace LED_BUILTIN with PC13.
Yo can check out the VIDEO BELOW