FlexCAN Clock Source for i.MX 8M PLUS (MIMX8ML8CVNKZAB)

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

FlexCAN Clock Source for i.MX 8M PLUS (MIMX8ML8CVNKZAB)

310 Views
mjoh
Contributor III

i.MX 8M Plus Applications Processor Reference Manual
Document Number: IMX8MPRM
Rev. 1, 06/2021

FlexCAN register CTRL1 bit CLKSRC says

0b - The CAN engine clock source is the oscillator clock.
1b - The CAN engine clock source is the peripheral clock.

I have set the FlexCAN peripheral clock root to be 80MHz.

When I set CLKSRC to 1 to use peripheral clock the timing on the CAN bus is incorrect.

However if I set CLKSRC to 0 the timing is correct.

Counting backwards from the actual timings I get, the CANCLK is 80MHz when CLKSRC is 0 and 66.6MHz when CLKSRC is 1.

So neither setting gets me the 24MHz oscillator clock.

What is it that I've missed? I assume I should actually use CLKsrc=0?

Tags (1)
0 Kudos
4 Replies

274 Views
jimmychan
NXP TechSupport
NXP TechSupport

Could you tell me which BSP are you using?

How you set the clock source?

0 Kudos

262 Views
mjoh
Contributor III

This is my code:

   flexcan->reg->mcr &= ~MCR_MDIS;
   while ((flexcan->reg->mcr & MCR_LPMACK) != 0);

   flexcan->reg->mcr = MCR_SOFTRST;
   while (flexcan->reg->mcr & MCR_SOFTRST);

   /* Module is enabled and in freeze mode */

   flexcan->reg->mcr |= MCR_MDIS;
   while ((flexcan->reg->mcr & MCR_LPMACK) == 0);

   if (cfg->clksrc == 0)
   {
      flexcan->reg->ctrl1 = 0;
   }
   else
   {
      flexcan->reg->ctrl1 = CTRL1_CLKSRC;
   }

   flexcan->reg->mcr &= ~MCR_MDIS;
   while ((flexcan->reg->mcr & MCR_LPMACK) == 0);
0 Kudos

238 Views
jimmychan
NXP TechSupport
NXP TechSupport

Is your CTRL1_CLKsrc=0x00002000?

Have you try the SDK of i.MX8MP? it could download from https://mcuxpresso.nxp.com/en/welcome.

 

There are examples for flexcan.

SDK_2_14_1_EVK-MIMX8MP\boards\evkmimx8mp\driver_examples\flexcan

0 Kudos

236 Views
mjoh
Contributor III

I have looked at the MCUXpresso SDK flexcan driver examples and they also use clksrc 0.

My goal is to clarify the reference manual, I would like to find out what clksrc 1 actually is?

0 Kudos