The USART_IT_IDLE interrupt is an interrupt that occurs after the serial port receives a frame of data. It can also be called a packet of data.
Difference between USART_IT_IDLE and USART_IT_RXNE
When 1 byte is received, a USART_IT_RXNE interrupt will be generated
When a frame of data is received, a USART_IT_IDLE interrupt is generated.
Clear interrupt method
//USART_IT_RXNE
USART_ClearITPendingBit(USART1, USART_IT_RXNE);
//USART_IT_IDLE
USART1->SR; //Read SR register first
USART1->DR; //Read DR register again
Usage Examples
u8 count;
u8 flag;
void uart_init(u32 bound)
{
...
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
USART_ITConfig(USART1, USART_IT_IDLE, ENABLE);
...
}
void USART1_IRQHandler(void)
{
u8 r;
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
{
USART_ClearITPendingBit(USART1, USART_IT_RXNE); //Only USART_ReceiveData can also be used
//r = USART_ReceiveData(USART1);
count++;
}
else if(USART_GetFlagStatus(USART1, USART_FLAG_IDLE) != RESET)
{
USART1->SR;
USART1->DR;
flag = 1;
}
}
int main()
{
while(1)
{
if(flag == 1)
{
printf("count %d\r\n", count);
flag = 0;
count = 0;
}
delay_ms(10);
}
}
Experimental phenomena
Previous article:STM32 general timer timing function study notes
Next article:stm32 USART receive bus idle interrupt --USART_IT_IDLE
- Popular Resources
- Popular amplifiers
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
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Award-winning live broadcast: Bluetooth 5.0, Thread, Zigbee, TI 15.4-Stack, multi-protocol management, all explained to you at once
- Programming implementation of volume control for media applications based on touchpad (Hot Wheels)
- Open Source ESP32 Color Screen WIFI/BLE Smart Multimeter Production Process (3. Frequency Duty Cycle Measurement)
- [Summary of power supply simulation data] 50+ power supply simulation analysis methods and simulation tool application resources
- Talking about IoT and 5G
- [Distributed temperature and humidity acquisition system] + STM32H745I-LWIP debugging process
- 【Recruitment】RF, chip, engineer
- 【TI recommended course】# Master the design of flyback power transformer and circuit#
- EEWORLD University Hall----Live Replay: Third Generation TI C2000? New Features and Resources Update
- Show off the boards (Launchpad and Arduino)