# Flashing the Firmware ## USB Serial Flashing ### Prerequisites - USB cable connected to Heltec board - User in `uucp` or `dialout` group (for `/dev/ttyUSB*` access) ### Flash Command ```bash # Build and flash pio run -t upload # Flash to specific port pio run -t upload --upload-port /dev/ttyUSB0 ``` ### Using the Stable Device Path USB device numbers can change. Use the stable path instead: ```bash pio run -t upload --upload-port /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0 ``` ### Boot Mode Issues If flashing fails, manually enter bootloader mode: 1. Hold **BOOT** button 2. Press **RST** button 3. Release **BOOT** button 4. Run `pio run -t upload` --- ## OTA Updates Over-The-Air updates let you flash wirelessly after initial USB flash. ### Step 1: Enter OTA Mode Connect to serial console: ```bash screen /dev/ttyUSB0 115200 ``` Type: ``` start ota ``` Response: ``` Started: http://192.168.4.1/update ``` ### Step 2: Connect to WiFi The repeater creates an open access point: - **SSID:** `MeshCore-OTA` - **Password:** (none) Connect your computer/phone to this network. ### Step 3: Upload Firmware 1. Open browser to `http://192.168.4.1/update` 2. Click "Choose File" 3. Select `.pio/build/heltec_v3_repeater/firmware.bin` 4. Click "Update" 5. Wait for upload and reboot (~30 seconds) ### OTA Endpoints | URL | Purpose | |-----|---------| | `http://192.168.4.1/` | Device info page | | `http://192.168.4.1/update` | ElegantOTA firmware upload | | `http://192.168.4.1/log` | View packet log (if enabled) | ### Exiting OTA Mode OTA mode stays active until reboot. To exit without updating: - Press the **RST** button, or - Power cycle the device --- ## Verifying the Flash After flashing, connect to serial: ```bash screen /dev/ttyUSB0 115200 ``` Press **RST** to see boot messages: ``` Repeater ID: AABBCCDD... ``` Type `ver` to check firmware version: ``` ver -> MeshCore v1.10.0 (Jan 25 2025) ``` --- ## Exit Screen To exit the `screen` session: - `Ctrl+a` then `k` then `y` (kill session) - Or `Ctrl+a` then `d` (detach, keeps session running)