CAN Baud rate configuration

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

CAN Baud rate configuration

2,163 Views
sheelahariharan
Contributor I

i need to configure 504kbps or 498kbps in HCS12x with MC9SXDP512 microprocessor. is this possible? what register configurations i need to do?

Labels (1)
0 Kudos
5 Replies

1,593 Views
RadekS
NXP Employee
NXP Employee

CAN baud rate could be selected by write into CANBTR0 and CANBTR1 registers.

For calculating baud rate values we need to know several parameters like oscillator frequency, Physical Interface Tx+ Rx propagation delay,….

Note: We suppose that external oscillator will be used as clock source for CAN interface. PLL isn’t recommended due to CAN bit time requirements and PLL lock/unlock range.

In attachment you can find simple CAN baud rate calculator.

I hope it helps you.

0 Kudos

1,593 Views
sheelahariharan
Contributor I

i tried with those registers but could not able to achieve this baud rate accurately.

Im using HCS12x starter kit. in that crystal oscillator frequency is 16Mhz and bus clock is 8MHz. is there any possibility to change the Fosc clock in that starter kit?

without changing Fosc i cant configure PLL to achieve the above said baud rates

this is for my internal testing purpose only.

0 Kudos

1,593 Views
RadekS
NXP Employee
NXP Employee

Yes, you can change oscillator for achieve requested baud rate.

S12X starter kit board contains on-board 4MHz crystal and 8pin DIP socket for external CMOS oscillator.

You can use for example oscillator with frequency 18.432MHz and settings CANTBR0=0xC0, VANTBR1=0xD6 will produce real baud rate 498162 bits/s which is pretty close to 498kbps.

Or you can use for example oscillator with frequency 19.6608MHz and settings CANTBR0=0xC0, VANTBR1=0xE7 (or 0xC2, 0x46) will produce real baud rate 504123 bits/s which is pretty close to 504kbps.

EDIT:

Note: if it is just for test purpose, you can use signal generator for generating square 2.5V EXTAL signal at requested frequency.

0 Kudos

1,593 Views
sheelahariharan
Contributor I

Thanks for your reply..

Can i get details about external CMOS oscillator.. Do i need to do any software configuration for that oscillator.. How do i select that oscillator as the reference for CAN clock..

Sent from my Windows Phone

0 Kudos

1,593 Views
RadekS
NXP Employee
NXP Employee

You need something like this:

http://www.oscilent.com/spec_pages/Oscillators/CO-320.html

At board:

Move jumper J113 to position 2-3 (CLOCK) and close jumper J114 (XCLKS#=0).

Reset MCU.

In software: CANCTL1_CLKSRC bit selects oscillator or bus clock as CAN clock source.

That is all.

0 Kudos