switching to external oscillator for FlexCAN

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

switching to external oscillator for FlexCAN

802 Views
Shyalusivan
Contributor I

I am trying to switch to external crystal oscillator for FlexCAN but after configuring the CLKSRC bit in CTRL1 and negating the MDIS bit for enabling FlexCAN, still LPMACK bit is 1. It seems like FlexCAN is getting stuck in low power mode. Any solution?

Code for configuring EREFS in SOSCCFG:

SCG->SOSCCSR &= ~SCG_SOSCCSR_SOSCEN_MASK;//disabling SOSC
SCG->SOSCDIV =
    (
       SCG_SOSCDIV_SOSCDIV1(1)
       | SCG_SOSCDIV_SOSCDIV2(1)
    );
SCG->SOSCCSR &= ~SCG_SOSCCSR_LK_MASK; //unlocking SOSCCSR
SCG->SOSCCFG = SCG_SOSCCFG_RANGE(2) | SCG_SOSCCFG_HGO(0) | SCG_SOSCCFG_EREFS(0); // selecting crystal oscillator
SCG->SOSCCSR |= SCG_SOSCCSR_SOSCEN_MASK; //enabling SOSC
SCG->SOSCCSR |= SCG_SOSCCSR_LK_MASK; //locking SOSCCSR
 
Code for CLKSRC selection:
CAN0->MCR |= CAN_MCR_MDIS_MASK;         /* MDIS=1: Disable module before selecting clock */
 CAN0->CTRL1 &= ~CAN_CTRL1_CLKSRC_MASK; 
 CAN0->MCR &= ~CAN_MCR_MDIS_MASK;        /* MDIS=0; Enable module config. (Sets FRZ, HALT)*/

After this code : MDIS=0, LPMACK=1, FRZACK=0

0 Kudos
Reply
1 Reply

763 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

to enter Module disable mode you should go through Freeze mode first.
And be sure clock source for PE clock is active.

BR, Petr

0 Kudos
Reply