Entering VLPS Causing Processor to Reset

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

Entering VLPS Causing Processor to Reset

1,026 Views
jamesmasamoto
Contributor I

Using K24 and trying to enter VLPS whenever entering idle task. Setup LP Timer to wakeup. In LP Timer ISR, toggling GPIO.

Call to POWER_SYS_Init() seems to reset the processor. No longer see LP Timer GPIO toggling (see attached scope trace).

Snippet of code:

static const power_manager_user_config_t _vlps_config = {

    .mode = kPowerManagerVlps,

    .sleepOnExitValue = false,

    .lowPowerWakeUpOnInterruptValue = kSmcLpwuiEnabled,

    .powerOnResetDetectionValue = kSmcPorDisabled,

};

static power_manager_error_code_t enter_vlps(power_manager_notify_struct_t * notify,

                                             power_manager_callback_data_t * dataPtr)

{

    // NOTE: Currently do not have to do anything when entering VLPS mode.

    return kPowerManagerSuccess;

}

extern const clock_manager_user_config_t _clock_manager_config_default;

static power_manager_error_code_t exit_vlps(power_manager_notify_struct_t * notify,

                                            power_manager_callback_data_t * dataPtr)

{

    // NOTE: Currently do not have to do anything when exiting VLPS mode.

    return kPowerManagerSuccess;

}

void idle_task(void)

{

    uint32_t callback_data0;

    uint32_t callback_data1;

    power_manager_callback_user_config_t enter_vlps_callback = {enter_vlps,

                                                                kPowerManagerCallbackBefore,

                                                                &callback_data0};

    power_manager_callback_user_config_t exit_vlps_callback = {exit_vlps,

                                                               kPowerManagerCallbackAfter,

                                                               &callback_data1};

    power_manager_callback_user_config_t * power_callbacks[] = {&enter_vlps_callback, &exit_vlps_callback};

    power_manager_user_config_t * power_configs[] = {&_vlps_config};

    // Initialize the Power Manager and reference the mode configuration structures

    POWER_SYS_Init(&power_configs, 1U, &power_callbacks, 2U);

    LPTMR_DRV_Start(0);

    GPIO_DRV_ClearPinOutput(GPIO_1);  // scope ch 1

    _time_delay(1);

    GPIO_DRV_SetPinOutput(GPIO_1);

    _time_delay(1);

    GPIO_DRV_ClearPinOutput(GPIO_1);

    _time_delay(1);

    GPIO_DRV_SetPinOutput(GPIO_1);

    _time_delay(1);

    GPIO_DRV_ClearPinOutput(GPIO_1);

    while (TRUE)

    {

        GPIO_DRV_TogglePinOutput(GPIO_1);

        POWER_SYS_SetMode(0U, kPowerManagerPolicyAgreement);

    }

}

static void lptimer_isr(void)

{

    GPIO_DRV_TogglePinOutput(GPIO_2);   // scope ch 2

    return;

}

Labels (1)
0 Kudos
4 Replies

786 Views
jamesmasamoto
Contributor I

Found the issue. The LP Timer clock source was using the MCGIRCLK which is not available in VLPS. Therefore, the LP Timer interrupt was not occurring and waking up the K24 and the watchdog expires causing reset.

0 Kudos

786 Views
jamesmasamoto
Contributor I

I meant calls to POWER_SYS_SetMode() seems to reset the processor (LP Timer no longer working).

0 Kudos

786 Views
jamesmasamoto
Contributor I

Another thing, it works okay running with debugger.

0 Kudos

786 Views
jeremyzhou
NXP Employee
NXP Employee

Hi James Masamoto,

The KSDK 1.3 has provided the power_manager_rtos_demo for the TWRK24F120M board, I'd highly recommend you to refer to it for details.

You can find the demo in ~\KSDK_1.3.0\examples\twrk24f120m\demo_apps\power_manager_rtos_demo after you install the KSDK 1.3.
Have a great day,
Ping

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

0 Kudos