Merge pull request #73 from cobraPA/upstream_add_heltec_lora_v3

Add heltec lora32 v3
This commit is contained in:
markqvist 2024-04-20 18:57:47 +02:00 committed by GitHub
commit edf6dce388
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 101 additions and 5 deletions

View File

@ -36,6 +36,7 @@
#define BOARD_LORA32_V2_1 0x37
#define BOARD_LORA32_V1_0 0x39
#define BOARD_HELTEC32_V2 0x38
#define BOARD_HELTEC32_V3 0x3A
#define BOARD_RNODE_NG_20 0x40
#define BOARD_RNODE_NG_21 0x41
#define BOARD_RNODE_NG_22 0x42
@ -71,6 +72,7 @@
#define HAS_DISPLAY false
#define HAS_BLUETOOTH false
#define HAS_BLE false
#define HAS_TCXO false
#define HAS_PMU false
#define HAS_NP false
@ -143,6 +145,7 @@
#define HAS_DISPLAY true
#define HAS_PMU true
#define HAS_BLUETOOTH true
#define HAS_BLE true
#define HAS_CONSOLE true
#define HAS_SD false
#define HAS_EEPROM true
@ -178,6 +181,7 @@
#elif BOARD_MODEL == BOARD_LORA32_V1_0
#define HAS_DISPLAY true
#define HAS_BLUETOOTH true
#define HAS_BLE true
#define HAS_CONSOLE true
#define HAS_EEPROM true
const int pin_cs = 18;
@ -194,6 +198,7 @@
#elif BOARD_MODEL == BOARD_LORA32_V2_0
#define HAS_DISPLAY true
#define HAS_BLUETOOTH true
#define HAS_BLE true
#define HAS_CONSOLE true
#define HAS_EEPROM true
const int pin_cs = 18;
@ -210,6 +215,7 @@
#elif BOARD_MODEL == BOARD_LORA32_V2_1
#define HAS_DISPLAY true
#define HAS_BLUETOOTH true
#define HAS_BLE true
#define HAS_PMU true
#define HAS_CONSOLE true
#define HAS_EEPROM true
@ -243,6 +249,42 @@
const int pin_led_tx = 25;
#endif
#elif BOARD_MODEL == BOARD_HELTEC32_V3
#define IS_ESP32S3 true
#define HAS_DISPLAY true
//ESP32-S3 no bluetooth classic
#define HAS_BLUETOOTH false
// TODO BLE
#define HAS_BLE false
// Cannot run wifi and BLE at same time?
#define HAS_CONSOLE false
#define HAS_EEPROM true
// Only one LED on pin 35
#if defined(EXTERNAL_LEDS)
const int pin_led_rx = 35;
const int pin_led_tx = 2;
#else
const int pin_led_rx = 2;
const int pin_led_tx = 2;
#endif
#define MODEM SX1262
#define HAS_TCXO true
const int pin_tcxo_enable = -1;
#define HAS_BUSY true
#define DIO2_AS_RF_SWITCH true
// following pins are for the sx1262
const int pin_cs = 8;
const int pin_busy = 13;
const int pin_dio = 14;
const int pin_reset = 12;
const int pin_mosi = 10;
const int pin_miso = 11;
const int pin_sclk = 9;
#elif BOARD_MODEL == BOARD_RNODE_NG_20
#define HAS_DISPLAY true
#define HAS_BLUETOOTH true

View File

@ -32,6 +32,11 @@
#define DISP_ADDR 0x3C
#define SCL_OLED 15
#define SDA_OLED 4
#elif BOARD_MODEL == BOARD_HELTEC32_V3
#define DISP_RST 21
#define DISP_ADDR 0x3C
#define SCL_OLED 18
#define SDA_OLED 17
#elif BOARD_MODEL == BOARD_RNODE_NG_21
#define DISP_RST -1
#define DISP_ADDR 0x3C
@ -108,6 +113,18 @@ bool display_init() {
Wire.begin(SDA_OLED, SCL_OLED);
#elif BOARD_MODEL == BOARD_HELTEC32_V2
Wire.begin(SDA_OLED, SCL_OLED);
#elif BOARD_MODEL == BOARD_HELTEC32_V3
// enable vext / pin 36
pinMode(Vext, OUTPUT);
digitalWrite(Vext, LOW);
delay(50);
int pin_display_en = 21;
pinMode(pin_display_en, OUTPUT);
digitalWrite(pin_display_en, LOW);
delay(50);
digitalWrite(pin_display_en, HIGH);
delay(50);
Wire.begin(SDA_OLED, SCL_OLED);
#elif BOARD_MODEL == BOARD_LORA32_V1_0
int pin_display_en = 16;
digitalWrite(pin_display_en, LOW);
@ -149,6 +166,12 @@ bool display_init() {
#elif BOARD_MODEL == BOARD_HELTEC32_V2
disp_mode = DISP_MODE_PORTRAIT;
display.setRotation(1);
#elif BOARD_MODEL == BOARD_HELTEC32_V3
disp_mode = DISP_MODE_PORTRAIT;
// Antenna conx up
//display.setRotation(1);
// USB-C up
display.setRotation(3);
#else
disp_mode = DISP_MODE_PORTRAIT;
display.setRotation(3);

View File

@ -93,6 +93,9 @@ firmware-heltec32_v2:
firmware-heltec32_v2_extled:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\" \"-DEXTERNAL_LEDS=true\""
firmware-heltec32_v3:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V3 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3A\""
firmware-rnode_ng_20:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x40\""
@ -149,6 +152,13 @@ upload-heltec32_v2:
@sleep 3
python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
upload-heltec32_v3:
arduino-cli upload -p COM3 --fqbn esp32:esp32:heltec_wifi_lora_32_V3
@sleep 1
rnodeconf COM3 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.heltec_wifi_lora_32_V3/RNode_Firmware.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --chip esp32-s3 --port COM3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
upload-rnode_ng_20:
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:ttgo-lora32
@sleep 1

View File

@ -1111,7 +1111,15 @@ void validate_status() {
if (device_init()) {
hw_ready = true;
} else {
hw_ready = false;
#if !HAS_BLUETOOTH && !HAS_BLE
// Without bluetooth, bt_ready and device_init_done
// are not set
// and neither is hw_ready (see device_init())
hw_ready = true;
device_init_done = true;
#else
hw_ready = false;
#endif
}
#else
hw_ready = true;

3
ROM.h
View File

@ -25,6 +25,7 @@
#define PRODUCT_T32_20 0xB0
#define PRODUCT_T32_21 0xB1
#define PRODUCT_H32_V2 0xC0
#define PRODUCT_H32_V3 0xC1
#define MODEL_A1 0xA1
#define MODEL_A6 0xA6
#define MODEL_A4 0xA4
@ -41,6 +42,8 @@
#define MODEL_BB 0xBB
#define MODEL_C4 0xC4
#define MODEL_C9 0xC9
#define MODEL_C5 0xC5
#define MODEL_CA 0xCA
#define MODEL_E4 0xE4
#define MODEL_E9 0xE9
#define MODEL_E3 0xE3

View File

@ -60,7 +60,10 @@ sx128x *LoRa = &sx128x_modem;
#include "Device.h"
#endif
#if MCU_VARIANT == MCU_ESP32
#if BOARD_MODEL != BOARD_RNODE_NG_22
#if BOARD_MODEL == BOARD_HELTEC32_V3
//https://github.com/espressif/esp-idf/issues/8855
#include "hal/wdt_hal.h"
#elif BOARD_MODEL != BOARD_RNODE_NG_22
#include "soc/rtc_wdt.h"
#endif
#define ISR_VECT IRAM_ATTR
@ -192,6 +195,11 @@ uint8_t boot_vector = 0x00;
void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
#endif
#elif BOARD_MODEL == BOARD_HELTEC32_V3
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
#elif BOARD_MODEL == BOARD_LORA32_V2_1
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
@ -1273,7 +1281,7 @@ bool eeprom_product_valid() {
#if PLATFORM == PLATFORM_AVR
if (rval == PRODUCT_RNODE || rval == PRODUCT_HMBRW) {
#elif PLATFORM == PLATFORM_ESP32
if (rval == PRODUCT_RNODE || rval == BOARD_RNODE_NG_20 || rval == BOARD_RNODE_NG_21 || rval == PRODUCT_HMBRW || rval == PRODUCT_TBEAM || rval == PRODUCT_T32_10 || rval == PRODUCT_T32_20 || rval == PRODUCT_T32_21 || rval == PRODUCT_H32_V2) {
if (rval == PRODUCT_RNODE || rval == BOARD_RNODE_NG_20 || rval == BOARD_RNODE_NG_21 || rval == PRODUCT_HMBRW || rval == PRODUCT_TBEAM || rval == PRODUCT_T32_10 || rval == PRODUCT_T32_20 || rval == PRODUCT_T32_21 || rval == PRODUCT_H32_V2 || rval == PRODUCT_H32_V3) {
#elif PLATFORM == PLATFORM_NRF52
if (rval == PRODUCT_HMBRW) {
#else
@ -1311,6 +1319,8 @@ bool eeprom_model_valid() {
if (model == MODEL_B4 || model == MODEL_B9) {
#elif BOARD_MODEL == BOARD_HELTEC32_V2
if (model == MODEL_C4 || model == MODEL_C9) {
#elif BOARD_MODEL == BOARD_HELTEC32_V3
if (model == MODEL_C5 || model == MODEL_CA) {
#elif BOARD_MODEL == BOARD_RAK4630
if (model == MODEL_FF) {
#elif BOARD_MODEL == BOARD_HUZZAH32

View File

@ -127,7 +127,7 @@ bool sx126x::preInit() {
pinMode(_ss, OUTPUT);
digitalWrite(_ss, HIGH);
#if BOARD_MODEL == BOARD_RNODE_NG_22
#if BOARD_MODEL == BOARD_RNODE_NG_22 || BOARD_MODEL == BOARD_HELTEC32_V3
SPI.begin(pin_sclk, pin_miso, pin_mosi, pin_cs);
#else
SPI.begin();
@ -717,7 +717,7 @@ void sx126x::sleep()
void sx126x::enableTCXO() {
#if HAS_TCXO
#if BOARD_MODEL == BOARD_RAK4630
#if BOARD_MODEL == BOARD_RAK4630 || BOARD_MODEL == BOARD_HELTEC32_V3
uint8_t buf[4] = {MODE_TCXO_3_3V_6X, 0x00, 0x00, 0xFF};
#elif BOARD_MODEL == BOARD_TBEAM
uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF};