Hello everybody,
I have got 2 WiFi LoRa 32 (V2) Notes. I use platform IO (PIO) with Visual Studio Code to program the notes.
Until now I always used the LMIC library for communication with TTN. I wanted to to switch to the ESP_LoRaWAN library of Heltec. The library is available in the library Manager of PIO. Just trying to find how everything works a used one of the provided sample sketches (OTAA).
When compiling it gives several errors, of with some of them I was able to solve
I’m stuck with these last errors. I hope someone can help me solve them.
.pio\build\heltec_wifi_lora_32_V2\lib9b9\libESP32_LoRaWAN.a(rtc-board.S.o): In function
TimerGetTimerValue': D:\61722\Documents\Arduino\hardware\heltec\esp32\libraries\ESP32_LoRaWAN\src/rtc-board.c:120:(.text.TimerGetTimerValue+0x31): dangerous relocation: call8: call target out of range: __udivdi3 .pio\build\heltec_wifi_lora_32_V2\lib9b9\libESP32_LoRaWAN.a(rtc-board.S.o): In function
TimerGetElapsedAlarmTime’:
D:\61722\Documents\Arduino\hardware\heltec\esp32\libraries\ESP32_LoRaWAN\src/rtc-board.c:120:(.text.TimerGetElapsedAlarmTime+0x32): dangerous relocation: call8: call target out of range: __udivdi3
.pio\build\heltec_wifi_lora_32_V2\lib9b9\libESP32_LoRaWAN.a(rtc-board.S.o): In function `TimerComputeElapsedTime’:
D:\61722\Documents\Arduino\hardware\heltec\esp32\libraries\ESP32_LoRaWAN\src/rtc-board.c:134:(.text.TimerComputeElapsedTime+0x32):
dangerous relocation: call8: call target out of range: __udivdi3
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\heltec_wifi_lora_32_V2\firmware.elf] Error 1
Below are the files and modifications I a made to solve other errors.
// I changed the licence key for my own one, not printed here
uint32_t LICENSE[4] = {0xDD251C39,0x44C5F937,0xBB160873,0x072EB7C8};
void setup()
// Add your initialization code here
Serial.begin(115200);
while (!Serial);
SPI.begin(SCK,MISO,MOSI,SS);
Mcu.begin(SS,RST,DIO0,DIO1,LICENSE);
DeviceState = DEVICE_STATE_INIT;
// The loop function is called in an endless loop
void loop()
switch( DeviceState )
case DEVICE_STATE_INIT:
LoRa.DeviceStateInit(
CLASS
); // Added “CLASS” between the brackets
if(IsLoRaMacNetworkJoined==false)
{DeviceState = DEVICE_STATE_JOIN;}
{DeviceState = DEVICE_STATE_SEND;}
break;
case DEVICE_STATE_JOIN:
LoRa.DeviceStateJion();
break;
case DEVICE_STATE_SEND:
lora_printf(“Into send state\n”);
PrepareTxFrame( AppPort );
LoRa.DeviceStateSend();
DeviceState = DEVICE_STATE_CYCLE;
break;
case DEVICE_STATE_CYCLE:
// Schedule next packet transmission
TimerSetValue( &TxNextPacketTimer, TxDutyCycleTime );
TimerStart( &TxNextPacketTimer );
DeviceState = DEVICE_STATE_SLEEP;
break;
case DEVICE_STATE_SLEEP:
//LoRa.DeviceSleep
(IsLowPowerOn,DebugLevel); --> original
LoRa.DeviceSleep(
CLASS
,DebugLevel); // -> modified
That’s a disappointing answer and a bit strange, because the ESP32_LoRawan library is available as one of the standard libraries in PIO. Esp32LorawanSupportPio.JPG1269×593 50.1 KB
Also is the Heltec Wifi Lora 32 (v2) one of the available boards in PIO HeltecWifiLoraV2SupportPio.JPG1304×596 75 KB
Or do I misunderstand you?
Thank you for your response, I will look at is.
For the moment I’ve switched to TTN_esp32 library from manuelbl on Git.
It solved my problems trying to combine otaa activation and the use of deep sleep to save power