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;
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
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- Questions about the nonlinear capacitance of MOSFET tubes
- 【GD32L233C-START Review】1. Unboxing test to light up the color screen
- 【RT-Thread software package application works】+ unpacking and development environment establishment
- Square wave triangle wave generating circuit
- After deleting a wire that was previously laid, AD09 got stuck.
- Saiyuan MCU SC93F8332 lights up the RGB light of WS2812B
- Implementation of a Programmable Fully Digital Phase-Locked Loop
- Canaan wants to record a video about K510. What kind of content do you hope to see? (Attached is the official information about K510)
- Distance of ESD tip discharge needle
- Bone Vibration Sensor LIS25BA-Anti-Wind Noise Example