Skip to content

Commit

Permalink
feat(docs): Document adding USB logging to a standalone board (#2039)
Browse files Browse the repository at this point in the history
Currently this is only documented in the zephyr 3.0 upgrade blog. This explicitly documents it as well as when it doesn't need to be applied (i.e. when a mcu board is already in use).
  • Loading branch information
ReFil authored Nov 27, 2023
1 parent a3f30ee commit 84b9335
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/docs/development/usb-logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,32 @@ You should see tio printing `Disconnected` or `Connected` when you disconnect or
</Tabs>

From there, you should see the various log messages from ZMK and Zephyr, depending on which systems you have set to what log levels.

## Adding USB Logging to a Board

Standard boards such as the nice!nano and Seeeduino XIAO family have the necessary configuration for logging already added, however if you are developing your own standalone board you may wish to add the ability to use USB logging in the future.

To add USB logging to a board you need to define the USB CDC ACM device that the serial output gets piped to, as well as adding the console in the `chosen` node inside `<board>.dts`.

Inside the USB device (`&usbd`), add the CDC ACM node:

```dts
&usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
```

Then you can add the `zephyr,console` binding in the `chosen` node:

```dts
/ {
chosen {
...
zephyr,console = &cdc_acm_uart;
};
...
};
```

0 comments on commit 84b9335

Please sign in to comment.