Hi
I’m currently using the Adafruit M0 Feather with the inbuilt RFM95 Radio.
I am trying to keep the power as low as possible but I think my draw is quite a bit higher than should be expected. Basically, I am putting the SAMD21 chip into deep sleep and putting the LoRa to sleep but getting around 0.75milliamps consumption.
I think I should be getting about a tenth of this consumption but perhaps I am mistaken.
I am using the following code:
#include <LoRa.h>
// PINS //
#define CS_M0 8
#define RST_M0 4
#define INT_M0 3
const int FREQ = 915E6;
void setupRadio()
{
LoRa.setPins( CS_M0, RST_M0, INT_M0);
while (!LoRa.begin(FREQ)) {
}
}
// the below is widely used to put SAMD21 chips to sleep
void mySleep()
{
bool restoreUSBDevice = false;
if (SERIAL_PORT_USBVIRTUAL) {
USBDevice.standby();
} else {
USBDevice.detach();
restoreUSBDevice = true;
}
// Disable systick interrupt: See https://www.avrfreaks.net/forum/samd21-samd21e16b-sporadically-locks-and-does-not-wake-standby-sleep-mode
SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
__DSB();
__WFI();
// Enable systick interrupt
SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;
if (restoreUSBDevice) {
USBDevice.attach();
}
}
void setup() {
setupRadio();
delay(3000);
LoRa.sleep(); // put the radio to sleep = 14ma
delay(3000);
mySleep(); // put the cpu to sleep = 0.75ma
}
void loop() {
// put your main code here, to run repeatedly:
}
Any tips much appreciated.
Thanks