Skip to content

Commit

Permalink
README: document DFU mode
Browse files Browse the repository at this point in the history
Add instructions for how to use MCUboot for USB Device Firmware Upgrade
(DFU) mode.

Signed-off-by: Henrik Brix Andersen <[email protected]>
  • Loading branch information
henrikbrixandersen committed Oct 18, 2024
1 parent 34ae380 commit 3f9276f
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ The CANnectivity firmware supports the following features, some of which depend
- CAN bus error reporting
- Automatic gs_usb driver loading under Linux using custom [udev rules](99-cannectivity.rules)
- Automatic WinUSB driver installation under Microsoft Windows 8.1 and newer
- USB Device Firmware Upgrade (DFU) mode

## Hardware Requirements

Expand Down Expand Up @@ -98,6 +99,38 @@ provided. These can be selected by setting either `FILE_SUFFIX=usbd_next` or

After building, the firmware can be flashed to the board by running the `west flash` command.

## USB Device Firmware Upgrade (DFU) Mode

CANnectivity supports USB Device Firmware Upgrade
([DFU](https://docs.zephyrproject.org/latest/services/device_mgmt/dfu.html)) via the
[MCUboot](https://www.trustedfirmware.org/projects/mcuboot/) bootloader. This is intended for use
with boards without an on-board programmer.

To build CANnectivity with MCUboot integration for USB DFU use
[sysbuild](https://docs.zephyrproject.org/latest/build/sysbuild/index.html) with the
`sysbuild-dfu.conf` configuration file when building for your board (here `frdm_k64f`):

```shell
west build -b frdm_k64f/mk64f12 --sysbuild ../custom/cannectivity/app/ -- -DSB_CONF_FILE=sysbuild-dfu.conf
```

After building, MCUboot and the CANnectivity firmware can be flashed to the board by running the
`west flash` command.

Subsequent CANnectivity firmware updates can be applied via USB DFU. In order to do so, the board
must first be booted into USB DFU mode. If your board has a dedicated DFU button (identified by the
`mcuboot-button0` devicetree alias) press and hold it for 5 seconds or press and hold the button
while powering up the board. If your board has a DFU LED (identified by the `mcuboot-led0`
devicetree alias), the LED will flash while the DFU button is being held and change to constant on
once DFU mode is activated. Refer to your board documentation for further details.

Once in DFU mode, the CANnectivity firmware can be updated using
[dfu-util](https://dfu-util.sourceforge.net/):

```shell
dfu-util -a 1 build/app/zephyr/zephyr.signed.bin.dfu
```

## CANnectivity as a Zephyr Module

The CANnectivity firmware repository is a [Zephyr
Expand Down

0 comments on commit 3f9276f

Please sign in to comment.