LPC5401x - SDK 2.5.0 - MCAN Baud Rate

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

LPC5401x - SDK 2.5.0 - MCAN Baud Rate

1,159 Views
carl-circuitwor
Contributor II

Hi,

Had lots of CAN problems and it turns out one of the issues is the MCAN_Init function doesn't calculate the baud rate correctly if the CANx_CLK_FREQ is not 16Mhz (which is the frequency the demo uses).

The issue is the hardcoded NTSEG1 and NTSEG2 in the MCAN_SetBaudRate function call from the init function.

Thanks,

Tags (3)
0 Kudos
Reply
3 Replies

1,019 Views
carl-circuitwor
Contributor II

Hi,

To get the most of the LPC54xx I was running at 180MHz.. so couldn't achieve an input clock to the MCAN peripheral which was a multiple of 8MHz.

If the init function only works with certain input frequency multiples then could it perhaps check that the input clock is suitable and assert if not. 

LPC5401x data sheet/user guide appears to give no guidance on min/max clock frequency for the MCAN peripheral, some other peripherals like the ADC do. 

Thanks,

0 Kudos
Reply

1,019 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Carl Matthews,

Thanks for your reply.
Let me make it clear.
In MCAN_SetBaudRate function, the fixed DTSEG1 and DTSEG2 values, plus the fixed baud rate: 500 KHz determine that the MCAN_CLK should be multiple of 8MHz.
Hope this is clear.

Have a great day,
TIC

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,019 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Carl Matthews,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
As you mentioned, the DTSEG1 and DTSEG2 value are fixed, however MCAN_SetBaudRate, it's able to achieve the expected baud rate via the adapting the rate prescaler, it means that the other CANx_CLK_FREQs like 8 or 24 MHz, besides of the 16 Hz are available.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply