K40 - waking up from VLLS1 sleep with external oscillator

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

K40 - waking up from VLLS1 sleep with external oscillator

438 Views
lovro
Contributor II

Hi,

So I am trying to wake up and start executing from VLLS1 stop with FEE oscillator configuration.

I manage to put it in VLLS1 stop mode with no problems.

If I have FEI configuration enabled everything wakes up fine, but if I have FEE mode enabled it hangs, usually at waiting at checking that the oscillator is running in the __init_hardware function. (i am using Codewarrior 10.6 and MK40DN512ZVLQ10 in LQFP 144-pin package microcontroller ( this is a first version microcontroller so the ACKISO bit is in the LLCU_CS register )

I am trying to clear ACKISO bit on wakeup/powerup, but if i put this code

if (LLWU_CS & LLWU_CS_ACKISO_MASK){
    LLWU_CS |= LLWU_CS_ACKISO_MASK;

}

anywhere before oscillator check I get a Hard Fault.

If I try executing that code in main() it executes just fine. So i can't seem to figure out what to do.

So any help is appreciated :-)

Best Regards, Lovro

0 Kudos
1 Reply

316 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Lovro,

I'd like to recommend you to use these code as below to clear the ACKISO bit.

Please go for a try.

    // releases hold with ACKISO:  Only has an effect if recovering from VLLS1, VLLS2, or VLLS3
    // if ACKISO is set you must clear ackiso before calling pll_init
    //or pll init hangs waiting for OSC to initialize
    // if osc enabled in low power modes - enable it first before ack
    // if I/O needs to be maintained without glitches enable outputs and modules first before ack.
    if (PMC_REGSC &  PMC_REGSC_ACKISO_MASK)
    PMC_REGSC |= PMC_REGSC_ACKISO_MASK;


Have a great day,
Ping

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

0 Kudos