/ RNode_Firmware_CE_G2 / BUILD_STATION_G2.md
BUILD_STATION_G2.md
1 # Building RNode Firmware for Station G2 2 3 This document describes how to build and flash RNode firmware for the Station G2 LoRa base station. 4 5 ## Prerequisites 6 7 - **arduino-cli** (or Arduino IDE with ESP32 board support) 8 - **ESP32 Core 2.0.15–2.0.17** (critical: 3.x causes `undefined reference` errors) 9 - **Python 3** (for esptool) 10 11 ## Build Environment Setup 12 13 1. **Install arduino-cli** (if not already installed): 14 ```bash 15 curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh 16 ``` 17 18 2. **Prepare ESP32 toolchain** (uses ESP32 Core 2.0.17): 19 20 Note: The unsigned.io board index URL in `arduino-cli.yaml` may return 404 and is commented out. This does not affect Station G2 builds. 21 ```bash 22 make prep-esp32 23 ``` 24 25 3. **Verify build** with an existing target first: 26 ```bash 27 make firmware-tbeam_supreme 28 ``` 29 30 ## Building Station G2 Firmware 31 32 ```bash 33 make firmware-station_g2 34 ``` 35 36 The compiled firmware will be in `build/esp32.esp32.esp32s3/RNode_Firmware_CE_G2.ino.bin`. 37 38 ## Flashing 39 40 **Option A: Full upload (firmware + console + rnodeconf provisioning)** 41 ```bash 42 make firmware-station_g2 43 make console-site spiffs-image 44 make upload-station_g2 DEVICE_PORT=/dev/ttyACM0 45 ``` 46 47 Override `DEVICE_PORT` for your system (e.g. `/dev/ttyUSB0` on Linux, `/dev/cu.usbmodem*` on macOS). 48 49 **Option B: Firmware only** 50 ```bash 51 arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:esp32s3 52 ``` 53 54 ## rnodeconf Integration 55 56 rnodeconf does not yet recognize Station G2 out-of-the-box. Apply the patch: 57 58 ```bash 59 cd RNode_Firmware_CE_G2 # or pass the full path to the script 60 python3 patch_rnodeconf_g2.py 61 ``` 62 63 The script imports `RNS`; if `python3` is not the same environment as `pipx install rns`, use that venv’s interpreter (e.g. `~/.local/share/pipx/venvs/rns/bin/python patch_rnodeconf_g2.py`). See the repo root [README.md](../README.md) section **Host-side patches**. 64 65 See [STATION_G2_RNODECONF_CHANGES.md](STATION_G2_RNODECONF_CHANGES.md) for manual steps. 66 67 ## Provisioning Blank EEPROM 68 69 When the device has valid firmware but **blank or invalid EEPROM**, `rnodeconf -i` will fail with "EEPROM is invalid". Use **ROM bootstrap** instead: 70 71 1. **Create signing key** (only needed once, if you have no key yet): 72 ```bash 73 rnodeconf -k 74 ``` 75 76 2. **Bootstrap EEPROM** (use `-r`, not `-i`): 77 ```bash 78 rnodeconf /dev/ttyACM0 -r --product 60 --model 62 --hwrev 1 79 ``` 80 - `-r` / `--rom`: Bootstrap EEPROM without flashing firmware 81 - `--product 60`: Station G2 (hex 0x60) 82 - `--model 62`: Model 0x62 (902–928 MHz, 37 dBm) 83 - `--hwrev 1`: Hardware revision (required; 1–255) 84 85 3. **Verify** after provisioning: 86 ```bash 87 rnodeconf /dev/ttyACM0 -i 88 ``` 89 90 Replace `/dev/ttyACM0` with your port (e.g. `/dev/ttyUSB0` on Linux, `/dev/cu.usbmodem*` on macOS). 91 92 ## WiFi Configuration 93 94 Station G2 has WiFi and can connect to your network for remote serial access (TCP port 7633). rnodeconf does not support WiFi; use the helper script: 95 96 ```bash 97 cd /home/kraven/applications/g2_rnode/RNode_Firmware_CE_G2 98 python3 configure_wifi.py /dev/ttyACM0 "YourSSID" "YourPassword" 99 ``` 100 101 - Ensure the RNode is connected via USB and not in use by another program. 102 - Replace `/dev/ttyACM0` with your port. 103 - After configuration, the device connects at boot. The display cycles and may show the assigned IP. 104 - Connect remotely via TCP to the RNode’s IP on port **7633** (KISS over TCP). 105 106 Optional static IP: the script can be extended to send `CMD_WIFI_IP` and `CMD_WIFI_NM` for fixed addressing. 107 108 ## Validation with rnsd 109 110 1. Provision the device (see [Provisioning Blank EEPROM](#provisioning-blank-eeprom) if EEPROM was blank) 111 2. Configure Reticulum to use the RNode interface 112 3. Start rnsd and check for "Radio state mismatch" – if present, see [Reticulum Discussion #558](https://github.com/markqvist/Reticulum/discussions/558) 113 114 ## Station G2 Pin Mapping (from Meshtastic variant) 115 116 | Function | GPIO | 117 |-----------------|------| 118 | SX1262 SPI SCK | 12 | 119 | SX1262 SPI MISO | 14 | 120 | SX1262 SPI MOSI | 13 | 121 | SX1262 SPI CS | 11 | 122 | SX1262 Reset | 21 | 123 | SX1262 Busy | 47 | 124 | SX1262 DIO1 | 48 | 125 | I2C SDA (Display)| 5 | 126 | I2C SCL (Display)| 6 | 127 | TX LED | 8 | 128 | RX LED | 9 | 129 | User Button | 38 | 130 131 ## References 132 133 - [RNode Firmware for Station G2](../RNode%20Firmware%20for%20Station%20G2.md) 134 - [Reticulum Discussion #558](https://github.com/markqvist/Reticulum/discussions/558) 135 - [Unit Engineering Station G2 Wiki](https://wiki.uniteng.com/en/meshtastic/station-g2)