Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update heltec wifi v3 pin definitions #7877

Merged
merged 1 commit into from
Apr 4, 2023
Merged

Update heltec wifi v3 pin definitions #7877

merged 1 commit into from
Apr 4, 2023

Conversation

platypii
Copy link
Contributor

Description of Change

This PR corrects the definitions for: WIFI_LoRa_32_V3, and WIFI_Kit_32_V3 boards.

Without macros defined like DISPLAY_HEIGHT, DISPLAY_WIDTH, and DIO0, some features on the Heltec V3 boards won't initialize properly. This also makes these heltec boards more consistent with earlier board versions definitions.

Tests scenarios

Tested on the actual boards. These changes are necessary to make the display work.

Related links

Follow on to #7846 after further testing.

Thanks!!

@BrentonPoke
Copy link

Is there a configuration you used in platformio.ini to test this? I'd like to replicate with my board.

@platypii
Copy link
Contributor Author

Is there a configuration you used in platformio.ini to test this? I'd like to replicate with my board.

Yes @BrentonPoke:

[env:heltec_wifi_lora_32_V3]
platform = https://github.com/Baptou88/platform-espressif32.git
board = heltec_wifi_lora_32_V3
framework = arduino
platform_packages = framework-arduinoespressif32 @ https://github.com/platypii/arduino-esp32.git
lib_deps = https://github.com/platypii/Heltec_ESP32.git

platform contains the updated board definitions from @Baptou88.
platform_packages contains these updated pin definitions.
lib_deps contains the updated heltec helper library.

There are PRs pending for each of them [1] [2] [3]

@BrentonPoke
Copy link

BrentonPoke commented Feb 25, 2023

I've gotten as far as here with those settings. I'm not sure where these are supposed to be defined, since it doesn't look like it's in the corresponding heltec.h. The code i'm compiling I know works on the V2 boards I've been using, so I know it's not anything in there.

[env:heltec_wifi_lora_32_V3]
platform = https://github.com/Baptou88/platform-espressif32.git
board = heltec_wifi_lora_32_V3
framework = arduino
platform_packages = framework-arduinoespressif32 @ https://github.com/platypii/arduino-esp32.git
monitor_speed = 115200
monitor_filters = time
upload_port = COM13
lib_deps =
	Update
	ArduinoOTA
	https://github.com/platypii/Heltec_ESP32.git
	contrem/arduino-timer @ ^2.3.0
	knolleary/PubSubClient@^2.8
	paulstoffregen/Time@^1.6.1
	tobiasschuerg/ESP8266 Influxdb@^3.13.0
	https://github.com/me-no-dev/ESPAsyncWebServer.git
	https://github.com/BrentonPoke/ClusterDuck-Protocol.git#corruption-tracking
*** [.pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o] Error 1
Compiling .pio\build\heltec_wifi_lora_32_V3\lib431\PubSubClient\PubSubClient.cpp.o
.pio/libdeps/heltec_wifi_lora_32_V3/Heltec ESP32 Dev-Boards/src/heltec.cpp: In member function 'void Heltec_ESP32::begin
(bool, bool, bool, bool, long int)':
.pio/libdeps/heltec_wifi_lora_32_V3/Heltec ESP32 Dev-Boards/src/heltec.cpp:73:19: error: 'RST_LoRa' was not declared in
this scope
   LoRa.setPins(SS,RST_LoRa,DIO0);
                   ^~~~~~~~
.pio/libdeps/heltec_wifi_lora_32_V3/Heltec ESP32 Dev-Boards/src/heltec.cpp:73:19: note: suggested alternative: 'LoRa'
   LoRa.setPins(SS,RST_LoRa,DIO0);
                   ^~~~~~~~
                   LoRa
.pio/libdeps/heltec_wifi_lora_32_V3/Heltec ESP32 Dev-Boards/src/heltec.cpp:73:28: error: 'DIO0' was not declared in this
 scope
   LoRa.setPins(SS,RST_LoRa,DIO0);
                            ^~~~
.pio/libdeps/heltec_wifi_lora_32_V3/Heltec ESP32 Dev-Boards/src/heltec.cpp:73:28: note: suggested alternative: 'BIT0'
   LoRa.setPins(SS,RST_LoRa,DIO0);
                            ^~~~
                            BIT0
*** [.pio\build\heltec_wifi_lora_32_V3\lib573\Heltec ESP32 Dev-Boards\heltec.cpp.o] Error 1

============================================== [FAILED] Took 9.49 seconds ==============================================

Environment             Status    Duration
----------------------  --------  ------------
heltec_wifi_lora_32_V3  FAILED    00:00:09.494
======================================== 1 failed, 0 succeeded in 00:00:09.494 ========================================

@platypii
Copy link
Contributor Author

@BrentonPoke that's exactly why this PR is adding definitions for RST_LoRa, BUSY_LoRa, and DIO0.
The definitions should exist in https://github.com/platypii/arduino-esp32.git

Maybe try clearing out your platformio caches and rebuild?

rm -rf .pio/libdeps/
rm -rf ~/.platformio/packages/framework-arduinoespressif32*

@BrentonPoke
Copy link

BrentonPoke commented Feb 25, 2023

@BrentonPoke that's exactly why this PR is adding definitions for RST_LoRa, BUSY_LoRa, and DIO0. The definitions should exist in https://github.com/platypii/arduino-esp32.git

Maybe try clearing out your platformio caches and rebuild?

rm -rf .pio/libdeps/
rm -rf ~/.platformio/packages/framework-arduinoespressif32*

Your suggestion to clear out the packages cache seems to have worked, though I'm not sure what it didn't do right the first time I called them down. I'm failing on getting the LoRa functionality running, but that error seems to be coming from inside our code.. Seems like things are good as far as flashing, so if you're ever in town, I do the bulk of the research for the ClusterDuck Protocol, all based in LoRa communication. We need to add support for this board since V2 is probably not going to be manufactured anymore, so if you get a minute to help out, we'd greatly appreciate it.

@platypii
Copy link
Contributor Author

The V3 boards changed the LoRa chip used. The V2 used SX1276, while the V3 switched to SX1262 radio.
You will need to use different code to initialize and use the new chip. The heltec library will need to be updated too, but you can initialize it yourself in the mean time. Example

@P-R-O-C-H-Y P-R-O-C-H-Y added Status: Pending Merge Pull Request is ready to be merged and removed Status: Review needed Issue or PR is awaiting review labels Apr 3, 2023
@me-no-dev me-no-dev merged commit c9b2351 into espressif:master Apr 4, 2023
@platypii platypii deleted the heltec-v3-updates branch April 4, 2023 22:34
@BrentonPoke
Copy link

What exactly were the LoRa pins on the SX1262? I'm trying to set them and am not getting any LoRa activity with them currently set to

LORA_CS 8
LORA_DIO0 14
LORA_DIO1 -1 //unused
LORA_RST 12

Are these the right pins? I'm taking them from the current Pins_arduino.h

@platypii
Copy link
Contributor Author

Your pins look right. On the Heltec LoRa V3 board I use the RadioLib library and initialize with:

SX1262 radio = new Module(SS, DIO0, RST_LoRa, BUSY_LoRa);

Which is equivalent to:

SX1262 radio = new Module(8, 14, 12, 13);

@BrentonPoke
Copy link

Your pins look right. On the Heltec LoRa V3 board I use the RadioLib library and initialize with:

SX1262 radio = new Module(SS, DIO0, RST_LoRa, BUSY_LoRa);

Which is equivalent to:

SX1262 radio = new Module(8, 14, 12, 13);

Ok, I'm doing this, but for some reason it's just not working. Our intended API is just a wrapper around RadioLib like this
duck.setupRadio(LORA_FREQ, LORA_CS_PIN, RADIO_RST_PIN);
But for whatever reason, the board is completely silent and doesn't receive anything from my other boards. The SPI just needs to be started before the LoRa radio module, right? I don't have any of these problems with the Lilygo boards but something always seems to be wrong with the heltec boards. These are my definitions and this is the implementation with the pertinent parts between lines 15 and 67. For what it's worth, the OLED is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Merge Pull Request is ready to be merged Type: 3rd party Boards
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants