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.

Each USB sample has its own unique Product ID. The USB maintainer, if one is assigned, or otherwise the Zephyr Technical Steering Committee, may allocate other USB Product IDs based on well-motivated and documented requests.

In the Zephyr documentation you will found a detailed and up to date list of USB Vendor and Product identifiers as they would be used for each single USB sample without manipulation by this snippet. This snippet should only be applied to applications similar to the Console over USB CDC ACM example, no other!

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.

USB manufacturer and product identification

VID

PID

Board

Manufacturer

Product

Specifications and requirements

Chosen

0x0483

0x5740

nucleo_f767zi

STMicroelectronics [9]

STM32F767ZI-NUCLEO (CDC ACM)

STMicroelectronics USB product ID from their Virtual COM Port [10]

0x1FC9

0x1011

mimxrt1010_evk

NXP Semiconductors [5]

MIMXRT1010-EVK (CDC ACM)

derived VID from part number MIMXRT1011DAE5A

0x1FC9

0x1062

mimxrt1060_evk@B/mimxrt1062/qspi
mimxrt1060_evk@A/mimxrt1062/qspi
mimxrt1060_evk@A/mimxrt1062/hyperflash

NXP Semiconductors [5]

MIMXRT1060-EVK (CDC ACM)

derived VID from part number MIMXRT1062DVL6A

0x2341

0x804D

arduino_zero

Arduino LLC [2]

Arduino Zero (CDC ACM)

Arduino USB product ID list with SAMD21 CPU [3]

0x2886

0x8026

seeeduino_lotus

Seeed LLC [7]

Seeeduino Lotus Cortex-M0+ (CDC ACM)

Seeeduino USB product ID list with SAMD21 CPU [8]

0x2886

0x8027

seeeduino_cm0

Seeed LLC [7]

Seeeduino Cortex-M0+ (CDC ACM)

Seeeduino USB product ID list with SAMD21 CPU [8]

0x2886

0x802F

seeeduino_xiao

Seeed LLC [7]

Seeeduino XIAO

Seeeduino USB product ID list with SAMD21 CPU [8]

0x2886

0x802F

xiao_samd21

Seeed Studio [7]

Seeeduino XIAO

Seeeduino USB product ID list with SAMD21 CPU [8]

0x2E8A

0x000A

cytron_maker_nano_rp2040

Cytron (Raspberry Pi) [4]

Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [6]

0x2E8A

0x000A

cytron_maker_pi_rp2040

Cytron (Raspberry Pi) [4]

Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [6]

0x2E8A

0x000A

rpi_pico

Raspberry Pi [4]

Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [6]

0x2E8A

0x000A

rpi_pico/rp2040/w

Raspberry Pi [4]

Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [6]

0x2E8A

0x000A

waveshare_rp2040_one

Waveshare (Raspberry Pi) [4]

Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [6]

0x2E8A

0x000A

waveshare_rp2040_zero

Waveshare (Raspberry Pi) [4]

Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [6]

0x2E8A

0x000A

waveshare_rp2040_matrix

Waveshare (Raspberry Pi) [4]

Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [6]

0x2E8A

0x000A

waveshare_rp2040_tiny

Waveshare (Raspberry Pi) [4]

Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [6]

0x2E8A

0x000A

waveshare_rp2040_eth

Waveshare (Raspberry Pi) [4]

Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [6]

0x2E8A

0x000A

waveshare_rp2040_lcd_0_96

Waveshare (Raspberry Pi) [4]

Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [6]

0x2E8A

0x000A

waveshare_rp2040_plus
waveshare_rp2040_plus@16MB

Waveshare (Raspberry Pi) [4]

Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [6]

0x2E8A

0x000A

waveshare_rp2040_geek

Waveshare (Raspberry Pi) [4]

Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [6]

0x2FE3

0x0004

Zephyr Project [1]

Console over USB CDC ACM

Zephyr USB Vendor and Product identifiers

How to add support of a new board

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";
     /* ... */
};

References