Date: 2017-Week-39
Status: Working.
Getting started with the STM32-Blue Pill generic board using the free EmBitz IDE on Windows.
To blink the LED and stop it when user button is pressed. (The button is and external added button on port B15)
Done using the Standard Peripheral Library, no HAL drivers were used.
- STM32F103C8T6 microcontroller, 64KB Flash memory, 20KB SRAM in 48-pin LQFP, 4 to 16 Mhz crystal input to generate maximum 72Mhz clock
- SWD programming/Debugging interface.
- One User LED - Green _ PC13
- On-Board 8Mhz Crystal.
- On-Board 32.786Khz oscillator connected to RTC ports.
- Extension header for all QFP48 I/Os for quick connection for prototyping.
stm32duino - Blue Pill Official
Pinout Diagram
ST Microelectronics STM32 ARM MCU Site
STM32 Info @ emcu
system_stm32f10x.c = System Clock Configuration file.
We are using the external oscillator (HSE) which is 8Mhz
We are using PLLCLK Mux
- Uncomment the line: #define USE_STDPERIPH_DRIVER
- set this:
#define HSE_VALUE ((uint32_t)8000000)
- set this:
#define HSI_VALUE ((uint32_t)8000000)
- Uncomment the 56MHz clock config line and comment the 72MHz line as seen below:
/* #define SYSCLK_FREQ_HSE HSE_VALUE */ /* #define SYSCLK_FREQ_24MHz 24000000 */ /* #define SYSCLK_FREQ_36MHz 36000000 */ /* #define SYSCLK_FREQ_48MHz 48000000 */ #define SYSCLK_FREQ_56MHz 56000000 //#define SYSCLK_FREQ_72MHz 72000000
The rest of the file will do the configuration automatically to get the following:
- PLLCLK = enabled
- PLLMul = x7
- SYSCLK = 56MHz
- AHBPrescaler = /1
- HCLK = 56Mhz
- APB1Prescaler = /2
- PCLK1 = 28Mhz
- APB2Prescaler = /1
- PCLK2 = 56Mhz
fac_us=SystemCoreClock/8000000;