i.MXRT117x suspend wakeup from specific interrupts

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

i.MXRT117x suspend wakeup from specific interrupts

340 Views
alonbl
Contributor III

Hello,

I am trying to put the i.MXRT 117x into sleep and wakeup from specific source. I could not find any good reference of best practices, I collected the implementation from various source.

I came up with the following, however, it wakes up also for these that I setup to ignore.

static
void
_enter_low_powerdown(void) {
GPC_CM_SetNextCpuMode(GPC_CPU_MODE_CTRL_0, kGPC_StopMode);
GPC_CM_EnableIrqWakeup(GPC_CPU_MODE_CTRL_0, GPIO13_GPIO_COMB_0_15_IRQN, true);
GPC_CM_EnableIrqWakeup(GPC_CPU_MODE_CTRL_0, GPIO3_GPIO_COMB_0_15_IRQN, false);
GPC_CM_EnableIrqWakeup(GPC_CPU_MODE_CTRL_0, GPT3_GPT_IRQN, false);

PRINTF("SUSPEND\r\n");
DbgConsole_EnterLowpower();

SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;

__disable_irq();

__WFI();

__enable_irq();

DbgConsole_ExitLowpower();
PRINTF("WAKEUP\r\n");

BOARD_InitPins();
}

 Does anybody know how to setup the sleep so that it will only wakeup from the sources listed? I would like to avoid setting up and re-resetting the devices.

Thanks,

Tags (3)
0 Kudos
Reply
2 Replies

312 Views
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @alonbl ,

 

You can try the project power_mode_switch_bm_dcdc in SDK. The Power mode switch demo application demonstrates the usage of power modes. 

Cpu mode switch:
Press A to enter cpu mode RUN
Press B to enter cpu mode WAIT
Press C to enter cpu mode STOP
Press D to enter cpu mode SUSPEND
Press E to enter cpu mode WAIT, system standby
Press F to enter cpu mode STOP, system standby
Press G to enter cpu mode SUSPEND, system standby
Press 'Q' to exit

Waiting for select...

When 'C' is selected, the menu shows wake up source selection for SNVS mode.

Select the wake up source:
Press T for Timer
Press S for switch/button SW7.

This part of the implementation in the demo should help you.

 

Best regards,

Gavin

0 Kudos
Reply

294 Views
alonbl
Contributor III

Hello @Gavin_Jia,

Thank you for the reference. The example is fairly complex. I tried to shrink it and found that the missing bit was probably GPC_CM_RequestStandbyMode(), I hope I did not dropped any important functionality, this seems to work and is minimal,  I will appreciate feedback.

Thanks,

 

AT_QUICKACCESS_SECTION_CODE(static void _enter_low_powerdown(bool halt));
static
void
_enter_low_powerdown() {
GPC_CM_SetNextCpuMode(GPC_CPU_MODE_CTRL_0, kGPC_StopMode);
GPC_CM_EnableCpuSleepHold(GPC_CPU_MODE_CTRL_0, true);
GPC_CPU_MODE_CTRL_0->CM_NON_IRQ_WAKEUP_MASK |=
GPC_CPU_MODE_CTRL_CM_NON_IRQ_WAKEUP_MASK_EVENT_WAKEUP_MASK_MASK |
GPC_CPU_MODE_CTRL_CM_NON_IRQ_WAKEUP_MASK_DEBUG_WAKEUP_MASK_MASK; /* Mask debugger wakeup */
GPC_CM_RequestStandbyMode(GPC_CPU_MODE_CTRL_0, kGPC_StopMode);

PRINTF("SUSPEND\r\n");
DbgConsole_EnterLowpower();

uint32_t saved_mask = DisableGlobalIRQ();
__DSB();
__ISB();

SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;

__WFI();

EnableGlobalIRQ(saved_mask);
__DSB();
__ISB();

DbgConsole_ExitLowpower();
PRINTF("WAKEUP\r\n");

BOARD_InitPins();
}

 

0 Kudos
Reply