How to adjust or cancel the LMIC libraries duty cycle check?

I have been working on a Seeduino XIAO SAMD21 real easy build LoRa board. It does also work as a TTN node using the MCCI LoRaWAN LMIC Library. I have a simple OTAA sketch working that sends an ASCII payload consisting of the send count. The XIAO is supported by the Arduino lowpower library and putting the device into a timed sleep is easy enough with sleep current as low as 4uA.

The build is easy and the number of parts needed fairly minimal, see below;

min_build_node

You can wire, with the board shown, the LoRa devices DIO0, DIO1, DIO2 to separate IO pins on the XIAO or you can save two IO pins on the XIAO using some diodes to share DIO0, DIO1 and DIO2 onto one IO pin. Not tried the FSK functionality that needs DIO2. Thus the XIAO board working as a TTN node can have 5 spare IO pins that can also be used as I2C and Serial UART ports.

Anyway onto the question;

In sleep mode the internal timers on the XIAO are halted, apart from the RTC one used for the wakeup. Thus when the board wakes up the timings used by the sketch (and library code) probably do not realise the board has been asleep, potentially for days or weeks.

As an example, if the spreading factor is set to SF12 and the TX_INTERVAL is set for 5 seconds and the board put into a many minutes sleep, at wake up the sketch spends around 150 seconds in the powered state, waiting to send the payload, presumably it thinks its only just powered up and is imposing what it thinks is the duty cycle limit. Whilst its waiting to transmit the board uses around 14mA.

No functions in the library or the examples seems to suggest a simple way of stopping the duty cycle check.

So any ideas, how do you make the sketch not apply the duty cycle limit, after all its been asleep for ages, so no real duty cycle limit to apply.

3 Likes

I seem to recall a library function that allows updating the stack with the amount of time the node has slept. Now if only I could remember if that is part of the LMIC stack…

Love the board!

I found this;

Which mentions this feature;

“A new function hal_sleep_lowpower(u1_t sleepval) is introduced to allow the main low-power loop to indicate to the LMIC stack how much sleep time (in seconds) it has to take into account when returning hal_ticks().”

And the OTAA example does appear to include support for the SAMD21G18A, the processor used in the XIAO.

Yes, that is what was rambling around in the back of my mind. Hope it solves your issue.

Thanks for the tip, that library looks like it was specifically designed to deal with deep sleep nodes. And since the XIAO\SAMD21 has an RTC I guess you ought to be able to work out how long its been asleep from a external pin interrupt too. We shall see.

mmm slow progress.

There is a problem with the example sketches in the LMIC_Low_Power library as far as my up to date Arduino IDE is concerned. Within the onEvent () function the large mass of code within the case EV_TXCOMPLETE: section needs to be in code braces. Apparently the complier in my IDE 1.8.13 objects to the variable declarations within the case EV_TXCOMPLETE: section.

With the code braces the code compiles, and when the node runs there is a least a join and one transmission of payload, but as yet no wakeup.

Ah well, fun times, I hope I dont need to take the gateway and node into a deep underground dark railway tunnel to get them to work …