Manage Micro-RDK
Micro-RDK CLI
The Viam Micro-RDK installer is a command line tool that you can also use to troubleshoot. It allows you to:
- View logs locally and debug issues when your device has not connected to the Viam app
- Change wifi credentials on your microcontroller
- Overwrite firmware using a serial cable
Download the latest release of the installer for your architecture:
You can also build the micro-rdk-installer
CLI from source:
Clone the repository:
git clone https://github.com/viamrobotics/micro-rdk.git
Change directories into the repository:
cd micro-rdk/micro-rdk-installer
Build the CLI:
cargo build
The executable will be at
target/debug/micro-rdk-installer .
Usage
The following commands are available:
Command | Description |
---|---|
write-flash | Flash a pre-compiled binary (viam-micro-server ) directly to an ESP32 connected to your computer with a data cable. |
write-credentials | Write Wi-Fi and machine credentials to the NVS storage partition of an ESP32 running viam-micro-server . |
create-nvs-partition | Generate a binary of a complete NVS data partition that contains Wi-Fi and security credentials for a machine. |
monitor | Monitor an ESP32 currently connected to your computer with a data cable. |
help | Print this list of commands or the help for a specific command. |
Command options
Option | Description |
---|---|
-h , --help | Print help for a specific command |
Command examples
The following command examples use the micro-rdk-installer-macos
executable.
Change the executable to the appropriate one for your architecture.
# Flash a pre-compiled binary to an ESP32 using app config credentials downloaded from the Viam app setup tab
./micro-rdk-installer-macos write-flash --app-config=~/Downloads/my-microcontroller-main.json
# Monitor an ESP32 currently connected to your computer with a data cable
./micro-rdk-installer-macos monitor
# Get help for a specific command
./micro-rdk-installer-macos create-nvs-partition --help
Over-the-air updates
To remotely update the firmware on your microcontroller without a physical connection to the device, add the OTA (over-the-air) service to your microcontroller’s configuration in the Viam app. Use JSON mode to add the service as in the template below, then configure the URL from which to fetch new firmware, and the version name.
The firmware hosting endpoint must use HTTP/2.
{
"services": [
{
"name": "OTA",
"api": "rdk:service:generic",
"model": "rdk:builtin:ota_service",
"attributes": {
"url": "<URL where firmware is stored in cloud storage>",
"version": "<version name>"
}
}
]
}
{
"services": [
{
"name": "OTA",
"api": "rdk:service:generic",
"model": "rdk:builtin:ota_service",
"attributes": {
"url": "https://storage.googleapis.com/jordanna/micro-rdk-server-esp32-ota.bin",
"version": "myVersion1"
}
}
]
}
Your device checks for configuration updates periodically.
If the device receives a configuration with the OTA service and a modified version
field in it, the device downloads the new firmware to an inactive partition and restarts.
When the device boots it loads the new firmware.
Note
There is no way to roll back to previous firmware after a bad upgrade without reflashing the device with a physical connection, so test your firmware thoroughly before deploying it to a fleet.
Tip
To update the firmware version for a group of microcontrollers at the same time, you can create a fragment with the OTA service configuration and apply it to multiple machines.
Then, whenever you update the version
field in the fragment, the version will be updated for each machine that has that fragment in its config, triggering a firmware update the next time the devices fetch their configs.
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!