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.

USB manufacturer and product identification

Board

VID

PID

Manufacturer

Product

Specifications and requirements

Chosen

nucleo_f767zi

0x0483

0x5740

STMicroelectronics [8]

STM32F767ZI-NUCLEO (CDC ACM)

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

mimxrt1010_evk

0x1FC9

0x1011

NXP Semiconductors [4]

MIMXRT1010-EVK (CDC ACM)

derived VID from part number MIMXRT1011DAE5A

mimxrt1060_evk
mimxrt1060_evkb
mimxrt1060_evk_hyperflash

0x1FC9

0x1062

NXP Semiconductors [4]

MIMXRT1060-EVK (CDC ACM)

derived VID from part number MIMXRT1062DVL6A

arduino_zero

0x2341

0x804D

Arduino LLC [1]

Arduino Zero (CDC ACM)

Arduino USB product ID list with SAMD21 CPU [2]

seeeduino_lotus

0x2886

0x8026

Seeed LLC [6]

Seeeduino Lotus Cortex-M0+ (CDC ACM)

Seeeduino USB product ID list with SAMD21 CPU [7]

seeeduino_cm0

0x2886

0x8027

Seeed LLC [6]

Seeeduino Cortex-M0+ (CDC ACM)

Seeeduino USB product ID list with SAMD21 CPU [7]

seeeduino_xiao

0x2886

0x802F

Seeed LLC [6]

Seeed XIAO M0 (CDC ACM), Seeeduino XIAO

Seeeduino USB product ID list with SAMD21 CPU [7]

xiao_samd21

0x2886

0x802F

Seeed Studio [6]

XIAO SAMD21 (CDC ACM), Seeeduino XIAO

Seeeduino USB product ID list with SAMD21 CPU [7]

cytron_maker_nano_rp2040

0x2E8A

0x000A

Cytron (Raspberry Pi) [3]

Maker Nano RP2040 (CDC ACM), Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [5]

cytron_maker_pi_rp2040

0x2E8A

0x000A

Cytron (Raspberry Pi) [3]

Maker Pi RP2040 (CDC ACM), Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [5]

rpi_pico

0x2E8A

0x000A

Raspberry Pi [3]

RPi Pico (CDC ACM), Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [5]

rpi_pico/rp2040/w

0x2E8A

0x000A

Raspberry Pi [3]

RPi Pico W (CDC ACM), Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [5]

waveshare_rp2040_one

0x2E8A

0x000A

Waveshare (Raspberry Pi) [3]

RP2040-One (CDC ACM), Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [5]

waveshare_rp2040_zero

0x2E8A

0x000A

Waveshare (Raspberry Pi) [3]

RP2040-Zero (CDC ACM), Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [5]

waveshare_rp2040_matrix

0x2E8A

0x000A

Waveshare (Raspberry Pi) [3]

RP2040-Matrix (CDC ACM), Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [5]

waveshare_rp2040_tiny

0x2E8A

0x000A

Waveshare (Raspberry Pi) [3]

RP2040-Tiny (CDC ACM), Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [5]

waveshare_rp2040_eth

0x2E8A

0x000A

Waveshare (Raspberry Pi) [3]

RP2040-ETH (CDC ACM), Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [5]

waveshare_rp2040_lcd_0_96

0x2E8A

0x000A

Waveshare (Raspberry Pi) [3]

RP2040-LCD-0.96 (CDC ACM), Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [5]

waveshare_rp2040_plus

0x2E8A

0x000A

Waveshare (Raspberry Pi) [3]

RP2040-Plus (CDC ACM), Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [5]

waveshare_rp2040_geek

0x2E8A

0x000A

Waveshare (Raspberry Pi) [3]

RP2040-Geek (CDC ACM), Raspberry Pi Pico SDK CDC UART

Raspberry Pi USB product ID list [5]

0x2FE3

0x0004

Zephyr Project

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