AnsweredAssumed Answered

Entering VLPS Causing Processor to Reset

Question asked by James Masamoto on Dec 29, 2015
Latest reply on Dec 30, 2015 by James Masamoto

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;

}

Attachments

Outcomes