To make a GPIO toggling in STM32, you need to work with two peripherals: RCC (reset and clock control) and GPIOx (general purpose input/output). The real story is a bit longer, but I’ll tell you here the short version. We see in the schematic that LED turns on when GPIO pin is ‘0’ logic and turns off when ‘1’. The Blue Pill has two LEDs, one for power and one driven by MCU, connected to port C, bit 13, as we can see in the schematic got from Schematic and documentationįor making the LED to blink we need to configure GPIO port C13 and add some delay. Disconnect one before plugging-in the other one.įor uploading the binary to the Blue Pill, respectively complete target erase, use either: make flash
BLUE PILL SCHEMATIC CODE
When need the removal of the output files, use: make cleanīefore uploading the code into the board, you need to seat both jumpers towards the micro-USB connector, then connect the debugger to the Blue Pill like in the picture:Ĭaution! Do not use two USB connection at the same time (on debugger and on-board) because you risk to fry the board or PC’s USB ports. If you copy&paste the content from above, be careful at tab characters, could be replaced by spaces and make utility does not like this.įor build, cd to the files directory, then use any of these, there is no difference: make This makefile can be used for multiple things: for build, clean, upload or erase target. $(LD) -T linker.ld -o app.elf crt.o main.o Let’s build everything: makefile CC = arm-none-eabi-gcc This data can be found in the datasheet at page 34.
BLUE PILL SCHEMATIC HOW TO
This instructs the linker how to place different sections of data into the binary. Linker script file linker.ld MEMORYįLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K The last two lines are the jump to main() and the infinite loop, in case someone wants to exit from the main function.
thumb_func directive instructs the assembler to generate a thumb executable code from the subsequent lines. word line is the reset vector and is placed at 0x0000_0004. word line will be placed at the very beginning of the binary file at address 0x0000_0000 and represents the end of RAM. The thumb code is more compact in terms of memory footprint, but is a bit slower at run time. The first two lines are instructing the assembler to generate thumb code for the Cortex-M3 core. If you are not familiar with the ARM/thumb assembly and you don’t want to be, just skip the explanations below.
You can use as well, Ubuntu, Raspbian, and even Microsoft Windows. The host platform used for this guide is Linux Mint 19.3.
BLUE PILL SCHEMATIC MANUAL
We are going to build a LED blink app from scratch, using only the manual of the STM32F103C8T6 chip. Do you want to start STM32 programming? Get the Blue Pill which is featuring the powerful & cheap ARM Cortex-M3 32-bit microcontroller then, let’s go!