liberatedsystems / RNode_Firmware_CE

RNode is an open, free and flexible digital radio interface with many uses
https://unsigned.io/rnode
GNU General Public License v3.0
30 stars 3 forks source link

T3S3 (SX1280) support #13

Open starlight-traveler opened 1 month ago

starlight-traveler commented 1 month ago

Wanted to inquire about what does the rnodeconf utility refers to when it means "fail to provision", unsure of where in the manual the documentation for this is, there was a thread here, but following the rough thought process still leads me to fail to provision regardless of the bootstrap EEPROM values:

https://github.com/markqvist/Reticulum/discussions/477

For reference I think I have made the necessary changes to support the 2.4 GHz version of the T3S3, but unable to flash it.

Here is the modified Makefile for this board with the custom firmware:

upload-t3s3:
    @echo
    @echo Put board into flashing mode by holding BOOT button while momentarily pressing the RESET button. Hit enter when done.
    @read
    arduino-cli upload -p /dev/tty.usbmodem2101  --fqbn esp32:esp32:esp32s3
    @sleep 2
    python ./Release/esptool/esptool.py --chip esp32s3 --port /dev/tty.usbmodem2101 --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
    @echo
    @echo Press the RESET button on the board now, and hit enter
    @read
    @sleep 1
    rnodeconf /dev/tty.usbmodem2101 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin)

Logs:

make upload-t3s3

Put board into flashing mode by holding BOOT button while momentarily pressing the RESET button. Hit enter when done.

arduino-cli upload -p /dev/tty.usbmodem2101 --fqbn esp32:esp32:esp32s3 esptool.py v4.5.1 Serial port /dev/tty.usbmodem2101 Connecting... Chip is ESP32-S3 (revision v0.1) Features: WiFi, BLE Crystal is 40MHz MAC: 34:b7:da:58:65:4c Uploading stub... Running stub... Stub running... Changing baud rate to 921600 Changed. Configuring flash size... Flash will be erased from 0x00000000 to 0x00003fff... Flash will be erased from 0x00008000 to 0x00008fff... Flash will be erased from 0x0000e000 to 0x0000ffff... Flash will be erased from 0x00010000 to 0x0005cfff... Compressed 15104 bytes to 10430... Writing at 0x00000000... (100 %) Wrote 15104 bytes (10430 compressed) at 0x00000000 in 0.3 seconds (effective 472.1 kbit/s)... Hash of data verified. Compressed 3072 bytes to 134... Writing at 0x00008000... (100 %) Wrote 3072 bytes (134 compressed) at 0x00008000 in 0.1 seconds (effective 376.3 kbit/s)... Hash of data verified. Compressed 8192 bytes to 47... Writing at 0x0000e000... (100 %) Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 612.8 kbit/s)... Hash of data verified. Compressed 313344 bytes to 177944... Writing at 0x00010000... (9 %) Writing at 0x0001afe1... (18 %) Writing at 0x00024527... (27 %) Writing at 0x00029d67... (36 %) Writing at 0x0002f424... (45 %) Writing at 0x00034821... (54 %) Writing at 0x0003a146... (63 %) Writing at 0x00040e54... (72 %) Writing at 0x0004a97e... (81 %) Writing at 0x00051fb0... (90 %) Writing at 0x00057669... (100 %) Wrote 313344 bytes (177944 compressed) at 0x00010000 in 2.9 seconds (effective 863.4 kbit/s)... Hash of data verified.

Leaving... Hard resetting via RTS pin... New upload port: /dev/tty.usbmodem2101 (serial) python ./Release/esptool/esptool.py --chip esp32s3 --port /dev/tty.usbmodem2101 --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 esptool.py v3.3.3 Serial port /dev/tty.usbmodem2101 Connecting... Chip is ESP32-S3 (revision v0.1) Features: WiFi, BLE Crystal is 40MHz MAC: 34:b7:da:58:65:4c Uploading stub... Running stub... Stub running... Changing baud rate to 921600 Changed. Configuring flash size... Flash will be erased from 0x00210000 to 0x003effff... Compressed 1966080 bytes to 1782227... Wrote 1966080 bytes (1782227 compressed) at 0x00210000 in 18.6 seconds (effective 843.6 kbit/s)... Hash of data verified.

Leaving... Hard resetting via RTS pin...

Press the RESET button on the board now, and hit enter

rnodeconf /dev/tty.usbmodem2101 --firmware-hash $(./partition_hashes ./build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin) [17:12:12] Opening serial port /dev/tty.usbmodem2101... [17:12:15] Device connected [17:12:15] Current firmware version: 1.72 [17:12:15] Reading EEPROM... [17:12:16] This device has not been provisioned yet, cannot set firmware hash

jacobeva commented 1 month ago

Run rnodeconf -a and it will provision the EEPROM for you (make sure to select your board).

starlight-traveler commented 1 month ago

How does that work with custom firmware built from the repo (this T3S3 is the 2.4 GHz version)? I thought that was just the auto installer, or am I missing something?

jacobeva commented 1 month ago

I've just looked a little bit into this and it seems the RNODE_NG_22 target is being used for the T3S3 at the moment, which is for the SX1262. There is no target for the SX1280, which is the modem your board uses. I will reopen this issue as a reminder for me to add support (it should be fairly simple). Would you be willing to do pilot testing on your board?

starlight-traveler commented 1 month ago

Yeah, fine by me, 100% willing to help with testing or any integration! I had actually tried to do some of the support, but I seemed to have hit a roadblock for that last step:

Here is the board config if that helps at all. I had trouble with bluetooth compilation enabled so I set it to false just to get past that.

#elif BOARD_MODEL == BOARD_T3_S3_V1_2_SX1280_PA
#define HAS_BLUETOOTH false
#define HAS_PMU true
#define HAS_EEPROM true
#define EEPROM_SIZE 296 // minimum EEPROM size
#define EEPROM_OFFSET EEPROM_SIZE - EEPROM_RESERVED
#define MODEM SX1280
#define HAS_BUSY true
#define HAS_RF_SWITCH_RX_TX true
const int pin_cs = 7;
const int pin_reset = 8;
const int pin_rxen = 21;
const int pin_txen = 10;
const int pin_dio = 9;
const int pin_busy = 36;
const int pin_tcxo_enable = -1;
const int pin_led_rx = -1;
const int pin_led_tx = 37;

I also was trying to get a custom environment, because of this power boost problem which I need to go through the sx1280 library to see if it has that support enabled:

From LilyGo's Documentation:

When using the "SX1280 2.4G With PA [H658]", it is recommended that the software control 1280 chip output 2 to 5 dbm, so that the entire module will output 20 dbm of power; When the output of the 1280 chip is higher than 2 dbm, the output power of the entire module is only 20 dbm; When the output of 1280 chip is higher than 5 dbm, the output power of the entire module is only 20 dbm, but if 5 dbm is given to the FEM, it will damage the FEM chip (the maximum allowable input for the FEM is 5 dbm) If the output of the 1280 chip is lower than 2 dbm, the output power of the entire module is within 20 dbm. The output power setting of the SX1280 cannot be greater than 2-5dbm, otherwise, damage to the FEM chip may occur. Set 3dBM to have an output power of 20dmb.

jacobeva commented 1 month ago

Okay. The Boards.h layout changed in the last release. I will get back to you on Monday with an updated config for your board and we can take it from there.

On 6 July 2024 23:03:53 BST, R @.***> wrote:

Yeah, fine by me, 100% willing to help with testing! I had actually tried to do some of the support, but I seemed to have hit a roadblock for that last step:

Here is the board config if that helps at all. I had trouble with bluetooth compilation enabled so I set it to false just to get past that.

#elif BOARD_MODEL == BOARD_T3_S3_V1_2_SX1280_PA
#define HAS_BLUETOOTH false
#define HAS_PMU true
#define HAS_EEPROM true
#define EEPROM_SIZE 296 // minimum EEPROM size
#define EEPROM_OFFSET EEPROM_SIZE - EEPROM_RESERVED
#define MODEM SX1280
#define HAS_BUSY true
#define HAS_RF_SWITCH_RX_TX true
const int pin_cs = 7;
const int pin_reset = 8;
const int pin_rxen = 21;
const int pin_txen = 10;
const int pin_dio = 9;
const int pin_busy = 36;
const int pin_tcxo_enable = -1;
const int pin_led_rx = -1;
const int pin_led_tx = 37;

-- Reply to this email directly or view it on GitHub: https://github.com/liberatedsystems/RNode_Firmware_CE/issues/13#issuecomment-2211985043 You are receiving this because you were assigned.

Message ID: @.***>

jacobeva commented 1 month ago

Alright. Let's get started.

@starlight-traveler Can you please confirm this is the correct product page for the device? https://www.lilygo.cc/products/t3s3-v1-0?variant=43043715678389

jacobeva commented 1 month ago

Okay, good news! I have just added a corrected board config to the t3s3_sx1280 branch. Can you please try to build and flash the firmware with make t3s3_sx1280_pa && make upload-t3s3, then provision the EEPROM by running rnodeconf -r --product f0 --model a5 --hwrev 1 /dev/yourport?

jacobeva commented 1 month ago

I have also added the checks for the PA, do not worry. Please set the txpower to be 20dBm or 0dBm in your config (values inbetween are not configured yet and will not work).

starlight-traveler commented 1 month ago

Thanks this is great!

Will continue to work on this, as I can't tell if this is a hardware problem, but esptool is timing out when flashing to the chip, may need to change the config:

Put board into flashing mode by holding BOOT button while momentarily pressing the RESET button. Hit enter when done.

arduino-cli upload -p /dev/tty.usbmodem2101 --fqbn esp32:esp32:esp32s3 esptool.py v4.5.1 Serial port /dev/tty.usbmodem2101 Connecting... Chip is ESP32-S3 (revision v0.1) Features: WiFi, BLE Crystal is 40MHz MAC: 34:b7:da:58:65:a4 Uploading stub... Running stub... Stub running... Changing baud rate to 921600 Changed. Configuring flash size... Flash will be erased from 0x00000000 to 0x00003fff... Flash will be erased from 0x00008000 to 0x00008fff... Flash will be erased from 0x0000e000 to 0x0000ffff... Flash will be erased from 0x00010000 to 0x000f6fff... Compressed 15104 bytes to 10430... Writing at 0x00000000... (100 %) Wrote 15104 bytes (10430 compressed) at 0x00000000 in 0.3 seconds (effective 452.5 kbit/s)... Hash of data verified. Compressed 3072 bytes to 134... Writing at 0x00008000... (100 %) Wrote 3072 bytes (134 compressed) at 0x00008000 in 0.1 seconds (effective 390.3 kbit/s)... Hash of data verified. Compressed 8192 bytes to 47... Writing at 0x0000e000... (100 %) Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 555.4 kbit/s)... Hash of data verified. Compressed 942880 bytes to 575580... Writing at 0x00010000... (2 %) Writing at 0x00019ee5... (5 %) Traceback (most recent call last): File "esptool/init.py", line 1032, in _main File "esptool/init.py", line 832, in main File "esptool/cmds.py", line 586, in write_flash File "esptool/loader.py", line 131, in inner File "esptool/loader.py", line 1030, in flash_defl_block File "esptool/loader.py", line 435, in check_command File "esptool/loader.py", line 404, in command File "esptool/loader.py", line 337, in read StopIteration

A fatal error occurred: The chip stopped responding. Failed uploading: uploading error: exit status 2 make: *** [upload-t3s3] Error 1

Ran it when esptool.py v4.7.0

esptool.py v4.7.0 Serial port /dev/tty.usbmodem2101 Connecting... Chip is ESP32-S3 (QFN56) (revision v0.1) Features: WiFi, BLE, Embedded Flash 4MB (XMC), Embedded PSRAM 2MB (AP_3v3) Crystal is 40MHz MAC: 34:b7:da:58:65:a4 Uploading stub... Running stub... Stub running... Configuring flash size... Flash will be erased from 0x00210000 to 0x003effff... Compressed 1966080 bytes to 1782227... Writing at 0x0025667b... (13 %)Traceback (most recent call last): File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/init.py", line 1139, in _main main() File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/init.py", line 923, in main operation_func(esp, args) File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/cmds.py", line 598, in write_flash esp.flash_defl_block(block, seq, timeout=timeout) File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/loader.py", line 131, in inner return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/loader.py", line 1077, in flash_defl_block self.check_command( File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/loader.py", line 467, in check_command val, data = self.command(op, data, chk, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/loader.py", line 436, in command p = self.read() ^^^^^^^^^^^ File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/loader.py", line 369, in read return next(self._slip_reader) ^^^^^^^^^^^^^^^^^^^^^^^ StopIteration

A fatal error occurred: The chip stopped responding.

Will continue to see what this issue is, maybe one of the configs? This is a brand new, out of the box chip (also that is the correct link!

jacobeva commented 1 month ago

You are most welcome.

Please make sure nothing else is accessing the serial port, e.g. RNSd or Arduino-IDE.

If you're sure nothing else is trying to access that serial port, try fiddling with the serial baud rate for flashing in rnodeconf.

On 9 July 2024 11:20:55 BST, R @.***> wrote:

Thanks this is great!

Will continue to work on this, as I can't tell if this is a hardware problem, but esptool is timing out when flashing to the chip, may need to change the config:

Put board into flashing mode by holding BOOT button while momentarily pressing the RESET button. Hit enter when done.

arduino-cli upload -p /dev/tty.usbmodem2101 --fqbn esp32:esp32:esp32s3 esptool.py v4.5.1 Serial port /dev/tty.usbmodem2101 Connecting... Chip is ESP32-S3 (revision v0.1) Features: WiFi, BLE Crystal is 40MHz MAC: 34:b7:da:58:65:a4 Uploading stub... Running stub... Stub running... Changing baud rate to 921600 Changed. Configuring flash size... Flash will be erased from 0x00000000 to 0x00003fff... Flash will be erased from 0x00008000 to 0x00008fff... Flash will be erased from 0x0000e000 to 0x0000ffff... Flash will be erased from 0x00010000 to 0x000f6fff... Compressed 15104 bytes to 10430... Writing at 0x00000000... (100 %) Wrote 15104 bytes (10430 compressed) at 0x00000000 in 0.3 seconds (effective 452.5 kbit/s)... Hash of data verified. Compressed 3072 bytes to 134... Writing at 0x00008000... (100 %) Wrote 3072 bytes (134 compressed) at 0x00008000 in 0.1 seconds (effective 390.3 kbit/s)... Hash of data verified. Compressed 8192 bytes to 47... Writing at 0x0000e000... (100 %) Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 555.4 kbit/s)... Hash of data verified. Compressed 942880 bytes to 575580... Writing at 0x00010000... (2 %) Writing at 0x00019ee5... (5 %) Traceback (most recent call last): File "esptool/init.py", line 1032, in _main File "esptool/init.py", line 832, in main File "esptool/cmds.py", line 586, in write_flash File "esptool/loader.py", line 131, in inner File "esptool/loader.py", line 1030, in flash_defl_block File "esptool/loader.py", line 435, in check_command File "esptool/loader.py", line 404, in command File "esptool/loader.py", line 337, in read StopIteration

A fatal error occurred: The chip stopped responding. Failed uploading: uploading error: exit status 2 make: *** [upload-t3s3] Error 1

Ran it when esptool.py v4.7.0

esptool.py v4.7.0 Serial port /dev/tty.usbmodem2101 Connecting... Chip is ESP32-S3 (QFN56) (revision v0.1) Features: WiFi, BLE, Embedded Flash 4MB (XMC), Embedded PSRAM 2MB (AP_3v3) Crystal is 40MHz MAC: 34:b7:da:58:65:a4 Uploading stub... Running stub... Stub running... Configuring flash size... Flash will be erased from 0x00210000 to 0x003effff... Compressed 1966080 bytes to 1782227... Writing at 0x0025667b... (13 %)Traceback (most recent call last): File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/init.py", line 1139, in _main main() File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/init.py", line 923, in main operation_func(esp, args) File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/cmds.py", line 598, in write_flash esp.flash_defl_block(block, seq, timeout=timeout) File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/loader.py", line 131, in inner return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/loader.py", line 1077, in flash_defl_block self.check_command( File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/loader.py", line 467, in check_command val, data = self.command(op, data, chk, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/loader.py", line 436, in command p = self.read() ^^^^^^^^^^^ File "/opt/homebrew/Cellar/esptool/4.7.0_1/libexec/lib/python3.12/site-packages/esptool/loader.py", line 369, in read return next(self._slip_reader) ^^^^^^^^^^^^^^^^^^^^^^^ StopIteration

A fatal error occurred: The chip stopped responding.

Will continue to see what this issue is, maybe one of the configs? This is a brand new, out of the box chip (also that is the correct link!

-- Reply to this email directly or view it on GitHub: https://github.com/liberatedsystems/RNode_Firmware_CE/issues/13#issuecomment-2217257764 You are receiving this because you were assigned.

Message ID: @.***>

starlight-traveler commented 1 month ago

Alright! Making progress. Switched to Linux and fixed baud rate and it worked to upload!

Though now we are stuck on "Device Starting" and this error:

SPIWP:0xee mode:DIO, clock div:1 load:0x3fce3808,len:0x4bc load:0x403c9700,len:0xbd8 load:0x403cc700,len:0x2a0c entry 0x403c98d0 E (13) gpio: gpio_set_level(227): GPIO output gpio_num error U

Will try to investigate, though perhaps you know off the top of your head.

jacobeva commented 1 month ago

Pins are wrong, I need to review the boards.h.

jacobeva commented 1 month ago

Oh, it seems that there is a TX and RX switch on the SX1280 for the T3S3, but it's just one pin. Now this will need some extra support added. I will tackle this tomorrow.

https://github.com/Xinyuan-LilyGO/LilyGo-LoRa-Series/blob/master/examples/RadioLibExamples/Transmit_Interrupt/utilities.h#L446 Leaving pin info here for my reference.

starlight-traveler commented 1 month ago

Cool, no problem! Thanks again!

jacobeva commented 1 month ago

I have not forgotten about this, but I am very busy! I will work more on this soon when I have time, hopefully next week.

starlight-traveler commented 1 month ago

Of course haha, no problem! Thanks for working on this in your spare time, take however long you need. If you need any testing or integration stuff done let me know!