Hi,
I'm using the Adafruit Feather M0 Radio with LoRa Radio Module (Adafruit Feather M0 with RFM95 LoRa Radio - 900MHz [RadioFruit] : ID 3178 : $34.95 : Adafruit Industries, Unique & fun DIY electronics and kits)
Q1: I put SAMD21 into the deepsleep mode, and I also put some pins of RF95 (like MISO, MOSI, SCK) to LOW. Besides, I make all board pin to OUTPUT, LOW to reduce some unnecessary current cost.
According to the datasheet, this board can use about 300 μA during the full sleep. But what I achieve is about 1.13mA. What part do I miss on the board that causes some extra current?
SCB->SCR |= 1<<2; // Enable deep sleep feature
while (1) {
__WFI(); // Execute WFI and enter sleep
};
Q2: And I use RTC MODE0 to wake up the SAMD21 every second. However, during the test, the board go to sleep first, and then wake up, and then go to sleep, and never wake up. I think may be there is some wrong in the loop and handler?
void loop()
{
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
while (1) {
__WFI(); // Execute WFI and enter sleep
};
}
void RTC_Handler(){
if (RTC->MODE0.INTFLAG.bit.CMP0 && RTC->MODE0.INTENSET.bit.CMP0) { // A compare caused the interrupt
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0; // reset interrupt flag
}
}
Thank you!
Regards,
Chen