How to Program STM32F103C8T6 With ArduinoIDE
by bestutsource in Circuits > Arduino
6933 Views, 2 Favorites, 0 Comments
How to Program STM32F103C8T6 With ArduinoIDE
The STM32F103C8T6 board-also known as Blue Pill-is the development board M3 microcontroller of ARM Cortex. It looks very similar to Arduino Nano, but it contains more functions.
In this article, I will show you how to set up STM32 using Arduino IDE and show you how to program directly from the USB UART module. STM32 overview "Blue Pill" If you look at this $2 microcontroller, the first thing you see is its jumper pins, which are used to use the default USART bootloader. There is also a micro USB port on the board, but unfortunately it cannot be used for programming because it does not have an associated bootloader. Compared with the official Arduino boards, these boards are very cheap and the hardware is open source. In addition to the microcontroller, the board can also accommodate two crystal oscillators-an 8MHz crystal and a 32KHz crystal-which can be used to drive the internal RTC (Real Time Clock). Therefore, the MCU can work in deep sleep mode, which is very suitable for battery-powered applications. To program the board, we need to use a simple USB to UART converter, and then we can program it directly from the computer via USB.
STM32 pinout
Fritzing Diagram
Required materials
STM32 F103C8T6
USB to UART converter (FTDI)
Jumper
Breadboard
Arduino IDE
Wiring project Connect the circuit boards according to the connections shown in the Fritzing diagram below and connect them to the computer.
Use the Build Settings With Jumpers in Place.
Use the build settings with jumpers in place.
Connect the jumper as shown in the figure below, set the circuit board to DFU mode (device firmware upgrade), and then press the "reset" button.
Set up STM32 on Arduino IDE
Open the Arduino IDE and Select Preferences.
Open the Arduino IDE and select preferences.
Click the "Other Board URL" Option and Add This URL After the Comma:
Click the "Other Board URL" option and add this URL after the comma:
http://dan.drown.org/stm32duino/package_STM32duino_index.json
Then Click Tools→Boards→Board Manager.
Then click Tools→Boards→Board Manager.
After performing the above steps, you can see STM32 in the board list. Now select STM32F103C.
Because we use the UART module to upload code, we choose Upload Method as Serial.
Select Blink sketch from the example.
Use "PC13" to Change the LED Pin Number, As Shown in the Screenshot Below. This Is the Name of the Built-in LED in the Circuit Board
Use "PC13" to change the LED pin number, as shown in the screenshot below. This is the name of the built-in LED in the circuit board
Project source code
void setup() { // change pin PC13 pinMode(PC13, OUTPUT); } //infinite loop void loop() { digitalWrite(PC13, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(PC13, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
Upload the Code to the Arduino IDE
Upload the code to the Arduino IDE
Upload the code now.
Uploaded successfully!
in conclusion If the program has been uploaded successfully, you should see the green LED flashing at 1 second intervals. You can also use this program to increase or decrease the delay of the LED lights. After uploading the program, you should change the jumper back to the normal mode so that the uploaded program will automatically start to execute when the circuit board is turned on next time.