睡之前开lle的gpio中断:
*((volatile uint32_t *)0x40110050) = *((volatile uint32_t *)0x40110050) | (0x01 << 14);
睡醒之后清除lle的gpio中断:
*((volatile uint32_t *)0x4011005C) = (0x01 << 14);
lle active模式需要开个广播让lle工作。
使用osc,pll和时钟配置:
#define PLL_EN 1
#define PLL_LOOP 15
#define HCLK_DIV SYSCTRL_CLK_PLL_DIV_3
#define FLASH_DIV SYSCTRL_CLK_PLL_DIV_1
#define TIME_REDUCTION 4500
#define LL_DELAY 1300
#define LATENCY_PRE 10
开gpio、pinctrl时钟
SYSCTRL_ClearClkGateMulti((1 << SYSCTRL_ClkGate_APB_GPIO0) | (1 << SYSCTRL_ClkGate_APB_PinCtrl));
配置gpio唤醒:
#define TEST_WAKEUP_GPIO_I GIO_GPIO_5
#define TEST_WAKEUP_GPIO_PULL PINCTRL_PULL_UP
#define TEST_WAKEUP_GPIO_MODE GIO_WAKEUP_MODE_LOW_LEVEL
PINCTRL_SetPadMux(TEST_WAKEUP_GPIO_I, IO_SOURCE_GPIO);
PINCTRL_Pull(TEST_WAKEUP_GPIO_I, TEST_WAKEUP_GPIO_PULL);
GIO_SetDirection(TEST_WAKEUP_GPIO_I, GIO_DIR_INPUT);
GIO_ConfigIntSource(TEST_WAKEUP_GPIO_I, GIO_INT_EN_LOGIC_HIGH_OR_RISING_EDGE, GIO_INT_EDGE);
GIO_EnableDeepSleepWakeupSource(TEST_WAKEUP_GPIO_I, 1, TEST_WAKEUP_GPIO_MODE, TEST_WAKEUP_GPIO_PULL);
GIO_EnableRetentionGroupA(1);
SYSCTRL_EnableWakeupSourceDetection();
平均电流1.89mA
平均电流1.35mA
平均电流1.08mA
平均电流0.86mA
平均电流0.82mA
只说和以上不同的地方
使用rc给pll提供时钟:
SYSCTRL_EnableSlowRC(1, SYSCTRL_SLOW_RC_24M);
SYSCTRL_AutoTuneSlowRC();
SYSCTRL_SelectSlowClk(SYSCTRL_SLOW_RC_CLK);
pmu不下电:
void PowerSeqInit_PMUOpen(void)
{
#ifndef use_le_active
set_reg_bits((volatile uint32_t *)0x40100020, 0x1, 5, 3);
set_reg_bit((volatile uint32_t *)0x40102018, 0x1, 30);
set_reg_bits((volatile uint32_t *)0x40102010, 0x1, 8, 18);
set_reg_bits((volatile uint32_t *)0x40102018, 0x0, 4, 20);
set_reg_bits((volatile uint32_t *)0x40102018, 0x0, 4, 16);
set_reg_bits((volatile uint32_t *)0x40102018, 0x0, 16, 0);
set_reg_bits((volatile uint32_t *)0x40100024, 0x1, 3, 19);
set_reg_bits((volatile uint32_t *)0x40100024, 0x2, 5, 8);
#ifdef use_osc
set_reg_bits((volatile uint32_t *)0x40102018, 0x19, 6, 24);
#else
set_reg_bits((volatile uint32_t *)0x40102018, 0x1, 6, 24);
#endif
set_reg_bit((volatile uint32_t *)0x40100010, 0x1, 1);
set_reg_bit((volatile uint32_t *)0x40100010, 0x1, 0);
set_reg_bit((volatile uint32_t *)0x40100010, 0x1, 5);
set_reg_bit((volatile uint32_t *)0x40100010, 0x1, 3);
set_reg_bit((volatile uint32_t *)0x40100010, 0x1, 4);
set_reg_bit((volatile uint32_t *)0x40100010, 0x1, 6);
#endif
return;
}
中断响应不过来
平均电流1.45mA
平均电流0.82mA
平均电流0.33mA
平均电流0.22mA