当前位置:网站首页>空闲中断无法清除
空闲中断无法清除
2022-06-28 01:47:00 【双古】
调试环境
单片机型号:stm32F103RCT6
异常代码如下。使用串口助手发送一个字节时,一直进入空闲中断,且无法清除空闲中断标志位。
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);
}
}
解决方式
清除空闲终端标志前,再读取一次DR寄存器的值。从手册对于空闲中断寄存器这一位的描述也没看出原理。
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);
}
}
边栏推荐
- 腾讯游戏发布40多款产品与项目 其中12款为新游戏
- [today in history] June 8: the father of the world wide web was born; PHP public release; IPhone 4 comes out
- apache、iis6、ii7独立ip主机屏蔽限制ip访问
- 数字化时代,企业须做好用户信息安全
- Summary of software testing tools in 2021 - fuzzy testing tools
- [games] Parkour
- Packet capturing and sorting out external Fiddler -- understanding the toolbar [1]
- Gateway microservice routing failed to load microservice static resources
- PSM summary
- JDBC and MySQL databases
猜你喜欢

math_ (function & sequence) meaning of limit & misunderstanding and symbol sorting / neighborhood & de centring neighborhood & neighborhood radius

元宇宙标准论坛成立
![[today in history] June 12: the United States entered the era of digital television; Mozilla's original developer was born; 3com merges with American Robotics](/img/91/d7d6137b95f6348f71692164614340.png)
[today in history] June 12: the United States entered the era of digital television; Mozilla's original developer was born; 3com merges with American Robotics

CMU提出NLP新范式—重构预训练,高考英语交出134高分

基于流的深度生成模型

喜新厌旧?IT公司为什么宁愿花20k招人,也不愿涨薪留住老员工

将PCAP转换为Json文件的神器:joy(安装篇)

Différences d'utilisation entre IsEmpty et isblank

分布式事务解决方案Seata-Golang浅析

Mixed programming of C language and assembly language in stm32
随机推荐
CMU puts forward a new NLP paradigm - reconstructing pre training, and achieving 134 high scores in college entrance examination English
简单ELK配置实现生产级别的日志采集和查询实践
[today in history] June 13: parent-child disputes in packet switched networks; The founder of game theory was born; The embryonic form of interactive television
[today in history] June 16: Oracle Bone Inscriptions was established; Microsoft MSX was born; The inventor of fast Fourier transform was born
买股票应该下载什么软件最好最安全?
Packet capturing and sorting out external Fiddler -- understanding the toolbar [1]
The first place on the list - the carrying rate of front-end equipment is up to 10%, and the top 10 suppliers of digital key solutions
Windows 2003 64 bit system PHP running error: 1% is not a valid Win32 Application
Le routage des microservices de la passerelle a échoué au chargement des ressources statiques des microservices
What if win11 cannot use dynamic wallpaper? Solution of win11 without dynamic wallpaper
Simple elk configuration to realize production level log collection and query practice
[522. longest special sequence II]
[today in history] June 6: World IPv6 launch anniversary; Tetris release; Little red book established
《天天数学》连载53:二月二十一日
读书,使人内心宁静
[today in history] June 17: the creator of the term "hypertext" was born; The birth of Novell's chief scientist; Discovery channel on
2021年软件测试工具总结——模糊测试工具
ADB double click the power key command
拾光者,云南白药!
apache、iis6、ii7独立ip主机屏蔽拦截蜘蛛抓取(适用vps云主机服务器)