STM32F401CC 上的 UART 多缓冲区通信问题

发布于 2025-01-11 11:13:40 字数 366 浏览 4 评论 0原文

你好,我正在研究 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尤怨 2025-01-18 11:13:40

你读过手册明白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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文