Stm32f407DISCOVEY study uart serial port baud rate summary

Publisher:VS821001Latest update time:2018-08-13 Source: eefocusKeywords:Stm32f407  uart Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

I have been debugging Stm32f407DISCOVEY these days. Since there is no ready-made library function routine for the serial port, I used the routine on the Shenzhouwang development board to directly debug. As a result, the serial port output is always messy, 115200 baud rate; I tried to change it to 38400 and it can actually print, which is more than 3 times the difference; there is only one truth, after debugging and searching Baidu, I finally found the reason;

.The clock frequency is wrong. Since the clock frequency is automatically defined in the library file, I didn’t notice it at first, but the baud rate was always wrong. Later I found that the problem was that the external crystal oscillator defined in the library file was 25M, and the DISCOVERY board used an 8M crystal oscillator, so the generated main frequency was wrong. Two places need to be changed. ①So in stm32f4xx.h, change
#if !defined (HSE_VALUE) 
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
#endif /* HSE_VALUE */

In system_stm32f4xx.c, change
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */

#define PLL_M 8


The serial port prints normally;



Keywords:Stm32f407  uart Reference address:Stm32f407DISCOVEY study uart serial port baud rate summary

Previous article:STM32 serial port program (register version)
Next article:STM32F407 clock configuration (system_config.c)

Recommended ReadingLatest update time:2024-11-15 09:47

ARM exception---the triggering process of a Uart interrupt
First some definitions: //2440addr.inc INTOFFSET EQU 0x4a000014 ;Interrupt request source offset   //option.inc _ISR_STARTADDRESS EQU 0x33ffff00 //2440init.s          MACRO $HandlerLabel HANDLER $HandleLabel $HandlerLabel     sub sp,sp,#4 ;decrement sp(to store jump address)     stmfd sp!,{r0} ;PUSH the wo
[Microcontroller]
Hardware I2C of STM32F407
I am using the firmware library for STM32. The hardware module parameters must be configured before use. The I2C configuration is as follows: void IIC_Config(void) {     GPIO_InitTypeDef GPIO_InitStructure;     I2C_InitTypeDef I2C_InitStructure;     RCC_ClocksTypeDef rcc_clocks;     /* GPIO Peripheral clock enable *
[Microcontroller]
Animated graphics demonstrate the underlying principles of serial communications such as UART, SPI, and I2C
Serial communications such as UART, SPI, and I2C are very common communication methods in embedded development. The underlying communication principles of these communications are not difficult, but many beginners cannot learn them. This article shares some underlying data transmission principles of common communica
[Microcontroller]
Animated graphics demonstrate the underlying principles of serial communications such as UART, SPI, and I2C
【stm32f407】External interrupt to realize key interrupt mode
External interruption Each IO of STM32F4 can be used as an interrupt input port for external interrupts, which is also the strength of STM32F4. The interrupt controller of STM32F407 supports 22 external interrupt/event requests. Each interrupt has a status bit, and each interrupt/event has independent trigger and ma
[Microcontroller]
【stm32f407】External interrupt to realize key interrupt mode
AVR-based serial port and PC communication code (uart8-bit data)
/************************************ AVR clock: 8.00MHz *Baud rate 9600 (51) 8 bits of data, 1 bit of stop, when the baud rate is set to 19200, UBRR = 25, 4800 = 103 *Note: The baud rate setting is 9600 for the best result. Other data are unstable. For UBRR values ​​corresponding to different baud rates, refer to
[Microcontroller]
STM32F103 and STM32F407 pin compatibility issues
Solution 1: The 407 has all the functions that the STM32F103 has, and the pins of these functions are completely compatible, only the programs are different. . . The STM32F407 has some functions that the 103 may not have, because the 407 is more powerful. I hope it will be useful to you. Solution 2: No. 407 sup
[Microcontroller]
STM32F407 basic timer TIM6 & TIM7 (operation register)
The basic timers TIM6 and TIM7 include a 16-bit auto-reload counter driven by a programmable divider. It can be used as a normal timer or to drive a DAC. The two timers are completely independent and do not share any resources. They are often used in conjunction with a DAC. As a timer configuration steps: 1. Set
[Microcontroller]
MSP430 MCU UART
The USART module consists of the baud rate part: baud rate generator, serial communication receive/transmit control register, receive part, transmit part, and port IO part. Use the serial port debugging software to send a character to the serial port. After receiving it, the MSP430 microcontroller wakes up from low po
[Microcontroller]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号