2017-07-13 00:48:29 +08:00
|
|
|
.. _usb_cdc-acm:
|
|
|
|
|
|
|
|
USB CDC ACM Sample Application
|
|
|
|
####################################
|
|
|
|
|
|
|
|
Overview
|
|
|
|
********
|
|
|
|
|
|
|
|
This sample app demonstrates use of a USB Communication Device Class (CDC)
|
|
|
|
Abstract Control Model (ACM) driver provided by the Zephyr project.
|
|
|
|
Received data from the serial port is echoed back to the same port
|
|
|
|
provided by this driver.
|
|
|
|
This sample can be found under :file:`samples/subsys/usb/cdc_acm` in the
|
|
|
|
Zephyr project tree.
|
|
|
|
|
|
|
|
Requirements
|
|
|
|
************
|
|
|
|
|
|
|
|
This project requires an USB device driver,
|
|
|
|
which is available for Intel Quark* SE SoC based boards like
|
|
|
|
:ref:`arduino_101`.
|
|
|
|
For the Arduino 101 board you need a USB to 3.3V TTL serial cable.
|
|
|
|
Connect it to UART1 as described in
|
|
|
|
:ref:`Connecting Serial Output section <arduino_101>`.
|
|
|
|
|
|
|
|
Building and Running
|
|
|
|
********************
|
|
|
|
|
|
|
|
Arduino 101
|
|
|
|
===========
|
|
|
|
|
|
|
|
To see the console output of the app, open a serial port emulator and
|
|
|
|
attach it to the USB to TTL Serial cable. Build and flash the project:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ cd samples/subsys/usb/cdc_acm
|
|
|
|
$ make BOARD=arduino_101 flash
|
|
|
|
|
|
|
|
See :ref:`Flashing the x86 Application Core section <arduino_101>` for details.
|
|
|
|
|
|
|
|
Running
|
|
|
|
=======
|
|
|
|
|
|
|
|
Plug the board into a host device, for example, a PC running Linux.
|
|
|
|
The board will be detected as shown by the Linux dmesg command:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
usb 9-1: new full-speed USB device number 112 using uhci_hcd
|
|
|
|
usb 9-1: New USB device found, idVendor=8086, idProduct=f8a1
|
|
|
|
usb 9-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
|
|
|
|
usb 9-1: Product: CDC-ACM
|
|
|
|
usb 9-1: Manufacturer: Intel
|
|
|
|
usb 9-1: SerialNumber: 00.01
|
|
|
|
cdc_acm 9-1:1.0: ttyACM1: USB ACM device
|
|
|
|
|
|
|
|
The app prints on serial output (UART1), used for the console:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
Wait for DTR
|
|
|
|
|
|
|
|
Open a serial port emulator, for example minicom
|
|
|
|
and attach it to detected CDC ACM device:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
minicom --device /dev/ttyACM1
|
|
|
|
|
|
|
|
The app should respond on serial output with:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
DTR set, start test
|
|
|
|
Baudrate detected: 115200
|
|
|
|
|
|
|
|
And on ttyACM device, provided by zephyr USB device stack:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
Send characters to the UART device
|
|
|
|
Characters read:
|
|
|
|
|
|
|
|
The characters entered in serial port emulator will be echoed back.
|
|
|
|
|
|
|
|
Troubleshooting
|
|
|
|
===============
|
|
|
|
|
|
|
|
If the ModemManager runs on your operating system, it will try
|
|
|
|
to access the CDC ACM device and maybe you can see several characters
|
|
|
|
including "AT" on the terminal attached to the CDC ACM device.
|
|
|
|
You can add or extend the udev rule for your Arduino 101 to inform
|
|
|
|
ModemManager to skip the CDC ACM device.
|
|
|
|
For this example, it would look like this:
|
|
|
|
|
|
|
|
.. code-block:: none
|
|
|
|
|
|
|
|
ATTRS{idVendor}=="8086" ATTRS{idProduct}=="f8a1", ENV{ID_MM_DEVICE_IGNORE}="1"
|
|
|
|
|
|
|
|
You can use
|
doc: fix uses of back quotes in documentation
ReST defines interpreted text roles where text enclosed by single quotes
can be "intrepreted", for example :ref:`some name` becomes a link to
a label anywhere in the doc set named "some name", :c:func:`funcname()`
becomes a link to the API documentation for "funcname", and
:option:`CONFIG_NAME` becomes a link to, in our case, the documentation
for the generated Kconfig option.
This patch fixes uses of `some name` (without a role) by either adding
an explicit role, or changing to ``some name``, which indicates inline
code block formatting (most likely what was intended).
This is a precursor to changing the default behavior of interpreted
text to treat `some name` as :any:`some name` (as configured in
doc/conf.py), which would attempt to create a link to any available
definition of "some name".
We may not change this default role behavior, but it becomes an option
after the fixes in this patch. In any case, this patch fixes incorrect
uses of single-quoted text (possibly introduced because GitHub's
markdown language uses single-quoted text for inline code formatting).
Jira: ZEP-2414
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-08-02 06:20:20 +08:00
|
|
|
``/lib/udev/rules.d/77-mm-usb-device-blacklist.rules`` as reference.
|