Post

UART Configurator: Runtime parameter management for embedded devices

UART Configurator: Runtime parameter management for embedded devices

Overview

uart_configurator is a modular firmware parameter management system designed for embedded projects (ESP32) that need per-device configuration without rebuilding firmware. It exposes a serial CLI over UART, validates input, persists settings to EEPROM (with CRC32), and provides an extensible pattern for adding parameters and validators.

Why this helps

  • Configure dozens or hundreds of devices without recompiling firmware
  • Recover settings automatically on boot
  • Validate inputs before saving to prevent runtime errors
  • Extendable parameter table and validators for custom application needs

Key features

  • Interactive Serial CLI (115200 baud) with help, set, get, save, clear, exit
  • EEPROM persistence with CRC32 integrity checks
  • Built-in validators (IP, port range, string length) and easy custom validators
  • Type-safe Parameters struct and sentinel-based parameter table for easy extension
  • Timeout support and batch configuration flows

Architecture & project structure

Main components:

  • SerialCLI — parses user input and handles interactive prompts
  • UartConfigurator — core logic, validation, state tracking
  • Parameters — struct holding parameter fields and default values
  • EEPROMManager — save/load/clear with CRC32 checks

Typical layout:

1
2
3
4
5
6
7
8
9
uart_configurator/
├── src/
│   ├── SerialCLI.cpp/h
│   ├── UartConfigurator.cpp/h
│   ├── Parameters.cpp/h
│   ├── EEPROMManager.cpp/h
|   └── main.cpp
├── platformio.ini
└── README.md

Quick start (PlatformIO)

  1. Clone the repository and open it with VS Code + PlatformIO:
1
2
git clone https://github.com/Gory-git/uart_configurator.git
cd uart_configurator
  1. Configure platformio.ini for your board (e.g. esp32dev or upesy_wroom).

  2. Build and upload:

1
2
pio run -t upload
pio device monitor  # open serial monitor at 115200

Usage example

On first boot the configurator prompts:

1
2
3
4
5
6
Configuration loaded from EEPROM:
	id: void
	ip: 000.000.000.000
	port: 0

Modify configuration parameters? [y/n]

Enter y and use commands like:

1
2
3
4
> set id DEVICE_001
> set ip 192.168.1.100
> set port 8080
> save

Extending parameters

To add a new parameter:

  1. Update Parameters.h with the new field and default.
  2. Implement a validator in Parameters.cpp.
  3. Register the parameter in UartConfigurator before the sentinel entry.
  4. Rebuild and test.

Data integrity & safety

The EEPROMManager stores a CRC32 alongside the parameters to detect corruption. If CRC verification fails on boot, defaults are loaded. Critical operations (save/clear) ask for confirmation to avoid accidental data loss.

Use cases

  • Field-deployed IoT nodes with device-specific network settings
  • Sensor networks requiring different calibration per node
  • Development workflows where parameters change frequently during testing

Resources & contribution

This post is licensed under CC BY 4.0 by the author.