No longer able to flash code onto Heltec Lora V3

Hi everybody!

Up to some days ago I could compile my application to a Heltec Lora V3 without any hustle.
Maybe there went something wrong when I updated Arduino-IDE but now I am no longer able to compile code on a MacBookPro (M1).
For any strange reason the compile gets stuck at the sx126x-Code, even if I’m not using any LoRa-Code.
The same errors occur when I try to flash the factory test at /Users/foobarbaz/Documents/Arduino/libraries/Heltec_ESP32_Dev-Boards/examples/Factory_Test/WiFi_LoRa_32_V3/WiFi_LoRa_32_V3_FactoryTest_V2/WiFi_LoRa_32_V3_FactoryTest_V2.ino – same errors.
I un- and re-installed the complete Arduino-IDE and removed all caches without any improvements so far.

Can anybody give me a hint to solve this problem?

Thanks in advance,
cheers!

This is the error message of the compiler:

<snip/>
function 'lora_printf'; did you mean 'log_printf'? [-Wimplicit-function-declaration]
   82 |                 lora_printf("spi timeout\r\n");
      |                 ^~~~~~~~~~~
      |                 log_printf
/Users/foobarbaz/Library/Arduino15/packages/esp32/tools/esp-x32/2411/bin/xtensa-esp32s3-elf-gcc -MMD -c @/Users/foobarbaz/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32s3/flags/c_flags -w -Os -Werror=return-type -DF_CPU=240000000L -DARDUINO=10607 -DARDUINO_HELTEC_WIFI_LORA_32_V3 -DARDUINO_ARCH_ESP32 "-DARDUINO_BOARD=\"HELTEC_WIFI_LORA_32_V3\"" "-DARDUINO_VARIANT=\"heltec_wifi_lora_32_V3\"" -DARDUINO_PARTITION_default_8MB "-DARDUINO_HOST_OS=\"macosx\"" "-DARDUINO_FQBN=\"esp32:esp32:heltec_wifi_lora_32_V3:UploadSpeed=921600,CPUFreq=240,DebugLevel=none,LoopCore=1,EventsCore=1,EraseFlash=none,LORAWAN_REGION=0,LoRaWanDebugLevel=0,LORAWAN_DEVEUI=0,LORAWAN_PREAMBLE_LENGTH=0,SLOW_CLK_TPYE=0\"" -DESP32=ESP32 -DCORE_DEBUG_LEVEL=0 -DARDUINO_RUNNING_CORE=1 -DARDUINO_EVENT_RUNNING_CORE=1 -DREGION_EU868 -DMCU_ESP32_S3 -DHELTEC_BOARD=30 -DWIFI_LORA_32_V3 -DSLOW_CLK_TPYE=0 -DRADIO_CHIP_SX1262 -DLoRaWAN_DEBUG_LEVEL=0 -DACTIVE_REGION=LORAMAC_REGION_EU868 -DLORAWAN_PREAMBLE_LENGTH=8 -DLORAWAN_DEVEUI_AUTO=0 -DHELTEC_WIFI_LORA_32_V3 -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0 @/Users/foobarbaz/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32s3/flags/defines -I/private/var/folders/km/9lvmgx894j95ghm7y3k472k80000gn/T/.arduinoIDE-unsaved2025313-25524-192nm2i.ddy7/LoRaWanOLED -iprefix /Users/foobarbaz/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32s3/include/ @/Users/foobarbaz/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32s3/flags/includes -I/Users/foobarbaz/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32s3/qio_qspi/include -I/Users/foobarbaz/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/cores/esp32 -I/Users/foobarbaz/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/variants/heltec_wifi_lora_32_V3 -I/Users/foobarbaz/Documents/Arduino/libraries/Heltec_ESP32_Dev-Boards/src -I/Users/foobarbaz/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/libraries/SPI/src -I/Users/foobarbaz/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/libraries/Wire/src -I/Users/foobarbaz/Documents/Arduino/libraries/Adafruit_GFX_Library -I/Users/foobarbaz/Documents/Arduino/libraries/Adafruit_BusIO @/Users/foobarbaz/Library/Caches/arduino/sketches/DB5B2160247048661902C6BAFCB5E365/build_opt.h @/Users/foobarbaz/Library/Caches/arduino/sketches/DB5B2160247048661902C6BAFCB5E365/file_opts /Users/foobarbaz/Documents/Arduino/libraries/Heltec_ESP32_Dev-Boards/src/loramac/LoRaMacClassB.c -o /Users/foobarbaz/Library/Caches/arduino/sketches/DB5B2160247048661902C6BAFCB5E365/libraries/Heltec_ESP32_Dev-Boards/loramac/LoRaMacClassB.c.o
/Users/foobarbaz/Documents/Arduino/libraries/Heltec_ESP32_Dev-Boards/src/driver/sx126x.c: In function 'sx126xSleep':
/Users/foobarbaz/Documents/Arduino/libraries/Heltec_ESP32_Dev-Boards/src/driver/sx126x.c:247:5: error: implicit declaration of function 'delay'; did you mean 'Delay'? [-Wimplicit-function-declaration]
  247 |     delay( 2 );
      |     ^~~~~
      |     Delay
/Users/foobarbaz/Documents/Arduino/libraries/Heltec_ESP32_Dev-Boards/src/driver/sx126x.c: In function 'SX126xGetPacketStatus':
/Users/foobarbaz/Documents/Arduino/libraries/Heltec_ESP32_Dev-Boards/src/driver/sx126x.c:731:13: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
  731 |             memset( pktStatus, 0, sizeof( PacketStatus_t ) );
      |             ^~~~~~
/Users/foobarbaz/Documents/Arduino/libraries/Heltec_ESP32_Dev-Boards/src/driver/sx126x.c:9:1: note: 'memset' is defined in header '<string.h>'; this is probably fixable by adding '#include <string.h>'
    8 | #include "esp_sleep.h"
  +++ |+#include <string.h>
    9 | /*!
Using library Heltec ESP32 Dev-Boards at version 2.1.2 in folder: /Users/foobarbaz/Documents/Arduino/libraries/Heltec_ESP32_Dev-Boards 
Using library SPI at version 3.2.0 in folder: /Users/foobarbaz/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/libraries/SPI 
Using library Wire at version 3.2.0 in folder: /Users/foobarbaz/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/libraries/Wire 
Using library Adafruit GFX Library at version 1.12.0 in folder: /Users/foobarbaz/Documents/Arduino/libraries/Adafruit_GFX_Library 
Using library Adafruit BusIO at version 1.17.0 in folder: /Users/foobarbaz/Documents/Arduino/libraries/Adafruit_BusIO 
exit status 1

Compilation error: exit status 1

Can you clarify, is this a compile problem (per post) or a download problem (per title).

It would be useful to know which versions of Arduino IDE you were on and are now trying.

And if you go back to the previous version, if it resolves the problem,

Oh, and if you have the latest Heltec_ESP32 library or reinstalled that or tried a previous version?

Hi nmcc (name preferred),

thanks for your response.
It seems to be a compiler problem. You are correct, upload does not match the exact problem.

I am using the Arduino-IDE 2.3.6 on a MacBookPro (Sequioa 15.4). FWIW I updated the Xcode-tools (xcode-select --install) but I am not sure if that does matter at all.

My configuration for the boards is

http://arduino.esp8266.com/stable/package_esp8266com_index.json
https://resource.heltec.cn/download/package_heltec_esp32_index.json

But there are so many different URL in the wild that I am not sure what should work and what does not.

All Heltec ESP32-dev-boards library version >= 2.0.1 throw above stated compile errors. Even the factory-test is unable to compile.
If I go back to version 1.1.5 my code compiles, but there a some issues regarding the OLED-display (using oled/SSD1306Wire.h instead of HT_SSD1306Wire.h) and LoRa (heltec.begin(...) initializes the display correctly but fails to start LoRa).
At least I was able to upload and execute the SSD1306UiDemo from the example sketches.

I can compile my ESPnow sender/receiver pair (proof-of-concept) with no issues.

So all in all the library seem to be messed up and I have no clue what caused the break.

It would help me to know

  • what the correct URL for the Heltec boards is (I am using Heltec LoRa V2 and V3); development/working was fine about 14 days ago
  • a well tested and working “hello-world” sketch that uses the display and LoRa

Thanks again for your support,
cheers

Click on nmcc, reveal profile …

Not at all related to anything Arduino, so no worries there.

Whilst there are some foibles in the fine details of Heltec documentation that trip people up more often than some other vendors, mostly the links provided on the product page, either directly to the repros with instructions, or the docs with instructions do the job. These are the ones I use. But I haven’t tried them on my Mac M1 using Arduino IDE as I tend to using PlatformIO. I can take that for a quick spin later on today.

That is feasible, but for the LoRa side, what are your immediate aspirations - point to point or LoRaWAN?

Hi Nick,
thanks for your response.

I would prefer to go with platformio but I have already talked to someone on the platformio-forum and he recommended using Arduino IDE because there were some issues with the libraries for ARM Macs with the heltec libraries (forum-entry).

Regarding the links I tried some of them (some leading to 404, some did not improve the situation).

The main reason for using the Heltec Boards in the first place was the ease of use and first LoRa-tests were promising. The Arduino-IDE was not my first choice (would prefer platformio) but it used to kinda work. But that it broke my code is really confusing (despite knowing the exact reason for this).

Also the espressif compiler has some quirks (ie. bool foo() { } does not warn about a missing return value und produces a crash-dump when calling foo()), but I think this is independent from whether using Arduino-IDE or platformio so I have to live with it.

The use case for all this is an environmental sensor network using ESPnow for dumb out-of-the-box chips (have 8266 laying around) but also to be able to use plain LoRa (not LoRaWan) to overcome longer distances.

To sum it up:

  • I would prefer a working platformio solution (on an M1-Mac)
  • Arduino-IDE was OK until it broke
  • I will use the tools that work
  • I cannot compile my application as before (sx126x.c does not work)
  • I could patch the files on my own to find the missing linker information but that would possible break at the next update of the libraries
  • I want to concentrate on my project and not on the tools

Thanks for your support and any spoilers in the right direction.
Cheers,
neurosportsfreund

Good news, you are not alone.

Bad news, I tried the Heltec ESP32 BSP + factory sketch and it won’t compile on macOS M1, macOS Intel or Windows 10 using latest Arduino IDE.

I use the standard ESP32 package on PlatformIO to good effect. If I want LoRa/LoRaWAN, I use RadioLib. I think this answers points 3 and 6.

I have had the same problem. But you can fix it by editing 3 files locally (e.g. with notepad++)

\Heltec_ESP32_Dev-Boards\src\driver

  1. sx126x.c -> add under the #include block this 2 lines:
    #include “Arduino.h”
    #include <string.h>

  2. sx126x-board.h here you need to change type from bool to void:
    bool BoardDisableIrq( void ); > void BoardDisableIrq( void );

  3. sx1262-board.c -> add after #include block this line:
    extern void lora_printf(const char *format, …);

When I did not forget one point, with this modifications I could compile the FactoryTestE290 :slight_smile:
Greetings - Andreas

in this folder, I have no /driver folder. So I am unable to figure out what files need modification. I get a simular compile error with the example code:

c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx1262-board.c: In function ‘SX126xWaitOnBusy’:
c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx1262-board.c:82:17: error: implicit declaration of function ‘lora_printf’; did you mean ‘log_printf’? [-Wimplicit-function-declaration]
82 | lora_printf(“spi timeout\r\n”);
| ^~~~~~~~~~~
| log_printf
c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx126x.c: In function ‘sx126xSleep’:
c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx126x.c:247:5: error: implicit declaration of function ‘delay’; did you mean ‘Delay’? [-Wimplicit-function-declaration]
247 | delay( 2 );
| ^~~~~
| Delay
c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx126x.c: In function ‘SX126xGetPacketStatus’:
c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx126x.c:731:13: error: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
731 | memset( pktStatus, 0, sizeof( PacketStatus_t ) );
| ^~~~~~
c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx126x.c:9:1: note: ‘memset’ is defined in header ‘<string.h>’; this is probably fixable by adding ‘#include <string.h>’
8 | #include “esp_sleep.h”
+++ |+#include <string.h>
9 | /*!
exit status 1

Compilation error: exit status 1

Perhapps someone could offer a stable solution?

It’s there!

as an example!

Copy-Past path into Windows File Explorer…

I opened some pull requests - maybe they fix it and offer a working update…

thank you.

I opened the suggested files to make edits to sx126x.c, sx126x-board.h and sx1262-board.c. Perhaps the repo has been updated because I found this;

  1. sx126x.c : does not have those header files listed (include “Arduino.h” and include <string.h>)

  2. sx126x-board.h : I am able to have the BaordDisableIrq return void

  3. sx1262-board.c : “extern void lora_printf(const char *format, …);” is not in the file, so nothing to block.

The only change I made was to the signature of BoardDisableIrq. On saving that change, there was no change in the error when I attempt to compile.

Peter

Here is the error after the signature change:

Library Heltec ESP32 Dev-Boards has been declared precompiled:
Using precompiled library in c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\esp32s3
c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx126x.c: In function ‘sx126xSleep’:
c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx126x.c:247:5: error: implicit declaration of function ‘delay’; did you mean ‘Delay’? [-Wimplicit-function-declaration]
247 | delay( 2 );
| ^~~~~
| Delay
c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx126x.c: In function ‘SX126xGetPacketStatus’:
c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx126x.c:731:13: error: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
731 | memset( pktStatus, 0, sizeof( PacketStatus_t ) );
| ^~~~~~
c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx126x.c:9:1: note: ‘memset’ is defined in header ‘<string.h>’; this is probably fixable by adding ‘#include <string.h>’
8 | #include “esp_sleep.h”
+++ |+#include <string.h>
9 | /*!
c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx1262-board.c: In function ‘SX126xWaitOnBusy’:
c:\Users\pkose\Documents\SquareLine\template_project\SquareLine_Project1\libraries\Heltec_ESP32_Dev-Boards\src\driver\sx1262-board.c:82:17: error: implicit declaration of function ‘lora_printf’; did you mean ‘log_printf’? [-Wimplicit-function-declaration]
82 | lora_printf(“spi timeout\r\n”);
| ^~~~~~~~~~~
| log_printf
exit status 1

Compilation error: exit status 1

My apologies, I read your instructions more carefully. I need to add those items to the files.

I note that if you copy these instructions, special characters are inserted (the <"> around “Arduino.h” are copied as curly quotes ( “ ” , Unicode U+201C/U+201D), and the <…> is copied as a Unicode ellipsis ( U+2026 ). Both of these cause errors.

After I fix those, I am left with this complie error:

Library Heltec ESP32 Dev-Boards has been declared precompiled:
Using precompiled library in c:\Users\pkose\Heltec_Lora\libraries\Heltec_ESP32_Dev-Boards\src\esp32s3
c:\Users\pkose\Heltec_Lora\libraries\Heltec_ESP32_Dev-Boards\src\radio\radio.c: In function ‘RadioIsChannelFree’:
c:\Users\pkose\Heltec_Lora\libraries\Heltec_ESP32_Dev-Boards\src\radio\radio.c:572:5: error: implicit declaration of function ‘delay’ [-Wimplicit-function-declaration]
572 | delay( 1 );
| ^~~~~
exit status 1

Compilation error: exit status 1

Thank you for your help

1 Like

Hello aboh24 - Was faced with the same issue as OP. I followed your suggestions which eliminated the erors presented by OP…but introduced the new one below. Thoughts on how to fix this one?

c:\Users\nsche\Documents\Arduino\libraries\Heltec_ESP32_Dev-Boards\src\radio\radio.c: In function ‘RadioIsChannelFree’:
c:\Users\nsche\Documents\Arduino\libraries\Heltec_ESP32_Dev-Boards\src\radio\radio.c:572:5: error: implicit declaration of function ‘delay’ [-Wimplicit-function-declaration]
572 | delay( 1 );
| ^~~~~
Multiple libraries were found for “WiFi.h”
Used: C:\Users\nsche\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\WiFi
Not used: C:\Users\nsche\Documents\Arduino\libraries\WiFiNINA
exit status 1

Compilation error: exit status 1

I found the issue and fixed as follows:

In radio.c file, under the #include block, add the line:
#include “Arduino.h”

After making this change, I’m able to compile successfully. I added a pull request to the github site.

Thanks for the bread crumbs to follow.

2 Likes