AnsweredAssumed Answered

MQX Low Power Mode: stop from wait

Question asked by corrado carini on Oct 8, 2013
Latest reply on Oct 8, 2013 by corrado carini

Good evening,

I'm working on a K60 MQX3.8, I need ethernet, but in some conditions I need to go to LPM_OPERATION_MODE_STOP.

For a stable Ethernet RMII PHY working I needs a 50MHz ext clock source that I even use for cpu.

I need to disable oscillator (enable pin) before going to LPM_OPERATION_MODE_STOP.

To do this I tried this sequence but it doesn't go.

 

1. LPM_OPERATION_MODE_RUN -> LPM_OPERATION_MODE_WAIT (switch to intenal oscillator)

2. switch off oscillator with a GPIO port

3. LPM_OPERATION_MODE_WAIT -> LPM_OPERATION_MODE_STOP

4. reverse operations to wahe up

 

With this code everything is OK (tested with oscilloscope).

I go in and out wait condition and switch off/on ext oscillator

    MCG_C6 &= ~MCG_C6_CME_MASK;

    _lpm_set_clock_configuration(BSP_CLOCK_CONFIGURATION_2MHZ);

    _lpm_set_operation_mode (LPM_OPERATION_MODE_WAIT);

    _time_delay(1000);

    SetGen(Osc,OFF);//switch off oscillator

    _time_delay(1000);

    SetGen(Osc,ON);

    _time_delay(1000);

    _lpm_set_operation_mode (LPM_OPERATION_MODE_RUN);

    _lpm_set_clock_configuration(BSP_CLOCK_CONFIGURATION_DEFAULT);

    MCG_C6 |= MCG_C6_CME_MASK;

 

Even this code is OK:

    MCG_C6 &= ~MCG_C6_CME_MASK;

    _lpt_run (0, TRUE);//timer start

    _lpm_set_operation_mode (LPM_OPERATION_MODE_STOP);

    _lpm_set_operation_mode (LPM_OPERATION_MODE_RUN);

    MCG_C6 |= MCG_C6_CME_MASK;


The problem is when I go to STOP from WAIT. I never wake up from LPM_OPERATION_MODE_STOP even if I keep ext osc on.

    MCG_C6 &= ~MCG_C6_CME_MASK;

    _lpm_set_clock_configuration(BSP_CLOCK_CONFIGURATION_2MHZ);

    _lpm_set_operation_mode (LPM_OPERATION_MODE_WAIT);

    _time_delay(1000);

    _lpt_run (0, TRUE);

    _lpm_set_operation_mode (LPM_OPERATION_MODE_STOP); <<<----------- code stops here!!!

    _lpm_set_operation_mode (LPM_OPERATION_MODE_WAIT);

    _time_delay(1000);

    _lpm_set_operation_mode (LPM_OPERATION_MODE_RUN);

    _lpm_set_clock_configuration(BSP_CLOCK_CONFIGURATION_DEFAULT);

    MCG_C6 |= MCG_C6_CME_MASK;

 

Any idea?

Thank you,

Corrado

Outcomes