Bit time setting on mc9s08dz60 mscan

These day I working on CAN based ECU programming.In this project CAN bit rate is specified to 500kbps.Nominal bit time can be 10tq 12tq 16tq & 20tq.Sample point must between 75%~80%.
When nominal bit time is 10tq SJW must be 2tq.Nominal bit time is 12tq SJW must be 3tq.And nomimal bit time is 16tq or 20tq SJW is 4tq.
Nominal bit time = Sync_Seg+Prop_Seg+Phase_Seg1+Phase_Seg2
bit rate = CANCLK/NBT
In this ECU I use MC9S08DZ60 as control unit.The MC9S08DZ60 has a MSCAN module which is compatible with CAN2.0 protocol.I will give different settings according to different NBT(Nominal Bit Time) below.
Note:
CANCLK:relate to crystal frequency or bus clock & CANCTL1[bit6] & CANBTR0[bit5:bit0]
SJW: can be configed by CANBTR0[bit7:bit6]
Sync_Seg: fixed to 1tq by MCU
Prop_Seg+Phase_Seg1:can be configed by CANBTR1[bit3:bit0]
Phase_Seg2:can be configed by CANBTR1[bit6:bit4]
First case:NBT = 10tq & bit rate = 500kbps
CANCLK = 5MHz
SJW = 2tq
Sync_Seg = 1tq
Prop_Seg+Phase_Seg1 = 7tq
Phase_Seg2 = 2tq
calculate sample point position =(Sync_Seg+Prop_Seg+Phase_Seg1)/NBT = (1+7)/10=80%
Second case:NBT = 12tq & bit rate = 500kbps
CANCLK = 6MHz
SJW = 3tq
Sync_Seg = 1tq
Prop_Seg+Phase_Seg1 = 8tq
Phase_Seg2 = 3tq
calculate sample point position =(Sync_Seg+Prop_Seg+Phase_Seg1)/NBT = (1+8)/12=75%
Third case:NBT = 16tq & bit rate = 500kbps
CANCLK = 8MHz
SJW = 4tq
Sync_Seg = 1tq
Prop_Seg+Phase_Seg1 = 11tq
Phase_Seg2 = 4tq
calculate sample point position =(Sync_Seg+Prop_Seg+Phase_Seg1)/NBT = (1+11)/16=75%
Last case :NBT = 20tq & bit rate = 500kbps
CANCLK = 10MHz
SJW = 4tq
Sync_Seg = 1tq
In this condition there have two cases to set the CAN sample point .Both of these two cases are satisfied with the above requirement(sample point between 75%~80%)
case A:
Prop_Seg+Phase_Seg1 = 14tq
Phase_Seg2 = 5tq
calculate sample point position =(Sync_Seg+Prop_Seg+Phase_Seg1)/NBT = (1+14)/20=75%
case B:
Prop_Seg+Phase_Seg1 = 15tq
Phase_Seg2 = 4tq
calculate sample point position =(Sync_Seg+Prop_Seg+Phase_Seg1)/NBT = (1+15)/20=80%

One Comment

  1. 呵呵,强悍。。

    66xs said on: July 11, 2010 04:56

Post a Comment

Your email is never published nor shared. Required fields are marked *

*

*

Type your comment out: