#include "board.h"
int main(void)
{
Board_Init();
// Initialize RTC
Chip_RTC_Init(NSS_RTC);
Chip_RTC_Wakeup_SetControl(NSS_RTC, (RTC_WAKEUPCTRL_T)(RTC_WAKEUPCTRL_ENABLE | RTC_WAKEUPCTRL_AUTO));
Chip_RTC_Int_SetEnabledMask(NSS_RTC, RTC_INT_WAKEUP);
NVIC_EnableIRQ(RTC_IRQn);
Chip_RTC_Wakeup_SetReload(NSS_RTC, 5);
while (1) {
// Toggle led
LED_Toggle(LED_RED);
// Go to sleep
Chip_PMU_PowerMode_EnterSleep();
}
return 0;
}
// RTC interrupt
void RTC_IRQHandler(void)
{
if (Chip_RTC_Int_GetRawStatus(NSS_RTC) & RTC_INT_WAKEUP) {
Chip_RTC_Int_ClearRawStatus(NSS_RTC, RTC_INT_WAKEUP);
}
Chip_RTC_Wakeup_SetReload(NSS_RTC, 5);
}
I've used the firmware documentation to compose this code. Unfortunately, when the LED is off, the NHS3152 still comsumes ~300µA, the same as without sleep mode. What am I missing?