• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

src/11-Mar-2024-219160

CMakeLists.txtD11-Mar-2024224 96

README.rstD11-Mar-20242.6 KiB9967

app.overlayD11-Mar-2024174 1210

nucleo_f413zh_dwc2.overlayD11-Mar-2024618 3127

overlay-composite-cdc-dfu.confD11-Mar-2024395 145

overlay-composite-cdc-msc.confD11-Mar-2024141 62

prj.confD11-Mar-2024320 1211

ramdisk.overlayD11-Mar-2024222 1513

sample.yamlD11-Mar-20241,004 4544

usbd_next_prj.confD11-Mar-2024200 118

README.rst

1.. zephyr:code-sample:: usb-cdc-acm
2   :name: USB CDC-ACM
3   :relevant-api: usbd_api _usb_device_core_api
4
5   Use USB CDC-ACM driver to implement a serial port echo.
6
7Overview
8********
9
10This sample app demonstrates use of a USB Communication Device Class (CDC)
11Abstract Control Model (ACM) driver provided by the Zephyr project.
12Received data from the serial port is echoed back to the same port
13provided by this driver.
14This sample can be found under :zephyr_file:`samples/subsys/usb/cdc_acm` in the
15Zephyr project tree.
16
17Requirements
18************
19
20This project requires an USB device driver, which is available for multiple
21boards supported in Zephyr.
22
23Building and Running
24********************
25
26Reel Board
27===========
28
29To see the console output of the app, open a serial port emulator and
30attach it to the USB to TTL Serial cable. Build and flash the project:
31
32.. zephyr-app-commands::
33   :zephyr-app: samples/subsys/usb/cdc_acm
34   :board: reel_board
35   :goals: flash
36   :compact:
37
38Running
39=======
40
41Plug the board into a host device, for example, a PC running Linux.
42The board will be detected as shown by the Linux dmesg command:
43
44.. code-block:: console
45
46   usb 9-1: new full-speed USB device number 112 using uhci_hcd
47   usb 9-1: New USB device found, idVendor=8086, idProduct=f8a1
48   usb 9-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
49   usb 9-1: Product: CDC-ACM
50   usb 9-1: Manufacturer: Intel
51   usb 9-1: SerialNumber: 00.01
52   cdc_acm 9-1:1.0: ttyACM1: USB ACM device
53
54The app prints on serial output (UART1), used for the console:
55
56.. code-block:: console
57
58   Wait for DTR
59
60Open a serial port emulator, for example minicom
61and attach it to detected CDC ACM device:
62
63.. code-block:: console
64
65   minicom --device /dev/ttyACM1
66
67The app should respond on serial output with:
68
69.. code-block:: console
70
71   DTR set, start test
72   Baudrate detected: 115200
73
74And on ttyACM device, provided by zephyr USB device stack:
75
76.. code-block:: console
77
78   Send characters to the UART device
79   Characters read:
80
81The characters entered in serial port emulator will be echoed back.
82
83Troubleshooting
84===============
85
86If the ModemManager runs on your operating system, it will try
87to access the CDC ACM device and maybe you can see several characters
88including "AT" on the terminal attached to the CDC ACM device.
89You can add or extend the udev rule for your board to inform
90ModemManager to skip the CDC ACM device.
91For this example, it would look like this:
92
93.. code-block:: none
94
95   ATTRS{idVendor}=="8086" ATTRS{idProduct}=="f8a1", ENV{ID_MM_DEVICE_IGNORE}="1"
96
97You can use
98``/lib/udev/rules.d/77-mm-usb-device-blacklist.rules`` as reference.
99