How to set CAN Baudrate to 666.666 kbps in LPC1768

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

How to set CAN Baudrate to 666.666 kbps in LPC1768

865 Views
emb02
Contributor IV

Hi,

I'm using LPC1768 CAN peripheral and I want to set CAN Baudrate = 666.666 kbps but getting debug error - Failed to calculate exact CAN baud rate.

I'm able to set all standard Baudrates (250kbps, 500kbps, 1Mbps). So can you provide required clock settings and nominal time settings to set 666.666 kbps baudrate .

 

I'm using

MCUXpresso IDE v11.5.0

lpc17xx drivers

@LPC1768 

 

Regards,

EMB02

0 Kudos
Reply
1 Reply

837 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Regarding your question about CAN bus baud rate, first of all, you have to use use external osc_clk if you want to enable CAN1 or CAN2 module to work, because internal IRC is not accurate enough for the CAN bus communication.

I copy the part from section 4.3.1 Internal RC oscillator in UM10360.pdf.

"Also, the IRC should not be used with the CAN1/2 block if the CAN baud rate is higher than 100 kbit/s.The nominal IRC frequency is 4 MHz."

Secondly, the PCLK_CAN1, PCLK_CAN2 and PCLK_ACF bits must be the same value.

xiangjun_rong_0-1680747596266.png

Thirdly, this is the CAN baud rate computation, assume the cclk is 100MHz, the required CAN baud rate is 666.66KHz, the divider will be

100MHz/0.6666666MHz=150

Assume that the PCLK_CAN1 bits are 2b'00, it means that you select CCLK which is 100mhz.

You set up the BRP as 14, the divider will be 15.

If you set up the TESG1 as 4, TESG2 as 3, the synchronization is assumed to be 1, the CAN baud rate will be

100MHz/((BRP+1)*( 1+TESG1+1 +TESG2+1)=100/[15*(1+4+1+3+1)=0.66666MHz.

xiangjun_rong_1-1680749486711.png

Pls have a try.

Hope it can help you

BR

XiangJun Rong

 

 

 

 

 

0 Kudos
Reply