Added T-Deck support
This commit is contained in:
parent
bb38290120
commit
8bdd85e648
50
Boards.h
50
Boards.h
|
@ -37,6 +37,7 @@
|
|||
#define BOARD_LORA32_V1_0 0x39
|
||||
#define BOARD_HELTEC32_V2 0x38
|
||||
#define BOARD_HELTEC32_V3 0x3A
|
||||
#define BOARD_TDECK 0x3B
|
||||
#define BOARD_RNODE_NG_20 0x40
|
||||
#define BOARD_RNODE_NG_21 0x41
|
||||
#define BOARD_RNODE_NG_22 0x42
|
||||
|
@ -387,6 +388,55 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#elif BOARD_MODEL == BOARD_TDECK
|
||||
#define IS_ESP32S3 true
|
||||
#define MODEM SX1262
|
||||
#define DIO2_AS_RF_SWITCH true
|
||||
#define HAS_BUSY true
|
||||
#define HAS_TCXO true
|
||||
|
||||
#define HAS_DISPLAY false
|
||||
#define HAS_CONSOLE false
|
||||
#define HAS_BLUETOOTH false
|
||||
#define HAS_BLE true
|
||||
#define HAS_PMU true
|
||||
#define HAS_NP false
|
||||
#define HAS_SD false
|
||||
#define HAS_EEPROM true
|
||||
|
||||
#define HAS_INPUT true
|
||||
#define HAS_SLEEP true
|
||||
#define PIN_WAKEUP GPIO_NUM_0
|
||||
#define WAKEUP_LEVEL 0
|
||||
|
||||
const int pin_poweron = 10;
|
||||
const int pin_btn_usr1 = 0;
|
||||
|
||||
const int pin_cs = 9;
|
||||
const int pin_reset = 17;
|
||||
const int pin_sclk = 40;
|
||||
const int pin_mosi = 41;
|
||||
const int pin_miso = 38;
|
||||
const int pin_tcxo_enable = -1;
|
||||
const int pin_dio = 45;
|
||||
const int pin_busy = 13;
|
||||
|
||||
const int SD_MISO = 38;
|
||||
const int SD_MOSI = 41;
|
||||
const int SD_CLK = 40;
|
||||
const int SD_CS = 39;
|
||||
const int DISPLAY_CS = 12;
|
||||
|
||||
#if HAS_NP == false
|
||||
#if defined(EXTERNAL_LEDS)
|
||||
const int pin_led_rx = 43;
|
||||
const int pin_led_tx = 43;
|
||||
#else
|
||||
const int pin_led_rx = 43;
|
||||
const int pin_led_tx = 43;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error An unsupported ESP32 board was selected. Cannot compile RNode firmware.
|
||||
#endif
|
||||
|
|
10
Makefile
10
Makefile
|
@ -76,6 +76,9 @@ firmware-tbeam_sx126x: check_bt_buffers
|
|||
firmware-t3s3:
|
||||
arduino-cli compile --log --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\""
|
||||
|
||||
firmware-tdeck:
|
||||
arduino-cli compile --log --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3B\""
|
||||
|
||||
firmware-lora32_v10: check_bt_buffers
|
||||
arduino-cli compile --log --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=0x39\""
|
||||
|
||||
|
@ -166,6 +169,13 @@ upload-heltec32_v3:
|
|||
@sleep 3
|
||||
python ./Release/esptool/esptool.py --chip esp32-s3 --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-tdeck:
|
||||
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:esp32s3
|
||||
@sleep 1
|
||||
rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32s3/RNode_Firmware.ino.bin)
|
||||
@sleep 3
|
||||
python ./Release/esptool/esptool.py --chip esp32-s3 --port /dev/ttyACM0 --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
|
||||
|
|
20
Power.h
20
Power.h
|
@ -43,6 +43,22 @@
|
|||
bool bat_voltage_dropping = false;
|
||||
float bat_delay_v = 0;
|
||||
float bat_state_change_v = 0;
|
||||
#elif BOARD_MODEL == BOARD_TDECK
|
||||
#define BAT_V_MIN 3.15
|
||||
#define BAT_V_MAX 4.3
|
||||
#define BAT_V_CHG 4.48
|
||||
#define BAT_V_FLOAT 4.33
|
||||
#define BAT_SAMPLES 5
|
||||
const uint8_t pin_vbat = 4;
|
||||
float bat_p_samples[BAT_SAMPLES];
|
||||
float bat_v_samples[BAT_SAMPLES];
|
||||
uint8_t bat_samples_count = 0;
|
||||
int bat_discharging_samples = 0;
|
||||
int bat_charging_samples = 0;
|
||||
int bat_charged_samples = 0;
|
||||
bool bat_voltage_dropping = false;
|
||||
float bat_delay_v = 0;
|
||||
float bat_state_change_v = 0;
|
||||
#elif BOARD_MODEL == BOARD_HELTEC32_V3
|
||||
#define BAT_V_MIN 3.15
|
||||
#define BAT_V_MAX 4.3
|
||||
|
@ -70,7 +86,7 @@ uint8_t pmu_rc = 0;
|
|||
void kiss_indicate_battery();
|
||||
|
||||
void measure_battery() {
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_21 || BOARD_MODEL == BOARD_LORA32_V2_1 || BOARD_MODEL == BOARD_HELTEC32_V3
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_21 || BOARD_MODEL == BOARD_LORA32_V2_1 || BOARD_MODEL == BOARD_HELTEC32_V3 || BOARD_MODEL == BOARD_TDECK
|
||||
battery_installed = true;
|
||||
battery_indeterminate = true;
|
||||
|
||||
|
@ -249,7 +265,7 @@ void update_pmu() {
|
|||
}
|
||||
|
||||
bool init_pmu() {
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_21 || BOARD_MODEL == BOARD_LORA32_V2_1
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_21 || BOARD_MODEL == BOARD_LORA32_V2_1 || BOARD_MODEL == BOARD_TDECK
|
||||
pinMode(pin_vbat, INPUT);
|
||||
return true;
|
||||
#elif BOARD_MODEL == BOARD_HELTEC32_V3
|
||||
|
|
|
@ -52,6 +52,16 @@ void setup() {
|
|||
boot_seq();
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
Serial.setRxBufferSize(CONFIG_UART_BUFFER_SIZE);
|
||||
|
||||
#if BOARD_MODEL == BOARD_TDECK
|
||||
pinMode(pin_poweron, OUTPUT);
|
||||
digitalWrite(pin_poweron, HIGH);
|
||||
|
||||
pinMode(SD_CS, OUTPUT);
|
||||
pinMode(DISPLAY_CS, OUTPUT);
|
||||
digitalWrite(SD_CS, HIGH);
|
||||
digitalWrite(DISPLAY_CS, HIGH);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MCU_VARIANT == MCU_NRF52
|
||||
|
@ -1178,7 +1188,7 @@ void validate_status() {
|
|||
#endif
|
||||
} else {
|
||||
hw_ready = false;
|
||||
Serial.write("No valid radio module found\r\n");
|
||||
Serial.write("No radio module found\r\n");
|
||||
#if HAS_DISPLAY
|
||||
if (disp_ready) {
|
||||
device_init_done = true;
|
||||
|
@ -1203,6 +1213,7 @@ void validate_status() {
|
|||
}
|
||||
} else {
|
||||
hw_ready = false;
|
||||
// Serial.write("Invalid EEPROM configuration\r\n");
|
||||
#if HAS_DISPLAY
|
||||
if (disp_ready) {
|
||||
device_init_done = true;
|
||||
|
@ -1212,6 +1223,7 @@ void validate_status() {
|
|||
}
|
||||
} else {
|
||||
hw_ready = false;
|
||||
// Serial.write("Device unprovisioned, no device configuration found in EEPROM\r\n");
|
||||
#if HAS_DISPLAY
|
||||
if (disp_ready) {
|
||||
device_init_done = true;
|
||||
|
|
89
ROM.h
89
ROM.h
|
@ -18,41 +18,60 @@
|
|||
|
||||
#define CHECKSUMMED_SIZE 0x0B
|
||||
|
||||
#define PRODUCT_RNODE 0x03
|
||||
#define PRODUCT_HMBRW 0xF0
|
||||
#define PRODUCT_TBEAM 0xE0
|
||||
#define PRODUCT_T32_10 0xB2
|
||||
#define PRODUCT_T32_20 0xB0
|
||||
#define PRODUCT_T32_21 0xB1
|
||||
#define PRODUCT_H32_V2 0xC0
|
||||
#define PRODUCT_H32_V3 0xC1
|
||||
#define PRODUCT_RAK4631 0x10
|
||||
#define MODEL_11 0x11
|
||||
#define MODEL_12 0x12
|
||||
#define MODEL_A1 0xA1
|
||||
#define MODEL_A6 0xA6
|
||||
#define MODEL_A4 0xA4
|
||||
#define MODEL_A9 0xA9
|
||||
#define MODEL_A3 0xA3
|
||||
#define MODEL_A8 0xA8
|
||||
#define MODEL_A2 0xA2
|
||||
#define MODEL_A7 0xA7
|
||||
#define MODEL_B3 0xB3
|
||||
#define MODEL_B8 0xB8
|
||||
#define MODEL_B4 0xB4
|
||||
#define MODEL_B9 0xB9
|
||||
#define MODEL_BA 0xBA
|
||||
#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
|
||||
#define MODEL_E8 0xE8
|
||||
#define MODEL_FE 0xFE
|
||||
#define MODEL_FF 0xFF
|
||||
#define PRODUCT_RNODE 0x03 // Board code 0x31
|
||||
#define MODEL_A4 0xA4 // RNode v1.0, 433 MHz
|
||||
#define MODEL_A9 0xA9 // RNode v1.0, 868 MHz
|
||||
|
||||
// Board code 0x40
|
||||
#define MODEL_A3 0xA3 // RNode v2.0, 433 MHz
|
||||
#define MODEL_A8 0xA8 // RNode v2.0, 868 MHz
|
||||
|
||||
// Board code 0x41
|
||||
#define MODEL_A2 0xA2 // RNode v2.1, 433 MHz
|
||||
#define MODEL_A7 0xA7 // RNode v2.1, 868 MHz
|
||||
|
||||
// Board code 0x42
|
||||
#define MODEL_A1 0xA1 // RNode v2.2, 433 MHz
|
||||
#define MODEL_A6 0xA6 // RNode v2.2, 868 MHz
|
||||
|
||||
#define PRODUCT_TBEAM 0xE0 // Board code 0x33
|
||||
#define MODEL_E4 0xE4 // T-Beam SX1278, 433 Mhz
|
||||
#define MODEL_E9 0xE9 // T-Beam SX1276, 868 Mhz
|
||||
#define MODEL_E3 0xE3 // T-Beam SX1268, 433 Mhz
|
||||
#define MODEL_E8 0xE8 // T-Beam SX1262, 868 Mhz
|
||||
|
||||
#define PRODUCT_TDECK_V1 0xD0 // Board code 0x3B
|
||||
#define MODEL_D4 0xD4 // LilyGO T-Deck, 433 MHz
|
||||
#define MODEL_D9 0xD9 // LilyGO T-Deck, 868 MHz
|
||||
|
||||
#define PRODUCT_T32_10 0xB2 // Board code 0x39
|
||||
#define MODEL_BA 0xBA // LilyGO T3 v1.0, 433 MHz
|
||||
#define MODEL_BB 0xBB // LilyGO T3 v1.0, 868 MHz
|
||||
|
||||
#define PRODUCT_T32_20 0xB0 // Board code 0x36
|
||||
#define MODEL_B3 0xB3 // LilyGO T3 v2.0, 433 MHz
|
||||
#define MODEL_B8 0xB8 // LilyGO T3 v2.0, 868 MHz
|
||||
|
||||
#define PRODUCT_T32_21 0xB1 // Board code 0x37
|
||||
#define MODEL_B4 0xB4 // LilyGO T3 v2.1, 433 MHz
|
||||
#define MODEL_B9 0xB9 // LilyGO T3 v2.1, 868 MHz
|
||||
|
||||
#define PRODUCT_H32_V2 0xC0 // Board code 0x38
|
||||
#define MODEL_C4 0xC4 // Heltec Lora32 v2, 433 MHz
|
||||
#define MODEL_C9 0xC9 // Heltec Lora32 v2, 868 MHz
|
||||
|
||||
#define PRODUCT_H32_V3 0xC1 // Board code 0x3A
|
||||
#define MODEL_C5 0xC5 // Heltec Lora32 v3, 433 MHz
|
||||
#define MODEL_CA 0xCA // Heltec Lora32 v3, 868 MHz
|
||||
|
||||
#define PRODUCT_RAK4631 0x10 // Board code 0x51
|
||||
#define MODEL_11 0x11 // RAK4631, 433 Mhz
|
||||
#define MODEL_12 0x12 // RAK4631, 868 Mhz
|
||||
|
||||
#define PRODUCT_HMBRW 0xF0 // Board code 0x32
|
||||
#define MODEL_FE 0xFE // Homebrew board, max 17dBm output power
|
||||
#define MODEL_FF 0xFF // Homebrew board, max 14dBm output power
|
||||
|
||||
|
||||
#define ADDR_PRODUCT 0x00
|
||||
#define ADDR_MODEL 0x01
|
||||
|
|
12
Utilities.h
12
Utilities.h
|
@ -185,6 +185,11 @@ uint8_t boot_vector = 0x00;
|
|||
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
|
||||
void led_tx_on() { digitalWrite(pin_led_tx, LOW); }
|
||||
void led_tx_off() { digitalWrite(pin_led_tx, HIGH); }
|
||||
#elif BOARD_MODEL == BOARD_TDECK
|
||||
void led_rx_on() { }
|
||||
void led_rx_off() { }
|
||||
void led_tx_on() { }
|
||||
void led_tx_off() { }
|
||||
#elif BOARD_MODEL == BOARD_LORA32_V1_0
|
||||
#if defined(EXTERNAL_LEDS)
|
||||
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
|
||||
|
@ -1098,6 +1103,9 @@ void setTXPower() {
|
|||
if (model == MODEL_C4) LoRa->setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
|
||||
if (model == MODEL_C9) LoRa->setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
|
||||
|
||||
if (model == MODEL_D4) LoRa->setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
|
||||
if (model == MODEL_D9) LoRa->setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
|
||||
|
||||
if (model == MODEL_E4) LoRa->setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
|
||||
if (model == MODEL_E9) LoRa->setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
|
||||
if (model == MODEL_E3) LoRa->setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
|
||||
|
@ -1319,7 +1327,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 || rval == PRODUCT_H32_V3) {
|
||||
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 || rval == PRODUCT_TDECK_V1) {
|
||||
#elif PLATFORM == PLATFORM_NRF52
|
||||
if (rval == PRODUCT_RAK4631 || rval == PRODUCT_HMBRW) {
|
||||
#else
|
||||
|
@ -1349,6 +1357,8 @@ bool eeprom_model_valid() {
|
|||
if (model == MODEL_FF || model == MODEL_FE) {
|
||||
#elif BOARD_MODEL == BOARD_TBEAM
|
||||
if (model == MODEL_E4 || model == MODEL_E9 || model == MODEL_E3 || model == MODEL_E8) {
|
||||
#elif BOARD_MODEL == BOARD_TDECK
|
||||
if (model == MODEL_D4 || model == MODEL_D9) {
|
||||
#elif BOARD_MODEL == BOARD_LORA32_V1_0
|
||||
if (model == MODEL_BA || model == MODEL_BB) {
|
||||
#elif BOARD_MODEL == BOARD_LORA32_V2_0
|
||||
|
|
|
@ -127,7 +127,7 @@ bool sx126x::preInit() {
|
|||
pinMode(_ss, OUTPUT);
|
||||
digitalWrite(_ss, HIGH);
|
||||
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_22 || BOARD_MODEL == BOARD_HELTEC32_V3
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_22 || BOARD_MODEL == BOARD_HELTEC32_V3 || BOARD_MODEL == BOARD_TDECK
|
||||
SPI.begin(pin_sclk, pin_miso, pin_mosi, pin_cs);
|
||||
#else
|
||||
SPI.begin();
|
||||
|
@ -721,6 +721,8 @@ void sx126x::enableTCXO() {
|
|||
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};
|
||||
#elif BOARD_MODEL == BOARD_TDECK
|
||||
uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF};
|
||||
#elif BOARD_MODEL == BOARD_RNODE_NG_22
|
||||
uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF};
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue