Success with platform.io, WIFI_LoRa_32_V3, WiFi_Kit 1.0.0, Radio, pins_arduino.h!

It’s been a bit since I revisited my code (0.0.7) and forgetting pretty much all the earlier struggles and hoops I went through to get it to work, it was helpful to repeat the effort, this time with a little more insight!

Below is my platformio.ini file that works with the latest versions of platform.io and WiFi LoRa 32 V3. Comments are included to explain what and why it’s necessary. This is set for region US915 and my serial port; you should continue using your definitions for these, as well as your additional libraries.

Note this uses the latest code in the WiFi Kit series GitHub repo; it may be best to fix the version at a specific release. I like to live dangerously :slight_smile:

I trust the comments help to explain the why’s; if not, please comment and I can respond.

Good luck!

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:heltec_wifi_lora_32_V3]
platform = espressif32

; The variant defaults to the board name (heltec_wifi_lora_32_V3) and that must exist under the /variants directory
; In this case, it does not, but WIFI_LoRa_32_V3 does so we explicitly set the variant. When specified this way,
; the name is lower-cased and matches with "/variants/wifi_lora_32_v3".
board = heltec_wifi_lora_32_V3
board_build.variant = WIFI_LoRa_32_V3
framework = arduino

; Heltec has taken the standard espressif platform and added specific support for their boards.
; To access this functionality, we need to tell platform.io to use that code instead. Note this points to the
; latest code on the master branch, and this may not be in a "release" or even "release-ready" state.
platform_packages = platformio/framework-arduinoespressif32@https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series

monitor_speed = 115200
upload_speed = 921600
; If necessary, change the port to match your setup
upload_port = /dev/cu.usbserial-0001
monitor_port = /dev/cu.usbserial-0001

monitor_filters =
	esp32_exception_decoder
	time
	colorize

; Add your libraries below
lib_deps =

; Recently the "WIFI_LoRa_32_V3" define has been *capitalized* and for the linker to pull in the reference to
; "Radio" it needs to be defined on the compile command line.
; This is most likely due to not having the define set prior to compiling radio.c, which is wrapped in an #ifdef.
; If not set to true, then warnings are generated that it is redefined and it does not successfully build.
; The no-narrowing warning is disabled as it generates a bunch of noise.
; And the boards.txt extra_libs setting for this board explicitly states to link in "heltec_0" instead of heltec.
; The other defines are well-known.
build_flags =
	-D WIFI_LORA_32_V3=true
	-D REGION_US915
	-D ACTIVE_REGION=LORAMAC_REGION_US915
	-D LORAWAN_PREAMBLE_LENGTH=8
	-D LoRaWAN_DEBUG_LEVEL=3
	-D CORE_DEBUG_LEVEL=0
	-D LORAWAN_DEVEUI_AUTO=1
	-Wno-narrowing
	-lheltec_0
2 Likes

Perfect, for a long time I couldn’t get the new framework for V3 boards to work in platformIO.
Only your guidance helped me. Thanks! :heart: