USB Console Snippet (usb-console)
west build -S usb-console [...]
Overview
This snippet redirects serial console output to a CDC ACM UART. The USB device which should be used is configured using Devicetree.
The interface for CDC ACM user is Universal Asynchronous Receiver-Transmitter (UART) driver API. But there are two important differences in behavior to a real UART controller:
Data transfer is only possible after the USB device stack has been initialized and started, until then any data is discarded
If device is connected to the host, it still needs an application on the host side which requests the data
The CDC ACM poll out implementation follows the API and blocks when the TX ring buffer is full only if the hw-flow-control property is enabled and called from a non-ISR context.
The devicetree compatible property for CDC ACM UART is
zephyr,cdc-acm-uart
.
CDC ACM support is automatically selected when USB device support is enabled
and a compatible node in the devicetree sources is present. If necessary,
CDC ACM support can be explicitly disabled by CONFIG_USB_CDC_ACM
.
About four CDC ACM UART instances can be defined and used,
limited by the maximum number of supported endpoints on the controller.
USB Vendor and Product identifiers
The USB Vendor ID for the Zephyr project is 0x2FE3
.
This USB Vendor ID must not be used when a vendor
integrates Zephyr USB device support into its own product.
Board specific identifiers
In the basic configuration, the standard Zephyr USB manufacturer and product identification is used. However, manufacturer defined values can also be specified as required.
Board |
VID |
PID |
Manufacturer |
Product |
Specifications and requirements |
Chosen |
---|---|---|---|---|---|---|
|
|
|
STMicroelectronics USB product ID from their Virtual COM Port [9] |
|||
|
|
|
derived VID from part number MIMXRT1011DAE5A |
|||
mimxrt1060_evk mimxrt1060_evkb mimxrt1060_evk_hyperflash |
|
|
derived VID from part number MIMXRT1062DVL6A |
|||
|
|
|
||||
|
|
|
||||
|
|
|
||||
|
|
|
Seeed XIAO M0 (CDC ACM), Seeeduino XIAO |
|||
|
|
|
XIAO SAMD21 (CDC ACM), Seeeduino XIAO |
|||
|
|
|
Maker Nano RP2040 (CDC ACM), Raspberry Pi Pico SDK CDC UART |
|||
|
|
|
Maker Pi RP2040 (CDC ACM), Raspberry Pi Pico SDK CDC UART |
|||
|
|
|
RPi Pico (CDC ACM), Raspberry Pi Pico SDK CDC UART |
|||
|
|
|
RPi Pico W (CDC ACM), Raspberry Pi Pico SDK CDC UART |
|||
|
|
|
RP2040-One (CDC ACM), Raspberry Pi Pico SDK CDC UART |
|||
|
|
|
RP2040-Zero (CDC ACM), Raspberry Pi Pico SDK CDC UART |
|||
|
|
|
RP2040-Matrix (CDC ACM), Raspberry Pi Pico SDK CDC UART |
|||
|
|
|
RP2040-Tiny (CDC ACM), Raspberry Pi Pico SDK CDC UART |
|||
|
|
|
RP2040-ETH (CDC ACM), Raspberry Pi Pico SDK CDC UART |
|||
|
|
|
RP2040-LCD-0.96 (CDC ACM), Raspberry Pi Pico SDK CDC UART |
|||
|
|
|
RP2040-Plus (CDC ACM), Raspberry Pi Pico SDK CDC UART |
|||
|
|
|
RP2040-Geek (CDC ACM), Raspberry Pi Pico SDK CDC UART |
|||
|
|
Zephyr Project |
Console over USB CDC ACM |
How to add support of a new board
add board configuration and devicetree overlay to this snippet;
which overwrites following options:
Requirements
Hardware support for:
A devicetree node with node label zephyr_udc0
that points to an enabled USB
device node with driver support. This should look roughly like this in
your devicetree:
zephyr_udc0: usbd@deadbeef {
compatible = "vnd,usb-device";
/* ... */
};