Skip to content

Wrong RX/TX switching for BOARD_E22_ESP32 variant? #65

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

Open
azidoazid opened this issue Mar 14, 2025 · 12 comments
Open

Wrong RX/TX switching for BOARD_E22_ESP32 variant? #65

azidoazid opened this issue Mar 14, 2025 · 12 comments

Comments

@azidoazid
Copy link

azidoazid commented Mar 14, 2025

I am currently trying to compile my own rnode firmware for the following hardware:
https://github.com/Hydra-Designs/project-hydra-meshtastic-pcb
And while browsing the Boards.h file I found out that there is support for a different board that shares the same physical construction:

#define BOARD_E22_ESP32 0x45 // Custom Ebyte E22 board design for meshtastic, source:

But looking at
true // DIO2_AS_RF_SWITCH

it seems like RX/TX switching is implemented via DIO2 and thereby not via dedicated TXen/RXen pins as required per schematic?
Image

And it seems like the sx1262 driver is missing a txen functionality:

sx126x::sx126x(uint8_t index, SPIClass* spi, bool tcxo, bool dio2_as_rf_switch, int ss, int sclk, int mosi, int miso, int reset, int dio0, int busy, int rxen) :

@jacobeva
Copy link

It seems you are correct, I will have to fix this.

@azidoazid
Copy link
Author

I am going to give it a try, should be straight-forward to adapt the RX/TX switching from the sx128x driver. I'll report back in a couple of days, I really appreciate the building.md documentation!

@jacobeva
Copy link

jacobeva commented Mar 15, 2025 via email

@azidoazid
Copy link
Author

azidoazid commented Mar 17, 2025

I had some troubles with arduino-cli and the library management #66. Somehow I ended up with the most recent libraries, even though I followed the guide and did a make prep-esp32 beforehand. Since libs are installed system-wide I must have managed to update the libs in between downloading+prepping and then compiling.

My modified firmware is building with no errors, however make upload-e22_esp32 fails after uploading with:
FileNotFoundError: [Errno 2] No such file or directory: './build/esp32.esp32.esp32/RNode_Firmware_CE.ino.bin

I manually adjusted the output dir:
https://github.com/azidoazid/RNode_Firmware_CE/blob/db046ec53163be2f8d37cac4b37416b8a6e01e25/Makefile#L99

And adjusted the path in the make upload step:
https://github.com/azidoazid/RNode_Firmware_CE/blob/db046ec53163be2f8d37cac4b37416b8a6e01e25/Makefile#L257

Now I get the following error message:

Opening serial port /dev/ttyUSB0...
Device connected
Current firmware version: 1.74
Reading EEPROM...
This device has not been provisioned yet, cannot set firmware hash
make: *** [Makefile:257: upload-e22_esp32] Error 77

And the OLED shows "MISSING CONFIG!"

I also tried running:
rnodeconf /dev/ttyUSB0 -r --platform ESP32 --model a6 --product f0 --hwrev 1
which outputs:

Opening serial port /dev/ttyUSB0...
Device connected
Current firmware version: 1.74
Reading EEPROM...
Waiting for ESP32 reset...
Loading signing key...
Bootstrapping device EEPROM...
EEPROM written! Validating...
Waiting for ESP32 reset...
EEPROM checksum correct
Device signature validated
EEPROM Bootstrapping successful!

If I then manually re-run
rnodeconf /dev/ttyUSB0 --firmware-hash $(./partition_hashes ./build/RNode_Firmware_CE.ino.bin)

Opening serial port /dev/ttyUSB0...
Device connected
Current firmware version: 1.74
Reading EEPROM...
EEPROM checksum correct
Device signature validated
Firmware hash set

I then manually retried make upload-e22_esp32 but I had to modify: https://github.com/azidoazid/RNode_Firmware_CE/blob/db046ec53163be2f8d37cac4b37416b8a6e01e25/Makefile#L259 to use a recent version of esptool since the included esptool failed to enter bootloader mode on my hardware.
Afterwards make upload-e22_esp32 finished with no errors but I am still left with "MISSING CONFIG". I made sure to run esptool erase_flash before trying all the above steps.

Any idea on what's going on? Same thing with building from the master branch btw.

@azidoazid
Copy link
Author

@jacobeva Any idea? I am still stuck at "MISSING CONFIG".

@jacobeva
Copy link

jacobeva commented Mar 27, 2025 via email

@azidoazid
Copy link
Author

I've taken the product and model values from: https://github.com/liberatedsystems/RNode_Firmware_CE/blob/master/Documentation/BUILDING.md and tried several of those. I can also read the config with rnodeconf.
I also don't understand why make upload fails with This device has not been provisioned yet, cannot set firmware hash, this clearly should not happen if the makefile is working as intended?

@jacobeva
Copy link

jacobeva commented Apr 6, 2025

this clearly should not happen if the makefile is working as intended?

You are right to a certain extent. The makefile does need some refactoring to support board flashing when they haven't been provisioned yet. I've largely inherited the makefile from the upstream repo. PRs welcome.

@jacobeva
Copy link

jacobeva commented Apr 6, 2025

Use model ff and product f0. This should work now thanks to 40a97a4. You will have to wipe your EEPROM to provision again.

@jacobeva
Copy link

jacobeva commented Apr 6, 2025

My modified firmware is building with no errors, however make upload-e22_esp32 fails after uploading with:
FileNotFoundError: [Errno 2] No such file or directory: './build/esp32.esp32.esp32/RNode_Firmware_CE.ino.bin
I manually adjusted the output dir:
https://github.com/azidoazid/RNode_Firmware_CE/blob/db046ec53163be2f8d37cac4b37416b8a6e01e25/Makefile#L99
And adjusted the path in the make upload step:
https://github.com/azidoazid/RNode_Firmware_CE/blob/db046ec53163be2f8d37cac4b37416b8a6e01e25/Makefile#L257

This is all really odd and shouldn't be necessary. Quite strange.

@azidoazid
Copy link
Author

Hi jacob,
thanks for the update! I've synced my repo, now I get "device check passed" and "hardware init ok trx ready" 👍 RXEN is 3.3V with rnode in idle, seems like my code butchering is also working as intended!
However I can't test/ use the rnode, nomadnet is complaining:

[Notice]   Opening serial port /dev/ttyUSB0...
[Notice]   Serial port /dev/ttyUSB0 is now open
[Error]    Bandwidth mismatch
[Error]    TX power mismatch
[Error]    Spreading factor mismatch
[Error]    Radio state mismatch
[Error]    After configuring RNodeInterface[RNode LoRa Interface], the reported radio parameters did not match your configuration.
[Error]    Make sure that your hardware actually supports the parameters specified in the configuration
[Error]    Aborting RNode startup

.reticulum/config:

  [[RNode LoRa Interface]]
    type = RNodeInterface
    interface_enabled = True
    port = /dev/ttyUSB0
    frequency = 869525000
    bandwidth = 125000
    txpower = 1
    spreadingfactor = 11
    codingrate = 5

Seems like it's failing due to the "Modem chip: Unknown" in the EEprom config?

rnodeconf /dev/ttyUSB0 -i

Opening serial port /dev/ttyUSB0...
Device connected
Current firmware version: 1.74
Reading EEPROM...
EEPROM checksum correct
Device signature validated

Device info:
       Product            : Hombrew RNode (Band capabilities unknown) (f0:ff:45)
       Device signature   : Validated - Local signature
       Firmware version   : 1.74
       Hardware revision  : 1
       Serial number      : 00:00:00:13
       Modem chip         : Unknown
       Frequency range    : 100.0 MHz - 1100.0 MHz
       Max TX power       : 14 dBm
       Manufactured       : 2025-04-09 16:20:16
       Device mode        : Normal (host-controlled)

Regarding the makefile, just pointing out some issues I've encountered :) Once I've verified that my rnode is working I'll open a PR for the RXEN/TXEN switching. And then I'll try to reproduce my issues on a different machine.

@tomuk5
Copy link

tomuk5 commented Apr 29, 2025

Hi, apologies for delay in replying on this.

I did deviate from the diagram slightly (and i need to update this) i use the DIO2 pin bridged to TXEN to save having to implement TXEN functionality for the SX1262.

I've just made a pull-req for revised settings for TCX0 and SPI pins that should result in a fully working E22 board (with the TXEN bridged to DIO2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants