RadioLib: Problems with LoRaWAN using SX1262 on Helium Network
Describe the bug
After successful OTAA, restarting results in the microcontroller producing -12 (Invalid frequency) error codes. After enabling debug mode I can see that it tries to set the frequency to 0MHz [LoRaWAN] Sending uplink packet ... Channel frequency UL = 0.000000 MHz
To Reproduce
#include <RadioLib.h>
SX1262 radio = new Module(2, 5, 22, 4);
LoRaWANNode node(&radio, &EU868);
void setup() {
Serial.begin(115200);
Serial.print(F("[SX1262] Initializing ... "));
int state = radio.begin();
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
}
uint64_t joinEUI = 0x111111111111111;
uint64_t devEUI = 0x111111111111111;
uint8_t nwkKey[] = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11};
uint8_t appKey[] = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11};
Serial.print(F("[LoRaWAN] Attempting over-the-air activation ... "));
state = node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
}
}
void loop() {
Serial.print(F("[LoRaWAN] Sending uplink packet ... "));
int state = node.uplink("test", 10);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
}
while (true);
}
Expected behavior After reboot, the microcontroller should retrieve all of the data from EEPROM and use all of the usable channels, in this case 8 channels, just like on TTN.
Additional info (please complete):
- MCU: ESP32
- Wireless module type: SX1262
- Arduino IDE version: 2.2.1
- Library version: 6.2.0
- EEPROM HEX dump:
22,0,0,0,39,0,0,48,1,0,0,0,1B,10,AD,12,3,15,A0,21,82,82,10,A5,8B,CB,29,33,25,12,3C,90,D4,1F,6E,1,69,A4,74,8E,4F,8D,30,D,71,C7,65,4C,D4,1F,6E,1,69,A4,74,8E,4F,8D,30,D,71,C7,65,4C,D4,1F,6E,1,69,A4,74,8E,4F,8D,30,D,71,C7,65,4C,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FF,FF,FF,FF
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Comments: 16 (2 by maintainers)
I think yes, all of the issues have been resolved by the latest commit. If any other arises, I’ll just open another issue.