STM32-HAL CAN仅传输空错误消息
我正在尝试使用 HAL 库通过 CAN 传输消息。为了进行测试,我重复了此视频第一部分中的代码我有相同的bluepill,所以我也这么做了。我也尝试过他的项目,但将 Nucleo RE 更改为 ZE 模型。我查看了其他来源,他们都做了同样的事情,并且在他们的视频/文章中总线按预期执行。
但在我的所有设备上 HAL_CAN_AddTxMessage
都会生成空(或者可能是错误)消息
这些不同的线路是一块板上的 TX 和来自其他收发器的 RX。
调试显示没有任何错误:函数返回HAL_OK
。我在调试模式下一步一步地完成它,一切看起来都很正常。但环回和正常模式都不能传输正确的消息。
另外,我还使用 MCP2515 + TJA1040 检查了我的 LA,并且 CAN 总线工作正常,因为它必须
所以我很困惑,不明白我做错了什么。
I'm trying to transmit messages through CAN using HAL library. For test I repeated code from the first part of this video I have the same bluepill so I just did the same. Also I've tried his project, but changing Nucleo RE to ZE model. I've looked through other sources and they all do the same thing, and in their videos/articles bus perfoms as it is supposed to.
But on all of my devices HAL_CAN_AddTxMessage
produces empty (or maybe error) message
Theese different lines are TX on one board and RX from other transcievers.
Debugging showed me nothing wrong: function returns HAL_OK
. I went step by stem through it in debug mode and everything seemed as normal. But niether loopback nor normal mode transmitts correct message.
Also I've checked my LA with MCP2515 + TJA1040 and CAN bus worked as it has to
So I'm confused and don't understand what I'm doing wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也有同样的问题。我将预分频器设置为高,并将时间量子设置为 1 倍;我将预分频器减半并将时间量子设置为 2、3 和 2。这解决了问题,但不知道为什么。从本教程复制这些数字
I had this same issue. I had my prescaler set high and my time quanta set to 1 times; I halved my prescaler and set my time quanta to 2, 3, and 2. This solved the problem, not sure why. Copied those numbers from this tutorial
问题出在 TimeQuanta 设置中。我必须更加体贴。稍后我会做出更准确的解释
The problem was in TimeQuanta settings. I had to be more considerate. I'll wrigth a more exact explanation later