• Home
  • Annotate
  • current directory
Name Date Size #Lines LOC

..22-Aug-2025-

src/22-Aug-2025-

CMakeLists.txt A D22-Aug-2025296 107

README.rst A D22-Aug-20252.8 KiB10369

app.overlay A D22-Aug-2025185 1210

prj.conf A D22-Aug-2025358 1312

sample.yaml A D22-Aug-2025133 87

README.rst

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