星期六, 07 07月 2018 01:58

FlexCAN Bit Timing Calculation

男作者
给本文评分
(1 投票)
FlexCAN 支持CAN协议要求的多种方式来计算位时间,本文是一种基本的位时间关系的一种基本介绍,波特率的计算步骤.

1. 简介

The clock dependency can be described based on the following figure.Starting from a data frame transferred on the bus. A desired baudrate tells how many bits are sent on the network per second. The Nominal Bit Rate (baudrate) is uniform throughout the network and is given by:
波特率的定义公式:
baudrate = 1 / tNBT       (1)
The tNBT represents a period of the Nominal Bit Time (NBT), i.e. single bit transfered on the bus. The NBT is separated into four non-overlaping segments, SYNC_SEG, PROP_SEG, PHASE_SEG1 and PHASE_SEG2. Each of these segments is an integer multiple of Time Quantum (tQ).
tNBT= tQ+PROP_SEG* tQ + PHASE_SEG1* tQ + PHASE_SEG2* tQ = NBT * tQ             (2)
下表概述了每一段可能的设定值.

Note: 函数 MAX( , ) 返回两个数中的较大值.The duration of the segment PHASE_SEG1 may be between 1 and 8 Time Quanta if one sample per bit is selected and may be between 2 and 8 Time Quanta if three samples per bit are selected. If three samples per bit are chosen, the most frequently sampled value is taken as the bit value.The duration of segment PHASE_SEG2 must be equal to PHASE_SEG1, unless PHASE_SEG1 is less than the Information Processing Time (IPT), in which case PHASE_SEG2 must be equal to the Information Processing Time. The Information Processing Time is equal to 2 Time QuantaFrom the table, it would appear that the minimum number of Time Quanta per bit (NBT ) is 5. However, many CAN controllers require a minimum of 8 Time Quanta per bit. The maximum number of Time Quanta per bit is 25.A Time Quantum is the atomic unit of time handled by the CAN engine and it is given by the Serial Clock (Sclock) period as
tQ = 1/Sclock = 1/[CPI_clock /(PRESDIV+1)].            (3)
The CPI_clock is the CAN Protocol Interface clock, can be either the peripheral clock (driven by the FMPLL) or the crystal oscillator clock. The PRESDIV controls a Prescaler that generates the Serial Clock (Sclock)

The clock source selection is done by the CLK_SRC bit of the CTRL register....

继续阅读完整内容

请查看下方广告以解锁文章剩余内容

广告加载中...
查看 49705 最后修改日期 星期六, 07 07月 2018 18:49