AnsweredAssumed Answered

FRDM-KL03Z: Need Help to setup to use EXTAL as primary clock for LPTMR.

Question asked by Sara Stout-Grandy on Mar 8, 2017
Latest reply on Mar 10, 2017 by Mark Butcher



I'm trying to set-up my FRDM-KL03Z to run off the external 32kHz crystal in LPTMR mode. Below are my settings:


    SIM_BWR_SCGC_BIT(SIM_BASE_PTR, kSimClockGateLptmr0, 1u);//Enables the LPTMR0 clock gate
    SIM_BWR_SOPT1_OSC32KSEL(SIM_BASE_PTR,0b00); //Selects the 32 kHz clock source (ERCLK32K) for LPTMR
    SIM_BWR_SOPT1_OSC32KOUT(SIM_BASE_PTR,0b01); //Set the clock ERCLK32K output on pin13


    OSC_BWR_CR_ERCLKEN(OSC, 1); //Enables the external reference clock (OSCERCLK)
    MCG_BWR_C1_CLKS(MCG, 0b10); //Selects external clock as the main clock source. This is EXT mode
    MCG_BWR_C2_EREFS0(MCG, 0); //Selects the source for the external reference clock to be external clock.


This doesn't seem to work. What am I missing? I have read the OSC chapter and LPTMR and CLK chapters of the manual. I am very confused about how to get the EXTAL clock set. For that matter, I can't even seem to measure the external clock on the board itself to see that it is alive. Help!