Merge pull request #177 from blues/add-outboard-dfu-example · blues/note-python@0279d21 · GitHub
Skip to content

Commit 0279d21

Browse files
authored
Merge pull request #177 from blues/add-outboard-dfu-example
feat: move odfu example from note-outboard-dfu and update readmes
2 parents b3076f9 + 6039039 commit 0279d21

8 files changed

Lines changed: 134 additions & 8 deletions

File tree

.github/workflows/hil-circuitpython.yml

Lines changed: 1 addition & 1 deletion

.github/workflows/hil-micropython.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
MPY_BOARD: ${{matrix.MPY_BOARD}}
4949
steps:
5050
- name: Checkout Code
51-
uses: actions/checkout@v3
51+
uses: actions/checkout@v7
5252

5353
- name: Set Environment Variables
5454
run: |

.github/workflows/python-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ jobs:
4141
--header 'Content-Type: application/json' \
4242
--header 'X-Session-Token: ${{ secrets.NOTEHUB_SESSION_TOKEN }}' \
4343
--data '{"req":"note.add","file":"build_results.qi","body":{"result":"building"}}'
44-
- uses: actions/checkout@v3
44+
- uses: actions/checkout@v7
4545
- name: Set up Python ${{ matrix.python-version }}
46-
uses: actions/setup-python@v5
46+
uses: actions/setup-python@v6
4747
with:
4848
python-version: ${{ matrix.python-version }}
4949
- name: Install pipenv

.github/workflows/python-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ jobs:
1212
deploy:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v7
1616
with:
1717
fetch-depth: 0 # setuptools-scm needs full git history
1818
- name: Set up Python
19-
uses: actions/setup-python@v5
19+
uses: actions/setup-python@v6
2020
with:
2121
python-version: '3.x'
2222
- name: Install dependencies

.github/workflows/update-notecard-schema.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
update-notecard-api:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v7
1515

1616
- name: Set up Python 3.12
17-
uses: actions/setup-python@v5
17+
uses: actions/setup-python@v6
1818
with:
1919
python-version: 3.12
2020

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ library with:
141141
- [RaspberryPi](examples/notecard-basics/rpi_example.py)
142142
- [CircuitPython](examples/notecard-basics/cpy_example.py)
143143
- [MicroPython](examples/notecard-basics/mpy_example.py)
144+
- [Notecard Outboard Firmware Update](examples/outboard-dfu/circuit-python/code.py)
144145

145146
## Contributing
146147

examples/outboard-dfu/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Notecard Outboard Firmware Update Example
2+
3+
This example demonstrates [Notecard Outboard Firmware Update][odfu], which lets
4+
you update a host MCU's firmware over-the-air from Notehub with no host code
5+
required to perform the download. The Notecard receives the new firmware image
6+
and reprograms the host over the DFU signals on a Notecarrier F.
7+
8+
The [`circuit-python/code.py`](circuit-python/code.py) sample:
9+
10+
1. Configures the Notecard to enable Outboard Firmware Update for the host
11+
(`card.dfu`, `card.aux`, and `dfu.status`).
12+
2. Blinks the built-in LED with a recognizable pattern. This is the "payload"
13+
you update over-the-air.
14+
15+
This example targets the [Blues Swan][swan] on a
16+
[Notecarrier F][notecarrier-f]. Cygnet does not support CircuitPython.
17+
18+
## Prerequisites
19+
20+
- A [Blues Swan][swan] running CircuitPython
21+
- A [Notecarrier F][notecarrier-f] with a [Notecard][notecard]
22+
- A [Notehub](https://notehub.io) account and project
23+
- The `notecard` package copied into the `lib/notecard` directory of your
24+
device (copy the contents of this repo's `notecard/` directory), as described
25+
in the repo [README](../../README.md)
26+
27+
## Running the example
28+
29+
1. Set the `ProductUID` on your Notecard (via the [in-browser terminal][repl]
30+
or the [Notecard CLI][cli]) so it reports to your Notehub project, or set
31+
`productUID` in `code.py`.
32+
2. Copy `circuit-python/code.py` to your Swan (CircuitPython auto-runs `code.py`
33+
on boot). The LED will blink and the Notecard will report firmware version
34+
`1.0.0` to Notehub.
35+
36+
## Demonstrating an over-the-air update
37+
38+
1. In `code.py`, change `BLINK_DELAY` (for example to `0.1` for a fast blink)
39+
and bump `FIRMWARE_VERSION` (for example to `2.0.0`).
40+
2. Build a firmware image and upload it to Notehub, then apply the DFU action
41+
to the host. See the [Outboard Firmware Update guide][odfu] for the full
42+
build-and-upload walkthrough.
43+
3. Once the update is applied, the LED blink speed changes and Notehub reports
44+
the new firmware version — confirming the over-the-air update succeeded.
45+
46+
[odfu]: https://dev.blues.io/notehub/host-firmware-updates/notecard-outboard-firmware-update/
47+
[swan]: https://shop.blues.com/collections/feather-mcu/products/swan
48+
[notecard]: https://shop.blues.io/collections/notecard
49+
[notecarrier-f]: https://shop.blues.io/collections/notecarrier/products/notecarrier-f
50+
[repl]: https://dev.blues.io/terminal/
51+
[cli]: https://dev.blues.io/tools-and-sdks/notecard-cli/
Lines changed: 74 additions & 0 deletions

0 commit comments

Comments
 (0)