TX delay after SetTxData


I’m using Lmic library and after I got message “Packet queued” on serial monitor (after calling setTxData2), it takes almost 20 seconds to start transmission. Does any of you know why this is happening and how to reduce that time?

That is not happening when I use original example code (with TX_INTERVAL). It happens when I’m using LowPower function where I’m sending microcontroler to sleep, and after some time it should turn on and send message. Packet queued is done imidiatelly, and after that it takes almost 20 seconds to finish transmission.

Thanks :smiley:

You need to add debug output to the code to figure out what is happening.

One thing that may happen is you may not be incrementing the clock to account for the time asleep, so if the LMiC scheduler has planned things in advance (on general principles or actual duty cycle limitation) that time may still be as far in advance on wakeup as it was when you went to sleep.

Also if you are using OTAA and doing a new join, that may take longer each time until you “walk” to a join nonce that has not been previously used. While if you are using ABP you might not get any traffic through until you catch up with the frame counter last used on the previous run.

You are right, problem was with clock! When in sleep, Arduino doesn’t count clock, so after waking up it should be added sleep time to clock so it can calculate duty cycle correctly.
Here is solution https://github.com/matthijskooijman/arduino-lmic/issues/109.

Thank you for ideas :smiley: