CubeCell-Arduino icon indicating copy to clipboard operation
CubeCell-Arduino copied to clipboard

txDutyCycleTime/appTxDutyCycle ignored

Open nordblick2 opened this issue 3 years ago • 2 comments

Hey, i have configured my CubeCell device to send some data to TTN. Everything works, but I have problems with TX duty cycle.

I used an appTxDutyCycle of 120000ms (uint32_t appTxDutyCycle = 120000UL;). After every start/boot, the device starts sending with an interval of more or less 7 seconds. I have no idea where it comes from.

To debug it, I printed out txDutyCycleTime right after calling LoRaWAN.cycle(txDutyCycleTime); and see my expected time values (e.g 120123 including some random offset). Calculating the time since last send, it looks different. The device sends with a shorter interval, that I can't explain. Very strange!

I implemented a method for setting appTxDutyCycle remotely via TTN Console. After doing that the same output is printed on console (appTxDutyCycle as expected) but now the device also sends with the specified duty cycle. Until next boot boot. 😵‍💫

case DEVICE_STATE_CYCLE: // Schedule next packet transmission txDutyCycleTime = appTxDutyCycle + randr( 0, APP_TX_DUTYCYCLE_RND ); LoRaWAN.cycle(txDutyCycleTime); printf("=== %dms (%d)\n", millis()-last_millis, txDutyCycleTime); delay(50); deviceState = DEVICE_STATE_SLEEP; break;

Output after booting:

TX on freq 868500000 Hz at DR 5 ===7042ms (120719) TX on freq 868500000 Hz at DR 5 Event : Tx Done RX on freq 868500000 Hz at DR 5 Event : Rx Timeout RX on freq 869525000 Hz at DR 3 Event : Rx Timeout unconfirmed uplink sending ... TX on freq 868100000 Hz at DR 5 ===7042ms (120490) TX on freq 868100000 Hz at DR 5 Event : Tx Done RX on freq 868100000 Hz at DR 5 Event : Rx Timeout RX on freq 869525000 Hz at DR 3 Event : Rx Timeout

Output after re-setting appTxDutyCycle remotely:

received confirmed downlink: rssi = -102, snr = -3, datarate = 5 config.version = 8 config.send.interval = 120

NEW TX RECEIVED: 120000 (120 seconds) Applying config (here I set appTxDutyCycle to 120000) ... unconfirmed uplink sending ... TX on freq 868300000 Hz at DR 5 ===120704ms (120110) TX on freq 868300000 Hz at DR 5

Target value for txDutyCycleTime are fine for both scenario. Does anybody experienced the same problem and give me some hits to solve that?

nordblick2 avatar Sep 21 '22 13:09 nordblick2

This looks very strange to me. Can you provide the full code (e.g. on GitHub Gist)?

ScholliYT avatar Sep 21 '22 15:09 ScholliYT

No problem. I will put the code online later.

nordblick2 avatar Sep 23 '22 20:09 nordblick2