当前位置:网站首页>Idle interrupt cannot be cleared
Idle interrupt cannot be cleared
2022-06-28 04:43:00 【Shuanggu】
Debug environment
Single chip model :stm32F103RCT6
The exception code is as follows . When using the serial port assistant to send a byte , Always enter idle interrupt , And the idle interrupt flag bit cannot be cleared .
void USART2_IRQHandler(void)
{
if (UART_GET_FLAG(USART2, UART_FLAG_RXNE) != RESET)
{
fifoUart2.buf[fifoUart2.rcvCnt++] = USART2->DR;
UART_CLEAR_FLAG(USART2, UART_FLAG_RXNE);
}
if (UART_GET_FLAG(USART2, UART_FLAG_IDLE) != RESET)
{
fifoUart2.parseFlag = RT_TRUE;
UART_CLEAR_FLAG(USART2, UART_FLAG_IDLE);
rt_event_send(rcvEvent, RCV_EVENT_UART2);
}
}
Solution
Before clearing the idle terminal flag , Read it again DR Register value . From the description of this bit of the idle interrupt register in the manual, we can not see the principle .
void USART2_IRQHandler(void)
{
uint32_t dr = 0;
if (UART_GET_FLAG(USART2, UART_FLAG_RXNE) != RESET)
{
fifoUart2.buf[fifoUart2.rcvCnt++] = USART2->DR;
UART_CLEAR_FLAG(USART2, UART_FLAG_RXNE);
}
if (UART_GET_FLAG(USART2, UART_FLAG_IDLE) != RESET)
{
dr = USART2->DR;
fifoUart2.parseFlag = RT_TRUE;
UART_CLEAR_FLAG(USART2, UART_FLAG_IDLE);
rt_event_send(rcvEvent, RCV_EVENT_UART2);
}
}
边栏推荐
- 10: 00 interview, came out at 10:02, the question is really too
- Is it true that qiniu business school gives away securities accounts? Is it safe to open an account
- Huawei's 9-year experience as a software testing director
- 求一个能判断表中数据,只填充不覆盖的sql
- Component splitting practice
- Sword finger offer 53 - I. find the number I in the sorted array (improved bisection)
- A bit of knowledge - online resources on Chinese Learning
- Database garbled
- Secouer le son et se battre ~ prêter attention au blogueur
- 华为9年经验的软件测试总监工作感悟—写给还在迷茫的朋友
猜你喜欢

How do I get the STW (pause) time of a GC (garbage collector)?

云厂商为什么都在冲这个KPI?

With the transformation of automatic empowerment, Feihe dairy accelerates its move towards digitalization!

测试/开发程序员真的是青春饭吗?世界是公平的,咱们都凭实力说话......

Pager when importing text files from MySQL

Mise en place d'un cadre d'essai d'automatisation de l'interface utilisateur - - rédaction d'une application d'automatisation

From zero to one, I will teach you to build a "search by text and map" search service (I)

Oracledata installation problems

The growth summer challenge is coming | learn and create two major tracks, and start the tutor registration!

Go language -select statement
随机推荐
阿里P8倾情推荐,Fiddler抓包工具实战篇(一)
MySQL gets the current date of the year
What to do when MySQL changes the password and reports an error
[applet] solution document using font awesome Font Icon (picture and text)
Annual comprehensive analysis of China's audio market in 2022
A bit of knowledge - online resources on Chinese Learning
Is it better for a novice to open a securities account? Is it safe to open a stock account
What are the password requirements for waiting insurance 2.0? What are the legal bases?
The growth summer challenge is coming | learn and create two major tracks, and start the tutor registration!
Google Earth engine (GEE) - global flood database V1 (2000-2018)
How do I get the STW (pause) time of a GC (garbage collector)?
抖音實戰~關注博主
Reading notes of top performance version 2 (II) -- CPU monitoring
Has anyone ever used CDC to synchronize to MySQL with a deadlock?
Matlab exercises -- routine operation of matrix
mysql修改密码报错需要怎么做
有人用cdc同步到mysql发生过死锁吗?
Bitlock recovery occurs in win 10, and the blue screen error code is 0x1600007e
Multithreading and high concurrency II: detailed introduction to volatile and CAS
RT thread bidirectional linked list (learning notes)