A Python utility for downloading firmware to RNWF02 devices using AT commands over serial communication.
nvm-update.py: main command-line toolrequirements.txt: Python dependency list (pyserial)
- AT command-based firmware download for RNWF02 devices
- Automatic NVM sector erase before update
- Chunked firmware transfer with configurable chunk size
- Real-time progress tracking with transfer speed
- Firmware verification and activation
- Device reset with firmware version check
- Verbose debug mode for troubleshooting
- Color-coded output for better readability
- Cross-platform support (Windows/Linux)
- Python 3.6+
- pyserial library
- Install dependencies:
pip install -r requirements.txtThe firmware update process follows these steps:
- Communication Check: Sends
ATcommand to verify device is responding - Get Firmware Version: Retrieves current firmware version using
AT+GMR - Erase Sectors: Executes
AT+NVMERto erase NVM sectors (may take up to 30 seconds) - Download Firmware: Transfers firmware in chunks using
AT+NVMWR=<offset>,<length>,<hex_data> - Verify Firmware: Validates the downloaded firmware with
AT+OTAVFY - Activate Firmware: Executes
AT+OTAACTto activate the downloaded firmware image - Reset Device (optional): Resets device with
AT+RSTand verifies new firmware version
Basic syntax:
python nvm-update.py -p <PORT> <FIRMWARE_FILE>-p, --port: Serial port (e.g.,COM3on Windows,/dev/ttyUSB0on Linux) - Required- To list available ports with details, run:
python -m serial.tools.list_ports -v
- To list available ports with details, run:
firmware: Path to firmware binary file (e.g.,rnwf02_ota.bin) - Required-b, --baudrate: Baud rate for serial communication (default:230400)-c, --chunk-size: Chunk size in bytes for firmware transfer (default:128)- Note: Chunk size must be a factor of 4096 and ≤ 1024 bytes, since a write cannot cross a sector boundary
-v, --verbose: Enable verbose debug output showing AT commands and responses--no-erase: Skip erasing NVM sectors before firmware download--no-activate: Skip firmware verification and activation after download--no-reset: Skip device reset after firmware update--read-verify: Perform a read verification after writing each chunk
Windows:
# Basic usage with default settings
python nvm-update.py -p COM5 rnwf02_ota.bin
# Custom baud rate
python nvm-update.py -p COM5 -b 921600 rnwf02_ota.bin
# Larger chunk size for faster transfer
python nvm-update.py -p COM5 -c 256 rnwf02_ota.bin
# Verbose mode for debugging
python nvm-update.py -p COM5 -v rnwf02_ota.bin
# Skip device reset after update
python nvm-update.py -p COM5 --no-reset rnwf02_ota.bin
# Skip sector erase (useful for partial updates)
python nvm-update.py -p COM5 --no-erase rnwf02_ota.bin
# Skip activation (download only)
python nvm-update.py -p COM5 --no-activate rnwf02_ota.bin
# Download only without activation or reset
python nvm-update.py -p COM5 --no-activate --no-reset rnwf02_ota.binLinux:
# Basic usage
python nvm-update.py -p /dev/ttyUSB0 rnwf02_ota.bin
# With custom settings
python nvm-update.py -p /dev/ttyUSB0 -b 921600 -c 256 rnwf02_ota.binStarting firmware update...
Checking device communication...
✓ Device responding COM5 at 230400 bps
Getting firmware version...
✓ Firmware version: 3.2.0 1 74d4fbc2 [15:48:01 Jan 21 2026]
Erasing 240 sectors at offset 0...
✓ Sectors erased successfully
Downloading firmware from rnwf02_ota.bin (chunk size: 128 bytes)...
Chunk 1024/1024 (100%): 524288/524288 bytes
✓ Downloaded 524288 bytes in 45.2s (11.3 KB/s)
Verifying firmware...
✓ Firmware verified successfully
Activating firmware...
✓ Firmware activated successfully
Resetting device...
✓ Device reset command sent
Getting firmware version...
✓ Firmware version: 3.2.1 1 8a5c3fd9 [10:23:45 Jan 28 2026]
✓ Firmware update completed
The utility uses the following AT commands from the RNWF02 specification:
AT- Check device communicationAT+GMR- Get firmware version informationAT+NVMER=<offset>,<sectors>- Erase NVM sectors before firmware updateAT+NVMRD=<offset>,<length>- Read data from NVM for verificationAT+NVMWR=<offset>,<length>,<hex_data>- Write firmware chunk to NVMAT+OTAVFY- Verify downloaded firmware imageAT+OTAACT- Activate the downloaded firmware imageAT+RST- Reset the device
- Connection Failed: Verify COM port name and ensure device is connected
- Permission Denied: On Linux, you may need to add your user to the
dialoutgroup:sudo usermod -a -G dialout $USER - Timeout Errors: Try using verbose mode (
-v) to see detailed AT command exchanges - Wrong Baud Rate: Verify device documentation for correct baud rate (default: 230400)
- Slow Transfer: Increase chunk size with
-c 256or higher - Unexpected Response: Use verbose mode to debug AT command responses