feat: move odfu example from note-outboard-dfu and update readmes by rdlauer · Pull Request #177 · blues/note-python · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/hil-circuitpython.yml
2 changes: 1 addition & 1 deletion .github/workflows/hil-micropython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
MPY_BOARD: ${{matrix.MPY_BOARD}}
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v7

- name: Set Environment Variables
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ jobs:
--header 'Content-Type: application/json' \
--header 'X-Session-Token: ${{ secrets.NOTEHUB_SESSION_TOKEN }}' \
--data '{"req":"note.add","file":"build_results.qi","body":{"result":"building"}}'
- uses: actions/checkout@v3
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install pipenv
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
fetch-depth: 0 # setuptools-scm needs full git history
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-notecard-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
update-notecard-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Set up Python 3.12
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: 3.12

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ library with:
- [RaspberryPi](examples/notecard-basics/rpi_example.py)
- [CircuitPython](examples/notecard-basics/cpy_example.py)
- [MicroPython](examples/notecard-basics/mpy_example.py)
- [Notecard Outboard Firmware Update](examples/outboard-dfu/circuit-python/code.py)

## Contributing

Expand Down
51 changes: 51 additions & 0 deletions examples/outboard-dfu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Notecard Outboard Firmware Update Example

This example demonstrates [Notecard Outboard Firmware Update][odfu], which lets
you update a host MCU's firmware over-the-air from Notehub with no host code
required to perform the download. The Notecard receives the new firmware image
and reprograms the host over the DFU signals on a Notecarrier F.

The [`circuit-python/code.py`](circuit-python/code.py) sample:

1. Configures the Notecard to enable Outboard Firmware Update for the host
(`card.dfu`, `card.aux`, and `dfu.status`).
2. Blinks the built-in LED with a recognizable pattern. This is the "payload"
you update over-the-air.

This example targets the [Blues Swan][swan] on a
[Notecarrier F][notecarrier-f]. Cygnet does not support CircuitPython.

## Prerequisites

- A [Blues Swan][swan] running CircuitPython
- A [Notecarrier F][notecarrier-f] with a [Notecard][notecard]
- A [Notehub](https://notehub.io) account and project
- The `notecard` package copied into the `lib/notecard` directory of your
device (copy the contents of this repo's `notecard/` directory), as described
in the repo [README](../../README.md)

## Running the example

1. Set the `ProductUID` on your Notecard (via the [in-browser terminal][repl]
or the [Notecard CLI][cli]) so it reports to your Notehub project, or set
`productUID` in `code.py`.
2. Copy `circuit-python/code.py` to your Swan (CircuitPython auto-runs `code.py`
on boot). The LED will blink and the Notecard will report firmware version
`1.0.0` to Notehub.

## Demonstrating an over-the-air update

1. In `code.py`, change `BLINK_DELAY` (for example to `0.1` for a fast blink)
and bump `FIRMWARE_VERSION` (for example to `2.0.0`).
2. Build a firmware image and upload it to Notehub, then apply the DFU action
to the host. See the [Outboard Firmware Update guide][odfu] for the full
build-and-upload walkthrough.
3. Once the update is applied, the LED blink speed changes and Notehub reports
the new firmware version — confirming the over-the-air update succeeded.

[odfu]: https://dev.blues.io/notehub/host-firmware-updates/notecard-outboard-firmware-update/
[swan]: https://shop.blues.com/collections/feather-mcu/products/swan
[notecard]: https://shop.blues.io/collections/notecard
[notecarrier-f]: https://shop.blues.io/collections/notecarrier/products/notecarrier-f
[repl]: https://dev.blues.io/terminal/
[cli]: https://dev.blues.io/tools-and-sdks/notecard-cli/
74 changes: 74 additions & 0 deletions examples/outboard-dfu/circuit-python/code.py