How to set 500K flexcan in MPC56XX

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set 500K flexcan in MPC56XX

1,038 Views
kimhyunjun
Contributor I

Hi I want setting 500K bit rate FlexCAN in MPC5606B.

100K is work but setting 500k is not work.

is my calculation wrong?

1. 100K (work well)

CAN_0.CR.R = 0x04E40004;  /* Configure for 8MHz OSC, 100KHz bit time */

2. 500K (not work)

CAN_0.CR.R = 0x03000000;   /* Configure for 8MHz OSC, 500KHz bit time */

here is the way how I calculate bit rate 

 - tPROP_SEG = 400ns

 - OSC : 8MHZ

1). NBT * Prescaler = 8MHZ / 500kbps = 16 ( NBT = 4, Prescaler = 4)

2). PROP_SEG = Round_up(400ns * 8MHZ / 4) = 1

3). NBT - 1 - PROP_SEG = 4 - 1 - 1 = 2 (Phase_seg1 = 1, Phase_seg2 = 1)

4). RJW = 1 (smaller of 4 and PHASE_SEG1)

so result CAN_0 Control Register is 0x03000000. but it doesn't work.... TT 

si ther

Tags (1)
0 Kudos
2 Replies

608 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

please use FlexCAN bit timing calculator to check the values.

https://community.nxp.com/docs/DOC-330446 

Regards,

Martin

0 Kudos

608 Views
kimhyunjun
Contributor I

Hi
Thank you for reply my question
I already read that document, and I try it but I doesn't work.
 
Bitrate : 500K bit per second
Bus length = 1m
CPI clock(osc) = 8Mhz
 
1. physical delay of bus : 1m * 5ns = 5ns
    TLE6250(150ns)
    t(PROP_SEG) = 2(5+150) = 310
 
2. NBT * Prescaler = CPI_clock/baud rate = 8Mhz / 500kbps = 16
   NBT = 8
   Prescaler = 2
 
3. Propseg = ROUND_UP(310 * 8MHz / 2) = ROUND_UP(1.24 ) = 2
4. NBT - 1 - 2 = 5 is odd so set propseg 3
   PROPSEG = 3
   8(NBT) - 1 - 3 = 4 => [PHASE_SEG1 = 2, PHASE_SEG2 = 2]
 
5. RJW is chosen as the smaller of 4 and PHASE_SEG1 so RJW = 2
 
summery
PRESCALER = 2
PROPSEG = 3
PHASE_SEG1 = 2
PHASE_SEG2 = 2
RJW = 2
------------------------------------------
CAN_0.CR.R = 0x01490002;
------------------------------------------