怎样测CAN的波特率

2020-02-09 11:42发布

请问各位高手
现在遇到一个问题,手头有块板子要和别的设备进行CAN通讯
不过对方CAN通讯的波特率不固定,需要在通讯中板子直接检测对方设备波特率,然后让PIC单片机的选择相应波特率。
如有遇到的请指点下 谢谢!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
16条回答
yyccaa
2020-02-10 09:27
挨个试,哪个波特率情况下能发出数据,就对的了。不同波特率,不会有发送结束中断~~~
------------------------------------------------------------------------------------
不能用发送进行测试的,那样会干扰总线的正常发送,即使你使用了正确的波特率发送,也额外增加了总线的通信负载,所以应该用接收/监听来确认波特率(监听模式更好,连错误帧都不会发送),因为总线波特率一般是唯一的。

CiA上有段说明的(http://www.can-cia.org/index.php?id=409):

Configuring a wrong bit-rate for a CANopen device is a critical issue. Depending on the data stream stuff-bit, CRC,
form or acknowledgement error occurs and the CANopen device will signal this by transmitting an error frame.
The process of error detection and signaling stops, when the device with the incorrect bit-rate goes into bus-off state.

给楼主一篇CiA的文章,Automatic Baudrate Detection in CANopen Networks
点击此处下载 ourdev_536170.pdf(文件大小:165K) (原文件名:Automatic Baudrate Detection in CANopen Networks.pdf)

一周热门 更多>