Implementing CAN communication with K22 flexcan - timing wrong?

cancel
Showing results for 
Search instead for 
Did you mean: 

Implementing CAN communication with K22 flexcan - timing wrong?

185 Views
ulrich_schmidt
Contributor I

I try to implement a CAN communication with the K22 flexcan. I used the clocks tool from the MCUxpresso IDE to setup the bus clocks. The programm compiles well. The communication runs in callback, but when I try to use external PEAK CAN USB adapter I receive only "kStatus_FLEXCAN_ErrorStatus". All experts I asked, have no idea. The code I mainly copied from the SDK examples. Only my board works with 16 Mhz crystal (the board from the example works with 8 Mhz). Which timing setups are important for correct CAN communication? I added the to files generated by the clocks tool. Do anybody see a mistake in the clock setup? What could I check to find the mistake? Thanks for all your help or tips, Ulrich

Tags (1)
0 Kudos
1 Reply

100 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Ulrich Schmidt,

The clock source of flexcan is OSCERCLK or Bus clock.

FlexCAN clock generation.png

Clocking diagram.png

That example using 8MHz OSCERCLK(from crystal).

Since the frequency of crystal has increased to 16MHz, have you you modify the values of flexcanConfig?

You can refer: FlexCAN 800K Baud issue in KinetisK series

flexcanConfig.png

Best Regards,

Robin

 

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

0 Kudos