Waveshare ESP32 S3 Pico with SX1278 now works.

This commit is contained in:
Marcel
2025-02-28 14:55:09 +01:00
parent e6277be9e6
commit cc70ff95bc
9 changed files with 1617 additions and 104 deletions

View File

@@ -142,8 +142,9 @@ Let's say we want to add support for the Waveshare ESP32-S3 Pico with an SX1278
zip --junk-paths ./Release/rnode_firmware_waveshare-esp32-s3-pico.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3_sx126xrnode_firmware_waveshare-esp32-s3-pico.boot_app0 build/rnode_firmware_waveshare-esp32-s3-pico.bin build/rnode_firmware_waveshare-esp32-s3-pico.bootloader build/rnode_firmware_waveshare-esp32-s3-pico.partitions
rm -r build
In the file Boards.h make an entry for the new board within the '#if MCU_VARIANT == MCU_ESP32':
In the file Boards.h make an entry for the new board inside the '#if MCU_VARIANT == MCU_ESP32':
// Board definition added by Mees Electronics
#elif BOARD_MODEL == BOARD_WAVESHARE_ESP32_S3_PICO
#define IS_ESP32S3 true
#define HAS_DISPLAY false
@@ -152,14 +153,7 @@ In the file Boards.h make an entry for the new board within the '#if MCU_VARIANT
#define HAS_PMU true
#define HAS_CONSOLE true
#define HAS_EEPROM true
//#define HAS_INPUT true
//#define HAS_SLEEP true
//#define PIN_WAKEUP GPIO_NUM_0
//#define WAKEUP_LEVEL 0
#define INTERFACE_COUNT 1
#define OCP_TUNED 0x38
const int pin_btn_usr1 = 0;
#define HAS_NP true
const int pin_np = 21;
@@ -182,25 +176,25 @@ In the file Boards.h make an entry for the new board within the '#if MCU_VARIANT
false // DIO2_AS_RF_SWITCH
},
};
const uint8_t interface_pins[INTERFACE_COUNT][10] = {
const int8_t interface_pins[INTERFACE_COUNT][10] = {
// SX1278
{
10, // pin_ss
12, // pin_sclk
11, // pin_mosi
13, // pin_miso
-1, // pin_busy
15, // pin_dio
-1, // pin_busy
15, // pin_dio
14, // pin_reset
-1, // pin_txen
-1, // pin_rxen
-1 // pin_tcxo_enable
-1, // pin_txen
-1, // pin_rxen
-1 // pin_tcxo_enable
}
};
Also, in the file Utilities.h add entry. Again, within the '#if MCU_VARIANT == MCU_ESP32'.
Also, in the file **Utilities.h** add entry. Again, inside the '#if MCU_VARIANT == MCU_ESP32'.
#elif BOARD_MODEL == BOARD_LORA32_V2_1
#elif BOARD_MODEL == BOARD_WAVESHARE_ESP32_S3_PICO
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); }
@@ -208,6 +202,44 @@ Also, in the file Utilities.h add entry. Again, within the '#if MCU_VARIANT == M
void led_id_on() { }
void led_id_off() { }
In **Utilities.h** the functions **led_indicate_info()**, **led_indicate_standby()** and **led_indicate_not_ready()** is also defined for the different boards. If the new board has a NeoPixel, nothing has to be added her.
In **Utilities.h** the function **bool eeprom_model_valid()** also has some board specific definitions. Make sure these are set correctly to prevent an EEPROM error during startup:
// Added by Mees Electronics
#elif BOARD_MODEL == BOARD_WAVESHARE_ESP32_S3_PICO
if (model == MODEL_A4) {
In **Utilities.h** the function **void setTXPower()** defines the LoRa power setting per Lora module/board pair. Add the new board here:
// Added by Mees Electronics
if (model == MODEL_A4) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
The file **display.h** also has a board definition section. If the new board has a display, make sure there is a proper entry for it. Again, inside the '#if MCU_VARIANT == MCU_ESP32'. If the board does not have a display, don't define this section.
#elif BOARD_MODEL == BOARD_WAVESHARE_ESP32_S3_PICO
disp_mode = DISP_MODE_LANDSCAPE;
display.setRotation(0);
The file **Power.h** must also have a board definition. And also proper definitions in **void measure_battery()** and **bool init_pmu()**. These are more elaborate and not yet fully understood, but probably used when the board has a battery installed. If the new board does not have a battery, do not define anything here!
#elif BOARD_MODEL == BOARD_WAVESHARE_ESP32_S3_PICO
#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 = 35;
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;
### Flashing the board
Make shure you are in the dialout group. If not:
@@ -226,6 +258,8 @@ This will end with error 'This device has not been provisioned yet, cannot set f
$ rnodeconf /dev/ttyACM0 -r --platform ESP32 --model a4 --product f0 --hwrev 3
Sometimes the board give error whule flashing. Try flashing the board via the other serial interface (ttyACM1). Don't know why, but it works.
### Migrating to a other system
When the rnode is flashed, it is signed with a key. If you connect the rnode to another system, this key cannot be validated. It is possible to write a new key to the rnode by erasing the eeprom and writing the local key to it.
@@ -233,55 +267,3 @@ When the rnode is flashed, it is signed with a key. If you connect the rnode to
$ rnodeconf /dev/ttyACM0 --eeprom-wipe
$ rnodeconf /dev/ttyACM0 -r --platform ESP32 --model a4 --product f0 --hwrev 3
### And then it did not work...
After I had successfully flashed the board I started reticulum:
$ rnsd -vvv
It found the rnode, but it could not initialize the radio. It gave the following error:
[2025-02-25 10:00:56] [Notice] Serial port /dev/ttyACM0 is now open
[2025-02-25 10:00:56] [Verbose] Configuring RNode interface...
[2025-02-25 10:00:56] [Verbose] Waiting for radio configuration validation for RNodeInterface[RNode LoRa Interface]...
[2025-02-25 10:00:56] [Debug] RNodeInterface[RNode LoRa Interface] Radio reporting frequency is 434.5 MHz
[2025-02-25 10:00:56] [Debug] RNodeInterface[RNode LoRa Interface] Radio reporting bandwidth is 250.0 KHz
[2025-02-25 10:00:56] [Debug] RNodeInterface[RNode LoRa Interface] Radio reporting TX power is 0 dBm
[2025-02-25 10:00:56] [Debug] RNodeInterface[RNode LoRa Interface] Radio reporting spreading factor is 10
[2025-02-25 10:00:56] [Debug] RNodeInterface[RNode LoRa Interface] Radio reporting coding rate is 8
[2025-02-25 10:00:56] [Verbose] RNodeInterface[RNode LoRa Interface] On-air bitrate is now 1.22 kbps
[2025-02-25 10:00:56] [Debug] RNodeInterface[RNode LoRa Interface] Radio reporting state is offline
[2025-02-25 10:00:56] [Error] TX power mismatch
[2025-02-25 10:00:56] [Error] Radio state mismatch
[2025-02-25 10:00:56] [Error] After configuring RNodeInterface[RNode LoRa Interface], the reported radio parameters did not match your configuration.
[2025-02-25 10:00:56] [Error] Make sure that your hardware actually supports the parameters specified in the configuration
[2025-02-25 10:00:56] [Error] Aborting RNode startup
I checked the SPI communication with an oscilloscope and that all seemed to be working. I could find the problem. Than I remembered the second serial interface on the Waveshare board. This interface was available on the USB port via the onboard USB hub. Maybe the rnode spits out some sort of debug information. So I installed *screen* on my pc and started it:
$ screen /dev/ttyACM1 115200
And sure enough, I saw som useful information scrolling across my screen:
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x2b (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x4bc
load:0x403c9700,len:0xbd8
load:0x403cc700,len:0x2a0c
entry 0x403c98d0
E (309) gpio: gpio_set_level(227): GPIO output gpio_num error
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x2b (SPI_FAST_FLASH_BOOT)
Saved PC:0x420f917e
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x4bc
load:0x403c9700,len:0xbd8
load:0x403cc700,len:0x2a0c
entry 0x403c98d0
E (309) gpio: gpio_set_level(227): GPIO output gpio_num error