Hi,
The Digital Agriculture team at the NSW Department of Primary Industries has made our changes to MCCI LMIC to support standby mode on an AdaFruit M0 LoRaWAN Feather available at DPIclimate/arduino-lmic.
The changes are on the branch standby_enabled
, so we can track the master branch without conflicts.
In short:
-
The 32.768 KHz external oscillator provides the source of LMICs ticks. This is also used by the RTCZero library so it is probably already enabled and configured to run during standby, given most people use that library to go to standby mode.
-
The oscillator is run through GCLK #5 and TCC 4/5. GCLK #5 was chosen because #4 is used by the SDI-12 library. TCC 4/5 should be free. There are no pre-scalers because the oscillator is the required frequency.
-
Aside from the new
os
function (below), the modifications are contained within two timekeeping functions of thehal
layer,hal_time_init()
andhal_ticks()
. -
The function
ostime_t os_getNextDeadline(bit_t *valid);
has been added to find when the next LMIC-managed task is scheduled to run. This allows a sketch to decide whether it is worth going to standby more or not. -
An example has been added.
The modifications don’t allow for all times you could sleep, such as in the 5 second RX delay, but they do allow standby mode to be used between uplinks. The intention was to provide relatively simple & isolated modifications to the library so upstream modifications can be easily merged in until the MCCI version of the library gets a rework in these areas.
Regards, David.