This Python script facilitates firmware updates for NTN DOngle MCU devices using the pymdfu library over a serial connection.
- Updates firmware on NTN Dongle MCU devices.
- Supports Modbus RTU communication over serial ports.
- Configurable via command-line arguments for image path, port, device ID, and retry mode.
- Logs detailed process information for debugging.
- Handles password validation and bootloader mode activation.
- Python 3.6+
- Required Python packages:
pymdfumodbus_tkpyserial
- A compatible NTN Modbus Master MCU device connected via a serial port (e.g.,
/dev/ttyUSB0). - Firmware image file for the update.
-
Clone the repository:
git clone https://github.com/CREATIVE5-io/Hestia-FW-Update-Python.git cd Hestia-FW-Update-Python -
Install dependencies:
pip install -r requirements.txt
Run the script with appropriate command-line arguments:
python ntn_dongle_fw_update.py --image <path_to_firmware_image> --port <serial_port> --dev_id <device_id> [--retry]--image: Path to the firmware image file (required).--port: Serial port of the device (default: /dev/ttyUSB0).--dev_id: Modbus device ID (default: 1).--retry: Use if the MCU is already in bootloader mode (optional).
python ntn_dongle_fw_update.py --image firmware.bin --port /dev/ttyUSB0 --dev_id 1The script:
- Parses command-line arguments.
- Initializes a Modbus RTU master connection.
- Validates the password (if not in retry mode).
- Activates engineering and bootloader modes (if not in retry mode).
- Resets the MCU (if not in retry mode).
- Executes the
pymdfu updatecommand to perform the firmware update. - Logs all steps and outputs from the update process.
- Logs are output to the console with levels
INFO,ERROR, etc. - Real-time output from the
pymdfuupdate process is captured and logged.
- Ensure the serial port is correct and accessible.
- Verify the firmware image file exists and is valid.
- Check that the device ID matches the target MCU.
- Use
--retryif the device is already in bootloader mode. - Install missing dependencies if errors occur.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please submit a pull request or open an issue for suggestions or bug reports.