纬图虚拟仪器论坛

 找回密码
 立即注册
搜索
查看: 4592|回复: 1

Ginkgo CAN How to calculate the BaudRate

[复制链接]
发表于 2019-12-25 09:29:23 | 显示全部楼层 |阅读模式
本帖最后由 Jerry 于 2019-12-25 09:34 编辑

To calculate the BaudRate, you need to know the CAN controller's clock frequency. Here are the clock frequencies of some devices by STM32 Systemtechnik which allow programming of the BaudRate .

STM32 Manual:
figure 1.png
Figure 1
Refer to above Figure 1
NomanalBitTime = ((BRP+1) * (tPCLK) * (1+(TS1+1)+(TS2+1)))
tPCLK = 1/APB_CLOCK = 1/36M
BaudRate = 1/NomanalBitTime
BaudRate = 1/ ((BRP+1) * (tPCLK) * (1+(TS1+1)+(TS2+1)))
BaudRate = 1/((BRP+1) * (1/36M) * (1+(TS1+1)+(TS2+1)))
BaudRate = 36M/ ((BRP+1) * (1+(TS1+1)+(TS2+1)))

Ginkgo Api Manual:
BaudRate is affected by three parameters(CAN_BRP , CAN_BS1 , CAN_BS2 CAN).
BaudRate = 36M/((CAN_BRP) * (1+CAN_BS1+CAN_BS2)).

For example, CAN_BRP = 6, CAN_BS1 = 3,CAN_BS2 = 2
BaudRate = 36M/(6 * (1+3+2)) = 1Mbps.

Refer to STM32 Manual:
figure 2.png
Figure 2
Refer to Figure 2:
CAN_SJW = (SJW[1:0] + 1)  (SJW[1:0] = 0)

Ginkgo Api Manual:
BaudRate set up table:
baudrate1.png
baudrate2.png

Summary:
STM32 : BaudRate = 36M/((BRP+1) * (1+(TS1+1)+(TS2+1)))
Gingko : BaudRate = 36M/((CAN_BRP) * (1+CAN_BS1+CAN_BS2))

Version: 1.0
Date: 12/24/2019
Author: Jerry
回复

使用道具 举报

发表于 2021-3-18 18:32:57 | 显示全部楼层

在labview上运行demo的话,里面的波特率  tseg0 | Tseg1是按照这个表格来进行赋值的 zlg-baudrate.png



回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|纬图虚拟仪器

GMT+8, 2024-12-22 10:08 , Processed in 0.057620 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表