Lanqiao Cup Embedded-Serial Port
- (1) Personal habits
- (2) Preparation
- (3) Write void USART_init(u32 bound) initial function
- (4) Write void USART2_Send(u8 *str) sending function
- (5) Write void USART2_IRQHandler(void) receiving function
- (6) Write void USART2_Purging(void) clear function
- (7) Write serial port data processing function
- (8) Problem
(1) Personal habits
A separate USART.c and USART.h will be created and placed under the HARAWARE folder
(2) Preparation
1. Lanqiaocup embedded board cannot directly use serial port 1, so here is the experiment with serial port 2.
2. Add library file: stm32f10x_uasrt——> there are library functions about serial port configuration
3. Add library file: stm32f10x_rcc ——>About Interrupt configuration related library functions
(3) Write void USART_init(u32 bound) initial function
(4) Write void USART2_Send(u8 *str) sending function
(5) Write void USART2_IRQHandler(void) receiving function
(6) Write void USART2_Purging(void) clear function
(7) Write serial port data processing function
(8) Problem
Question one:
Where can I find the interrupt channel corresponding to the serial port interrupt in the interrupt configuration?
#include “stm32f10x.h” in the smt32 header file
Question two·:
Function Wait for the data transmission to be completed, and the TXE bit will be set to 1 after the data transmission is completed
Question three:
It can be found under the file in the picture below
Question four:
The disability is to process the data well before proceeding to the next reception process to prevent confusion