如何根据 Tq 和时钟频率 ? 计算 CAN 总线波特率

发布于 2025-01-16 10:09:39 字数 802 浏览 0 评论 0原文

首先,我想我知道如何从图中的参数计算CAN总线波特率,这是一个CAN FD配置。

PIC1

clock frequency :80000 k
pre-scaler :1 
so we can get the Tq = 1/80000 K 
BTL cycles : 40
time for a bit  = 40 * (1/80000K) = 1/2000k
So we can get the baud rate  = 1/ (1/2000k) = **2000k .**
this Baud rate which we calculated is equal to the value which the CANoe Generated.

但令我困惑的是:当我使用这种方法计算 CAN(不是 CAN FD)的波特率时,结果与CANoe生成的值不同,为什么??? CAN 和 CAN FD 之间有什么不同吗? 你能帮我吗?非常感谢 !

PIC2

clock :16000K
Pre-sacler :1
tq = 1/16000k
BTL : 16
time for a bit  = 16*1/16000k = 1/1000k
baud rate = 1000k
but result generate via CANoe is 500k ,seems somewhere i missing a "divide by 2 " ??

first , I think I know how to calculate the CAN bus Baud rate form the parameter in picture blew ,this is a CAN FD config.

PIC1

clock frequency :80000 k
pre-scaler :1 
so we can get the Tq = 1/80000 K 
BTL cycles : 40
time for a bit  = 40 * (1/80000K) = 1/2000k
So we can get the baud rate  = 1/ (1/2000k) = **2000k .**
this Baud rate which we calculated is equal to the value which the CANoe Generated.

But what puzzles me is :when I use this method to calculate the Baud Rate for a CAN(not CAN FD),the result is different from the value which the CANoe generated ,why ??? is there something different between CAN and CAN FD ??
could you please to help me ? thank you very much !

PIC2

clock :16000K
Pre-sacler :1
tq = 1/16000k
BTL : 16
time for a bit  = 16*1/16000k = 1/1000k
baud rate = 1000k
but result generate via CANoe is 500k ,seems somewhere i missing a "divide by 2 " ??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

药祭#氼 2025-01-23 10:09:39

CANOE的CAN控制芯片是SJA1000,来自CANOE帮助文档。
输入图片 描述在这里

该芯片的 :
输入图片此处描述
CAN时钟=系统时钟*预分频器*2
这个问题的关键点是这里的“2”,对于其他芯片,比如STM32F103,CAN总线设置的时钟是36Mhz,不需要除以“2”
输入图片这里的描述

所以下面的时钟频率可能是我猜的系统时钟
输入图片这里的描述

按照这个规则,我设置了另一块开发板的参数,测得通讯成功。

同时CANOE的用户只需关注波特率和采样点即可,无需过多关注其他参数。

希望这对您有帮助

the CAN control chip for CANOE is SJA1000 ,from the CANOE help document.
enter image description here

for this chip :
enter image description here
CAN clock = system clock * pre-scaler * 2
the key-point of this question is the "2" here ,for other chip ,such as STM32F103 ,Clock set for CAN bus is 36Mhz,it doesnt need to divide by “2”
enter image description here

so the clock frequency below maybe the system clock I guess
enter image description here

According to this rule, I set the parameters of another development board, and the measured communication was successful.

meanwhile the user of CANOE should just focus on Baud rate and sample point ,There is no need to pay too much attention to other parameters.

Hope this helps you

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