When studying the UART1 serial port case of Wildfire's firmware library, I used the STM32103F103RB chip on the SIM9008 module application board, and the external crystal used was 12M.

The serial port reads garbled characters

The default external crystal oscillator is 8M

Since the STM32 library is implemented under the condition of an external crystal oscillator of 8M by default, the baud rate of the serial port is also configured at 8M, including the main frequency.

If an external crystal oscillator of 8M or 12M is used, the configuration clock is 72MHZ.

STM32 single chip microcomputer external crystal oscillator configuration clock setting

1) Change it like this in void SetSysClockTo72(void) in the system32_stm32f10x.c file:

8M:

RCC-》CFGR |= (uint32_t) (RCC_CFGR_PLLSRC_HSE | RCC_CFGR_PLLMULL9);//8*9=72

12M:

RCC-》CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_HSE | RCC_CFGR_PLLMULL6);//12*6=72

2) Modification in stm32f10x.h:

8M:

#define HSE_Value ((uint32_t) 8000000) /*! 《Value of the External oscillator in Hz */

12M:

#define HSE_Value ((uint32_t) 12000000) /*! 《Value of the External oscillator in Hz */

Hotel Ballroom Projector

Portable Hotel Projector,home bedroom hotel projector,large banquet hotel projector

Shenzhen Happybate Trading Co.,LTD , https://www.happybateprojectors.com