STM32F401CC 上的 UART 多缓冲区通信问题
你好,我正在研究 STM32f401 控制器。我遇到了 UART 控制器的问题。我正在从 PC 向 STM32 板发送命令。命令由 4 个字节组成。就像 PCLI(PC 登录)一样。在测试代码时,大约 15 分钟或更短时间后..uart 卡住了。我正在使用KEIL进行调试,在这里我看到寄存器(RXNE,IDLE,ORE)这三个寄存器同时为高电平(当数据到达时)。我正在使用 rxcpltcallback 函数。当我从 UART 获取 PCLI 时,我将执行我的事件。uart_registers_img 我的代码看起来像
我将从 rx 回调函数获取命令。
Hy, i am working on STM32f401 Controller. I am facing an issue with the UART controller. I am sending Command from PC to STM32 board. Command Consists of 4 BYTES. like PCLI(which is PC Login). while testing the Code, after and around 15 mins or sometimes less.. the uart is stuck. I am debugging with KEIL, in this i saw the registers(RXNE,IDLE,ORE) these three registers are simultaneously high(when the data arrives). i am using rxcpltcallback function. when i get PCLI from UART i will do my event.uart_registers_img
My Code Looks Like
i will get the command from rx Callback function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你读过手册明白ORE是什么意思了吗?这是溢出错误。在软件处理前一个字节之前,您收到了另一个字节。
简单的解决方案是要么更慢地发送字节,要么更快地处理它们。
如果您不能执行这些操作,那么您需要快速从 UART 读取字节并将它们存储在某个地方而不进行处理,稍后当您有时间时它们会处理它们。
Did you read the manual to see what ORE means? It is overrun error. You received another byte before your software had processed the previous one.
The simple solution is to either send the bytes more slowly, or else process them more quickly.
If you can't do either of these things then you need to read the bytes from the UART quickly and store them somewhere without processing them, and them process them later when you have time.