I'm trying (without success) to add section 4.4 (Low-Power Listening) to the DWM Arduino library to save battery energy at times the TAG is not used. The idea is that both the host CPU and DWM1000 is set to sleep mode, and the DWM1000 will continue to receive packets at configured time intervals. If a packet is received, the DWM1000 can trigger the IRQ pin, and the host CPU will wake up from sleep mode.
What could be wrong with this code, the datasheet looks too simple ;) The IRQ pin is not triggered when a packet arrives.
For the host Arduino CPU I'm using this code in my Arduino loop (I double-checked it is actually working by triggering the IRQ pin manually):
void loop(){
if (DW1000Ranging.getNetworkDevicesNumber() == 0){
// no packets, let go DWM1000 and host CPU into sleep mode
DW1000.enterLowPowerListening();
delay(1000);
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_mode(); // will enter sleep mode (requires pin interrupt to wake up again)
//--- this is called on wakeup (rising IRQ by DWM1000) ---
sleep_disable();
power_all_enable();
Serial.println("wakeup");
DW1000.leaveLowPowerListening();
}
I'm trying (without success) to add section 4.4 (Low-Power Listening) to the DWM Arduino library to save battery energy at times the TAG is not used. The idea is that both the host CPU and DWM1000 is set to sleep mode, and the DWM1000 will continue to receive packets at configured time intervals. If a packet is received, the DWM1000 can trigger the IRQ pin, and the host CPU will wake up from sleep mode.
What could be wrong with this code, the datasheet looks too simple ;) The IRQ pin is not triggered when a packet arrives.
For the host Arduino CPU I'm using this code in my Arduino loop (I double-checked it is actually working by triggering the IRQ pin manually):