How OTA Works
The ANX OS OTA engine follows a safe, multi-stage process designed to protect against bad updates:- Poll — the device contacts the ANX update server and checks whether a newer firmware version is available on the configured release channel.
- Download — if an update is found, the engine downloads a delta patch (not a full image) to minimize bandwidth and flash wear.
- Verify — the downloaded patch is verified against a cryptographic signature from ANX Labs. Tampered or corrupted patches are rejected before any write occurs.
- Write — the patch is applied to the inactive firmware partition. The currently running firmware is never touched during this step.
- Health check and reboot — the device reboots into the new firmware. ANX OS monitors the new firmware for 60 seconds. If it passes the health check, the new partition becomes the active boot target. If it crashes or hangs, ANX OS automatically reverts to the previous partition.
Prerequisites
Before enabling OTA updates, confirm the following:- Wi-Fi configured — the
wifi.ssid,wifi.password, andwifi.modefields must be set inconfig.json. OTA requires an active internet connection. See the Configuration guide if you have not set up Wi-Fi yet. - Firmware 1.0.0 or later — the OTA engine shipped in ANX OS 1.0.0. Devices running older firmware must be updated once via USB before they can receive OTA updates. See Flashing.
Enabling Automatic OTA
Add or update theota section in your device’s config.json to turn on background update checks:
config.json
auto_check enabled, the device silently polls the ANX update server every 24 hours and applies any available update during its next idle window.
Triggering a Manual OTA Check
To check for an available update immediately without waiting for the next scheduled poll, run:Triggering OTA from Device Code
You can initiate an OTA check directly from your application using the ANX SDK. This is useful when you want to gate updates on application-level conditions — for example, only checking for updates when the device is idle or after a successful sensor reading cycle.ota_trigger.c
anx_ota_check() call is non-blocking at the network level but does require an active Wi-Fi connection. anx_ota_apply() is a blocking call — it takes over the main execution context for the duration of the download and write, then reboots the device automatically.
- Result Codes
- Full Example with Error Handling