Open predictitai opened 23 hours ago
radio.transmit()
indeed does not work here - none of the (LoRaWAN) examples even mention this. node.sendReceive()
is the way to go. But then I don't see your function loopThatAlsoNotWorks()
being called, so it looks like your code doesn't even attempt this. Can you share what happens when you use this function instead?
Thank you for your quick response! Just to be sure I will send you the complete log; joinrequest and joinaccept i see in the log. But no uplink message. When i use my frequency analyzer i notice that the message actually been send by the device. I get "No downlink received", which probably makes sense as the message has not been received by Helium IOT. Hope you can advice me!
Initialise the radio
RLB_DBG: RadioLib Info Version: "7.1.0.0" Platform: "ESP32" Compiled: "Oct 31 2024" "13:29:29"
RLB_DBG: Found SX126x: RADIOLIB_SX126X_REG_VERSION_STRING:
RLB_DBG: 00000320: 53 58 31 32 36 31 20 56 32 44 20 32 44 30 32 00 SX1261 V2D 2D02.
RLB_DBG:
RLB_DBG: M SX126x Join ('login') the LoRaWAN Network
RLB_PRO: Setting up dynamic channels
RLB_PRO: UL: 0 1 868.100 (0 - 5) | DL: 0 1 868.100 (0 - 5)
RLB_PRO: UL: 1 1 868.300 (0 - 5) | DL: 1 1 868.300 (0 - 5)
RLB_PRO: UL: 2 1 868.500 (0 - 5) | DL: 2 1 868.500 (0 - 5)
RLB_PRO: [MAC] 0x03
RLB_PRO: 00000000: 20
RLB_PRO: LinkAdrReq: dataRate = 2, txSteps = 0, nbTrans = 0
RLB_PRO: LinkAdrAns: 07
RLB_PRO: [MAC] 0x04
RLB_PRO: 00000000: 07 .
RLB_PRO: DutyCycleReq: max duty cycle = 1/2^7
RLB_PRO: [MAC] 0x05
RLB_PRO: 00000000: 00 d2 ad 84 ....
RLB_PRO: RXParamSetupReq: Rx1DrOffset = 0, rx2DataRate = 0, freq = 869.525
RLB_PRO: [MAC] 0x08
RLB_PRO: 00000000: 01 .
RLB_PRO: RXTimingSetupReq: delay = 1 sec
RLB_PRO: [MAC] 0x09
RLB_PRO: 00000000: 05 .
RLB_PRO: [MAC] 0x0c
RLB_PRO: 00000000: 65 e
RLB_PRO: ADRParamSetupReq: limitExp = 6, delayExp = 5
RLB_PRO: [MAC] 0x0f
RLB_PRO: 00000000: fa .
RLB_PRO: RejoinParamSetupReq: maxTime = 15, maxCount = 10
RLB_PRO:
RLB_PRO: PHY: Frequency = 868.100 MHz, TX = 16 dBm
RLB_PRO: LoRa: SF = 10, BW = 125.0 kHz, CR = 4/5, IQ: U
RLB_DBG: Timeout in 1853 ms
RLB_PRO: JoinRequest sent (DevNonce = 17386) <-- Rx Delay start
RLB_PRO: 00000000: 00 64 bf 97 76 8d 2a 9b b0 e7 16 5d a4 c2 ba e7 .d..v.*....]....
RLB_PRO: 00000010: ba ea 43 44 51 a8 e3 ..CDQ..
RLB_PRO:
RLB_PRO: PHY: Frequency = 868.100 MHz, TX = 16 dBm
RLB_PRO: LoRa: SF = 10, BW = 125.0 kHz, CR = 4/5, IQ: D
RLB_PRO: Opening Rx1 window (331 ms timeout)... <-- Rx Delay end
RLB_PRO: Closing Rx1 window
RLB_PRO: JoinAccept (JoinNonce = 50, previously 0):
RLB_PRO: 00000000: 20 32 00 00 24 00 00 1d 08 00 48 80 01 18 4f 84 2..$.....H...O.
RLB_PRO: 00000010: e8 56 84 b8 5e 84 88 66 84 58 6e 84 00 b5 21 2a .V..^..f.Xn...!*
RLB_PRO: 00000020: bb .
RLB_PRO: LoRaWAN revision: 1.1
RLB_PRO: Setting up dynamic channels
RLB_PRO: UL: 0 1 868.100 (0 - 5) | DL: 0 1 868.100 (0 - 5)
RLB_PRO: UL: 1 1 868.300 (0 - 5) | DL: 1 1 868.300 (0 - 5)
RLB_PRO: UL: 2 1 868.500 (0 - 5) | DL: 2 1 868.500 (0 - 5)
RLB_PRO: [MAC] 0x05
RLB_PRO: 00000000: 00 d2 ad 84 ....
RLB_PRO: RXParamSetupReq: Rx1DrOffset = 0, rx2DataRate = 0, freq = 869.525
RLB_PRO: [MAC] 0x08
RLB_PRO: 00000000: 01 .
RLB_PRO: RXTimingSetupReq: delay = 1 sec
RLB_PRO: Processing CFList
RLB_PRO: [MAC] 0x07
RLB_PRO: 00000000: 03 18 4f 84 50 ..O.P
RLB_PRO: UL: 3 1 867.100 (0 - 5) | DL: 3 1 867.100 (0 - 5)
RLB_PRO: [MAC] 0x07
RLB_PRO: 00000000: 04 e8 56 84 50 ..V.P
RLB_PRO: UL: 4 1 867.300 (0 - 5) | DL: 4 1 867.300 (0 - 5)
RLB_PRO: [MAC] 0x07
RLB_PRO: 00000000: 05 b8 5e 84 50 ..^.P
RLB_PRO: UL: 5 1 867.500 (0 - 5) | DL: 5 1 867.500 (0 - 5)
RLB_PRO: [MAC] 0x07
RLB_PRO: 00000000: 06 88 66 84 50 ..f.P
RLB_PRO: UL: 6 1 867.700 (0 - 5) | DL: 6 1 867.700 (0 - 5)
RLB_PRO: [MAC] 0x07
RLB_PRO: 00000000: 07 58 6e 84 50 .Xn.P
RLB_PRO: UL: 7 1 867.900 (0 - 5) | DL: 7 1 867.900 (0 - 5)
Connected to the network!
Sending uplink
RLB_PRO: Uplink MAC payload:
RLB_PRO: 00000000: 0b 01 ..
RLB_PRO: Uplink (FCntUp = 0) decoded:
RLB_PRO: 00000000: 1d 08 e5 00 00 78 56 ad 4c c3 ce 3f 17 00 00 00 .....xV.L..?....
RLB_PRO: 00000010: 40 1d 08 00 48 82 00 00 3b ff 01 35 22 55 56 ad @...H...;..5"UV.
RLB_PRO: 00000020: 4c c3 L.
RLB_PRO:
RLB_PRO: PHY: Frequency = 867.100 MHz, TX = 16 dBm
RLB_PRO: LoRa: SF = 10, BW = 125.0 kHz, CR = 4/5, IQ: U
RLB_DBG: Timeout in 1648 ms
RLB_PRO: Uplink sent <-- Rx Delay start
RLB_PRO:
RLB_PRO: PHY: Frequency = 867.100 MHz, TX = 16 dBm
RLB_PRO: LoRa: SF = 10, BW = 125.0 kHz, CR = 4/5, IQ: D
RLB_PRO: Opening Rx1 window (331 ms timeout)... <-- Rx Delay end
RLB_PRO: Closing Rx1 window
RLB_PRO:
RLB_PRO: PHY: Frequency = 869.525 MHz, TX = 16 dBm
RLB_PRO: LoRa: SF = 12, BW = 125.0 kHz, CR = 4/5, IQ: D
RLB_PRO: Opening Rx2 window (788 ms timeout)... <-- Rx Delay end
RLB_PRO: Closing Rx2 window
No downlink received
Next uplink in 300 seconds
Further packets i see the FCntUp increasing; but in the console the number of uplinks remains 0:
Sending uplink
RLB_PRO: Uplink (FCntUp = 1) decoded:
RLB_PRO: 00000000: 1d 08 e5 00 00 78 56 ad 4c c3 ce 3f 17 00 00 00 .....xV.L..?....
RLB_PRO: 00000010: 40 1d 08 00 48 80 01 00 01 53 43 68 21 78 56 ad @...H....SCh!xV.
RLB_PRO: PHY: Frequency = 868.100 MHz, TX = 16 dBm
RLB_PRO: LoRa: SF = 10, BW = 125.0 kHz, CR = 4/5, IQ: U
RLB_DBG: Timeout in 1648 ms
RLB_PRO: Uplink sent <-- Rx Delay start
RLB_PRO: PHY: Frequency = 868.100 MHz, TX = 16 dBm
RLB_PRO: LoRa: SF = 10, BW = 125.0 kHz, CR = 4/5, IQ: D
RLB_PRO: Opening Rx1 window (331 ms timeout)... <-- Rx Delay end
RLB_PRO: Closing Rx1 window
RLB_PRO: PHY: Frequency = 869.525 MHz, TX = 16 dBm
RLB_PRO: LoRa: SF = 12, BW = 125.0 kHz, CR = 4/5, IQ: D
RLB_PRO: Opening Rx2 window (788 ms timeout)... <-- Rx Delay end
RLB_PRO: Closing Rx2 window
No downlink received
Next uplink in 300 seconds
Sending uplink
RLB_PRO: Uplink (FCntUp = 2) decoded:
RLB_PRO: 00000000: 1d 08 e5 00 00 78 56 ad 4c c3 ce 3f 17 00 00 00 .....xV.L..?....
RLB_PRO: 00000010: 40 1d 08 00 48 80 02 00 01 16 36 3d 21 78 56 ad @...H.....6=!xV.
RLB_PRO: PHY: Frequency = 867.300 MHz, TX = 16 dBm
RLB_PRO: LoRa: SF = 10, BW = 125.0 kHz, CR = 4/5, IQ: U
RLB_DBG: Timeout in 1648 ms
RLB_PRO: Uplink sent <-- Rx Delay start
RLB_PRO: PHY: Frequency = 867.300 MHz, TX = 16 dBm
RLB_PRO: LoRa: SF = 10, BW = 125.0 kHz, CR = 4/5, IQ: D
RLB_PRO: Opening Rx1 window (331 ms timeout)... <-- Rx Delay end
RLB_PRO: Closing Rx1 window
RLB_PRO: PHY: Frequency = 869.525 MHz, TX = 16 dBm
RLB_PRO: LoRa: SF = 12, BW = 125.0 kHz, CR = 4/5, IQ: D
RLB_PRO: Opening Rx2 window (788 ms timeout)... <-- Rx Delay end
RLB_PRO: Closing Rx2 window
No downlink received
Next uplink in 300 seconds
Are you in credit - ie you have pre-paid to be able to receive the uplink?
i have 196 data credits but I am not sure whether that is sufficient for uplinks. I wrote an email to Helium IOT about this issue. Thanks and i will keep you informed.
After a JoinRequest and JoinAccept I transmit "hello world". I see that via an rtl sdr that the message has actually been send; however I don't see the uplink message frame in my Helium-IoT Console. Note that transmit and sendReceive function do not result in an uplink frame. scanguard=50 and added enabled debugging; .
Debug mode output
Setup ... Initialise the radio RLB_DBG: RadioLib Info Version: "7.1.0.0" Platform: "ESP32" Compiled: "Oct 31 2024" "13:29:29" RLB_DBG: Found SX126x: RADIOLIB_SX126X_REG_VERSION_STRING: RLB_DBG: 00000320: 53 58 31 32 36 31 20 56 32 44 20 32 44 30 32 00 SX1261 V2D 2D02. RLB_DBG: RLB_DBG: M SX126x Join ('login') the LoRaWAN Network RLB_PRO: Setting up dynamic channels RLB_PRO: UL: 0 1 868.100 (0 - 5) | DL: 0 1 868.100 (0 - 5) RLB_PRO: UL: 1 1 868.300 (0 - 5) | DL: 1 1 868.300 (0 - 5) RLB_PRO: UL: 2 1 868.500 (0 - 5) | DL: 2 1 868.500 (0 - 5) RLB_PRO: [MAC] 0x03 RLB_PRO: 00000000: 20 RLB_PRO: LinkAdrReq: dataRate = 2, txSteps = 0, nbTrans = 0 RLB_PRO: LinkAdrAns: 07 RLB_PRO: [MAC] 0x04 RLB_PRO: 00000000: 07 . RLB_PRO: DutyCycleReq: max duty cycle = 1/2^7 RLB_PRO: [MAC] 0x05 RLB_PRO: 00000000: 00 d2 ad 84 .... RLB_PRO: RXParamSetupReq: Rx1DrOffset = 0, rx2DataRate = 0, freq = 869.525 RLB_PRO: [MAC] 0x08 RLB_PRO: 00000000: 01 . RLB_PRO: RXTimingSetupReq: delay = 1 sec RLB_PRO: [MAC] 0x09 RLB_PRO: 00000000: 05 . RLB_PRO: [MAC] 0x0c RLB_PRO: 00000000: 65 e RLB_PRO: ADRParamSetupReq: limitExp = 6, delayExp = 5 RLB_PRO: [MAC] 0x0f RLB_PRO: 00000000: fa . RLB_PRO: RejoinParamSetupReq: maxTime = 15, maxCount = 10 RLB_PRO: RLB_PRO: PHY: Frequency = 868.100 MHz, TX = 16 dBm RLB_PRO: LoRa: SF = 10, BW = 125.0 kHz, CR = 4/5, IQ: U RLB_DBG: Timeout in 1853 ms RLB_PRO: JoinRequest sent (DevNonce = 39783) <-- Rx Delay start RLB_PRO: 00000000: 00 64 bf 97 76 8d 2a 9b b0 e7 16 5d a4 c2 ba e7 .d..v.*....].... RLB_PRO: 00000010: ba 67 9b ba 8b 29 78 .g...)x RLB_PRO: RLB_PRO: PHY: Frequency = 868.100 MHz, TX = 16 dBm RLB_PRO: LoRa: SF = 10, BW = 125.0 kHz, CR = 4/5, IQ: D RLB_PRO: Opening Rx1 window (331 ms timeout)... <-- Rx Delay end RLB_PRO: Closing Rx1 window RLB_PRO: JoinAccept (JoinNonce = 49, previously 0): RLB_PRO: 00000000: 20 31 00 00 24 00 00 1b 08 00 48 80 01 18 4f 84 1..$.....H...O. RLB_PRO: 00000010: e8 56 84 b8 5e 84 88 66 84 58 6e 84 00 93 84 d2 .V..^..f.Xn..... RLB_PRO: 00000020: 1c . RLB_PRO: LoRaWAN revision: 1.1 RLB_PRO: Setting up dynamic channels RLB_PRO: UL: 0 1 868.100 (0 - 5) | DL: 0 1 868.100 (0 - 5) RLB_PRO: UL: 1 1 868.300 (0 - 5) | DL: 1 1 868.300 (0 - 5) RLB_PRO: UL: 2 1 868.500 (0 - 5) | DL: 2 1 868.500 (0 - 5) RLB_PRO: [MAC] 0x05 RLB_PRO: 00000000: 00 d2 ad 84 .... RLB_PRO: RXParamSetupReq: Rx1DrOffset = 0, rx2DataRate = 0, freq = 869.525 RLB_PRO: [MAC] 0x08 RLB_PRO: 00000000: 01 . RLB_PRO: RXTimingSetupReq: delay = 1 sec RLB_PRO: Processing CFList RLB_PRO: [MAC] 0x07 RLB_PRO: 00000000: 03 18 4f 84 50 ..O.P RLB_PRO: UL: 3 1 867.100 (0 - 5) | DL: 3 1 867.100 (0 - 5) RLB_PRO: [MAC] 0x07 RLB_PRO: 00000000: 04 e8 56 84 50 ..V.P RLB_PRO: UL: 4 1 867.300 (0 - 5) | DL: 4 1 867.300 (0 - 5) RLB_PRO: [MAC] 0x07 RLB_PRO: 00000000: 05 b8 5e 84 50 ..^.P RLB_PRO: UL: 5 1 867.500 (0 - 5) | DL: 5 1 867.500 (0 - 5) RLB_PRO: [MAC] 0x07 RLB_PRO: 00000000: 06 88 66 84 50 ..f.P RLB_PRO: UL: 6 1 867.700 (0 - 5) | DL: 6 1 867.700 (0 - 5) RLB_PRO: [MAC] 0x07 RLB_PRO: 00000000: 07 58 6e 84 50 .Xn.P RLB_PRO: UL: 7 1 867.900 (0 - 5) | DL: 7 1 867.900 (0 - 5) Connected to the network! Sending uplink RLB_DBG: Timeout in 1443 ms Message sent successfully! RLB_DBG: Timeout in 1443 ms Message sent successfully!
To Reproduce I use the T-Deck plus device. I used code from https://github.com/Xinyuan-LilyGO/T-Deck but removed Radiolib completely and replaced it with the latest version https://github.com/jgromes/RadioLib version 7.1.0
Sketch that is causing the module fail
#include "config.h" #define SHORT_ATTEMPT_INTERVAL 60 // Short interval between quick attempts in seconds #define LONG_SLEEP_INTERVAL 300 // Deep sleep interval in seconds after a session of attempts #define MAX_SHORT_ATTEMPTS 3 // Max quick attempts per session void setup() { //! The board peripheral power control pin needs to be set to HIGH when using the peripheral pinMode(BOARD_POWERON, OUTPUT); digitalWrite(BOARD_POWERON, HIGH); //! Set CS on all SPI buses to high level during initialization pinMode(BOARD_SDCARD_CS, OUTPUT); pinMode(RADIO_CS_PIN, OUTPUT); pinMode(BOARD_TFT_CS, OUTPUT); digitalWrite(BOARD_SDCARD_CS, HIGH); digitalWrite(RADIO_CS_PIN, HIGH); digitalWrite(BOARD_TFT_CS, HIGH); pinMode(BOARD_SPI_MISO, INPUT_PULLUP); SPI.begin(BOARD_SPI_SCK, BOARD_SPI_MISO, BOARD_SPI_MOSI); Serial.begin(115200); while (!Serial); delay(5000); // Give time to switch to the serial monitor Serial.println(F("\nSetup ... ")); Serial.println(F("Initialise the radio")); int16_t state = radio.begin(); debug(state != RADIOLIB_ERR_NONE, F("Initialise radio failed"), state, true); // Setup the OTAA session information state = node.beginOTAA(joinEUI, devEUI, nwkKey, appKey); debug(state != RADIOLIB_ERR_NONE, F("Initialise node failed"), state, true); Serial.println(F("Join ('login') the LoRaWAN Network")); while (true) { bool connected = false; // Inner loop: multiple quick attempts within one session for (int attempt = 0; attempt < MAX_SHORT_ATTEMPTS; attempt++) { int connectionStatus = node.activateOTAA(); if (connectionStatus == RADIOLIB_LORAWAN_NEW_SESSION) { Serial.println("Connected to the network!"); connected = true; break; } else { Serial.printf("Quick attempt %d failed. Retrying in %d seconds... Errorcode: %d \n", attempt + 1, SHORT_ATTEMPT_INTERVAL, connectionStatus); delay(SHORT_ATTEMPT_INTERVAL * 1000); // Short wait before next quick attempt } } if (connected) { // Exit setup on success return; } else { // If no connection after all quick attempts, enter long sleep Serial.println("Session failed. Entering deep sleep for a longer interval."); esp_sleep_enable_timer_wakeup(LONG_SLEEP_INTERVAL * 1000000); // Set sleep interval in microseconds esp_deep_sleep_start(); } } Serial.println(F("Ready!\n")); } void loop() { Serial.println(F("Sending uplink")); int state = radio.transmit("hello world!"); if (state == RADIOLIB_ERR_NONE) { Serial.println("Message sent successfully!"); } else { Serial.print("Failed to send message, code: "); Serial.println(state); } delay(uplinkIntervalSeconds * 1000UL); // delay needs milli-seconds } void loopThatAlsoNotWorks() { // This is the place to gather the sensor inputs // Instead of reading any real sensor, we just generate some random numbers as example uint8_t value1 = radio.random(100); uint16_t value2 = radio.random(2000); // Build payload byte array uint8_t uplinkPayload[3]; uplinkPayload[0] = value1; uplinkPayload[1] = highByte(value2); // See notes for high/lowByte functions uplinkPayload[2] = lowByte(value2); // Perform an uplink int16_t state = node.sendReceive(uplinkPayload, sizeof(uplinkPayload)); debug(state < RADIOLIB_ERR_NONE, F("Error in sendReceive"), state, false); // Check if a downlink was received // (state 0 = no downlink, state 1/2 = downlink in window Rx1/Rx2) if (state > 0) { Serial.println(F("Received a downlink")); } else { Serial.println(F("No downlink received")); } Serial.print(F("Next uplink in ")); Serial.print(uplinkIntervalSeconds); Serial.println(F(" seconds\n")); // Wait until next uplink - observing legal & TTN FUP constraints delay(uplinkIntervalSeconds * 1000UL); // delay needs milli-seconds }
Expected behavior I expect an uplink message in Helium-IoT console.
Additional info (please complete):