Skip to content

Commit bcab5c3

Browse files
committed
docs: Update documentation on FOTA
- Add docs for manual FOTA and via REST - Include documentation on how to deal with versioning Signed-off-by: Simen S. Røstad <[email protected]>
1 parent 9a7fb89 commit bcab5c3

File tree

9 files changed

+214
-233
lines changed

9 files changed

+214
-233
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Core modules include:
117117
* **[Location](docs/modules/location.md)**: GNSS, Wi-Fi, and cellular positioning
118118
* **[LED](docs/modules/led.md)**: RGB LED control for Thingy:91 X
119119
* **[Button](docs/modules/button.md)**: User input handling
120-
* **[FOTA](docs/modules/fota.md)**: Firmware over-the-air updates
120+
* **[FOTA](docs/modules/fota_module.md)**: Firmware over-the-air updates
121121
* **[Environmental](docs/modules/environmental.md)**: Sensor data collection
122122
* **[Power](docs/modules/power.md)**: Battery monitoring and power management
123123

@@ -151,7 +151,7 @@ The architecture is detailed in the [Architecture documentation](docs/common/arc
151151
* [Enable support for MQTT](docs/common/customization.md#enable-support-for-mqtt)
152152
* [Location Services](docs/common/location_services.md)
153153
* [Test and CI Setup](docs/common/test_and_ci_setup.md)
154-
* [nRF Cloud FOTA](docs/common/nrfcloud_fota.md)
154+
* [Firmware Updates (FOTA)](docs/common/fota.md)
155155
* [Tooling and Troubleshooting](docs/common/tooling_troubleshooting.md)
156156
* [Shell Commands](docs/common/tooling_troubleshooting.md#shell-commands)
157157
* [Debugging Tools](docs/common/tooling_troubleshooting.md#debugging-tools)
@@ -166,7 +166,7 @@ The architecture is detailed in the [Architecture documentation](docs/common/arc
166166
* [Cloud](docs/modules/cloud.md)
167167
* [Storage](docs/modules/storage.md)
168168
* [Environmental](docs/modules/environmental.md)
169-
* [FOTA](docs/modules/fota.md)
169+
* [FOTA](docs/modules/fota_module.md)
170170
* [LED](docs/modules/led.md)
171171
* [Location](docs/modules/location.md)
172172
* [Main](docs/modules/main.md)

app/VERSION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Do not modify, will be overwritten by release workflow.
21
VERSION_MAJOR = 0
32
VERSION_MINOR = 0
43
PATCHLEVEL = 0

docs/common/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The Asset Tracker Template is built around a modular architecture where each mod
1818
- **[Location module](../modules/location.md)**: Provides location services using GNSS, Wi-Fi, and cellular positioning.
1919
- **[LED module](../modules/led.md)**: Controls RGB LED for visual feedback.
2020
- **[Button module](../modules/button.md)**: Handles button input for user interaction.
21-
- **[FOTA module](../modules/fota.md)**: Manages firmware over-the-air updates.
21+
- **[FOTA module](../modules/fota_module.md)**: Manages firmware over-the-air updates.
2222
- **[Environmental module](../modules/environmental.md)**: Collects environmental sensor data (temperature, humidity, pressure).
2323
- **[Power module](../modules/power.md)**: Monitors battery status and provides power management.
2424

docs/common/fota.md

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
# Firmware Updates (FOTA)
2+
3+
This guide covers how to perform Firmware Over The Air (FOTA) updates using nRF Cloud, including both the web UI and REST API methods.
4+
5+
## Firmware Versioning
6+
7+
### Version Components
8+
9+
Firmware versions are defined in `app/VERSION`:
10+
11+
- **VERSION_MAJOR**: Major version
12+
- **VERSION_MINOR**: Minor version
13+
- **PATCHLEVEL**: Patch level
14+
- **VERSION_TWEAK**: Additional component (typically 0)
15+
- **EXTRAVERSION**: Extra string (e.g., "dev", "rc1")
16+
17+
Example resulting in version `1.2.3-dev`:
18+
19+
```plaintext
20+
VERSION_MAJOR = 1
21+
VERSION_MINOR = 2
22+
PATCHLEVEL = 3
23+
VERSION_TWEAK = 0
24+
EXTRAVERSION = dev
25+
```
26+
27+
### Preparing Firmware
28+
29+
1. **Update `app/VERSION`** - Increment the appropriate version component
30+
2. **Build the firmware**
31+
32+
Using the command line:
33+
34+
```bash
35+
west build -p -b thingy91x/nrf9151/ns # Make sure you build for the appropriate board
36+
```
37+
38+
Or use the nRF Connect for VS Code extension - see the [Getting Started](getting_started.md) guide for details on building with the extension.
39+
40+
3. **Locate update bundles**:
41+
- `build/app/zephyr/dfu_application.zip` - Application firmware update
42+
- `build/app/zephyr/dfu_mcuboot.zip` - Bootloader update
43+
44+
### Version Verification
45+
46+
**Important**: The `fwversion` field in a firmware bundle is independent from the device's reported version.
47+
48+
To verify a successful update:
49+
50+
- **Application updates**: Check that the FOTA job shows **Completed** status AND the **App Version** field in device information reflects the new version
51+
- **Modem updates**: Check that the FOTA job shows **Completed** status AND the **Modem Firmware** field in device information shows the new version
52+
53+
![Device information showing app version](../images/device_information.png)
54+
55+
## Performing FOTA Updates
56+
57+
### Option 1: nRF Cloud Web UI
58+
59+
This is the recommended method for manual updates and testing.
60+
61+
1. **Navigate to Firmware Updates** in the nRF Cloud portal under **Device Management**
62+
2. **Create Update Bundle**:
63+
- Click "Add bundle"
64+
- Upload your bundle file:
65+
- For application updates: `dfu_application.zip`
66+
- For bootloader updates: `dfu_mcuboot.zip`
67+
- Set **Update Type** (e.g., LTE)
68+
- Enter a **Name** for the bundle
69+
- Enter a **Version** string (can be any identifier - this is the `fwversion` shown in the bundle list)
70+
- Click "Create/Upload Bundle"
71+
72+
3. **Create FOTA Update**:
73+
- Enter a **Name** and a **Description** of the update
74+
- Select target device(s) via device or group selection
75+
- Click on **Deploy now**
76+
- Click "Create FOTA Update"
77+
78+
4. **Monitor Progress**:
79+
- View job status in the "Overall Progress" section of the update
80+
- Status will progress: Queued → In Progress → Downloading → Completed
81+
- The device will automatically download and apply the update once it becomes online
82+
83+
5. **Verify Update**:
84+
- Navigate to your device page, **Device Management****Devices** and select your device
85+
- Click on **Device info** under the **Device Information** card
86+
- Check the **App Version** (for app updates) or **Modem Firmware** (for modem updates) field
87+
- Confirm the version matches your new firmware
88+
89+
### Option 2: REST API
90+
91+
For automated workflows and CI/CD integration, use the REST API.
92+
93+
#### Setup
94+
95+
```bash
96+
export API_KEY=<your-nrf-cloud-api-key>
97+
export DEVICE_ID=<your-device-id>
98+
```
99+
100+
Find your API key in **User Account** settings in nRF Cloud. See [nRF Cloud REST API](https://api.nrfcloud.com/) for reference.
101+
102+
#### Complete Update Workflow
103+
104+
1. **Create manifest and upload bundle**:
105+
106+
```bash
107+
# Set path to your application binary
108+
export BIN_FILE="build/app/zephyr/zephyr.signed.bin"
109+
export FW_VERSION="1.2.3"
110+
111+
# Create manifest.json with firmware details
112+
cat > manifest.json << EOF
113+
{
114+
"name": "My Firmware",
115+
"description": "Firmware description",
116+
"fwversion": "${FW_VERSION}",
117+
"format-version": 1,
118+
"files": [
119+
{
120+
"file": "$(basename ${BIN_FILE})",
121+
"type": "application",
122+
"size": $(stat -f%z ${BIN_FILE})
123+
}
124+
]
125+
}
126+
EOF
127+
128+
# Create zip containing firmware and manifest
129+
zip -j firmware.zip ${BIN_FILE} manifest.json
130+
131+
# Upload to nRF Cloud and extract bundle ID
132+
UPLOAD_RESPONSE=$(curl -X POST "https://api.nrfcloud.com/v1/firmwares" \
133+
-H "Authorization: Bearer ${API_KEY}" \
134+
-H "Content-Type: application/zip" \
135+
--data-binary @firmware.zip)
136+
137+
# Extract the bundle ID from the response (UUID from the URI path)
138+
export BUNDLE_ID=$(echo $UPLOAD_RESPONSE | jq -r '.uris[0]' | grep -oE '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')
139+
```
140+
141+
2. **Create and apply FOTA job**:
142+
143+
```bash
144+
# Create job
145+
JOB_RESPONSE=$(curl -X POST "https://api.nrfcloud.com/v1/fota-jobs" \
146+
-H "Authorization: Bearer ${API_KEY}" \
147+
-H "Content-Type: application/json" \
148+
-d "{\"deviceIds\": [\"${DEVICE_ID}\"], \"bundleId\": \"${BUNDLE_ID}\"}")
149+
150+
export JOB_ID=$(echo $JOB_RESPONSE | jq -r '.jobId')
151+
152+
# Apply job
153+
curl -X POST "https://api.nrfcloud.com/v1/fota-jobs/${JOB_ID}/apply" \
154+
-H "Authorization: Bearer ${API_KEY}"
155+
```
156+
157+
3. **Monitor job status**:
158+
159+
```bash
160+
curl -X GET "https://api.nrfcloud.com/v1/fota-jobs/${JOB_ID}" \
161+
-H "Authorization: Bearer ${API_KEY}" \
162+
-H "Accept: application/json"
163+
```
164+
165+
Job status values: `QUEUED`, `IN_PROGRESS`, `DOWNLOADING`, `SUCCEEDED`, `FAILED`, `TIMED_OUT`, `CANCELLED`, `REJECTED`
166+
167+
4. **Verify the update** by checking the device information in nRF Cloud (App Version or Modem Firmware field)
168+
169+
#### API Reference
170+
171+
**List FOTA jobs**:
172+
173+
```bash
174+
curl -X GET "https://api.nrfcloud.com/v1/fota-jobs" \
175+
-H "Authorization: Bearer ${API_KEY}"
176+
```
177+
178+
**Cancel FOTA job**:
179+
180+
```bash
181+
curl -X PUT "https://api.nrfcloud.com/v1/fota-jobs/${JOB_ID}/cancel" \
182+
-H "Authorization: Bearer ${API_KEY}"
183+
```
184+
185+
**Delete FOTA job**:
186+
187+
```bash
188+
curl -X DELETE "https://api.nrfcloud.com/v1/fota-jobs/${JOB_ID}" \
189+
-H "Authorization: Bearer ${API_KEY}"
190+
```
191+
192+
**Delete firmware bundle**:
193+
194+
```bash
195+
curl -X DELETE "https://api.nrfcloud.com/v1/firmwares/${BUNDLE_ID}" \
196+
-H "Authorization: Bearer ${API_KEY}"
197+
```

docs/common/getting_started.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,12 @@ To test that everything is working as expected, you can do the following:
242242

243243
If you experience issues, check the logs in the serial terminal for any error messages. You can find troubleshooting tips in the [Troubleshooting](tooling_troubleshooting.md) section of the documentation.
244244
You can also open a support ticket on [DevZone](https://devzone.nordicsemi.com) for further assistance.
245+
246+
## Next Steps
247+
248+
Now that you have the application running, you can:
249+
250+
* **Explore the architecture** - Learn about the modular design in the [Architecture](architecture.md) guide
251+
* **Configure the application** - Customize behavior using the [Configuration](configuration.md) guide
252+
* **Perform firmware updates** - Deploy new versions using the [Firmware Updates (FOTA)](fota.md) guide
253+
* **Customize functionality** - Add or modify features following the [Customization](customization.md) guide

0 commit comments

Comments
 (0)