Skip to content

Commit 12792fd

Browse files
committed
[NANO130] Fix CLK_Idle incorrectly enters into deep sleep mode
This can happen with CLK_PowerDown() called first and then CLK_Idle() called.
1 parent 3f86142 commit 12792fd

File tree

1 file changed

+6
-1
lines changed
  • targets/TARGET_NUVOTON/TARGET_NANO100/device/StdDriver

1 file changed

+6
-1
lines changed

targets/TARGET_NUVOTON/TARGET_NANO100/device/StdDriver/nano100_clk.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ void CLK_EnableCKO(uint32_t u32ClkSrc, uint32_t u32ClkDiv)
7070
*/
7171
void CLK_PowerDown(void)
7272
{
73-
SCB->SCR = SCB_SCR_SLEEPDEEP_Msk;
73+
/* Set the processor uses deep sleep as its low power mode */
74+
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
75+
7476
CLK->PWRCTL |= (CLK_PWRCTL_PD_EN_Msk | CLK_PWRCTL_WK_DLY_Msk );
7577
__WFI();
7678
}
@@ -81,6 +83,9 @@ void CLK_PowerDown(void)
8183
*/
8284
void CLK_Idle(void)
8385
{
86+
/* Set the processor uses sleep as its low power mode */
87+
SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
88+
8489
CLK->PWRCTL &= ~(CLK_PWRCTL_PD_EN_Msk );
8590
__WFI();
8691
}

0 commit comments

Comments
 (0)