AM261x MCU+ SDK: USB CDC Echo Example

| AM261x MCU+ SDK 26.00.00 |

USB CDC Echo Example

# Introduction

This example is a USB device CDC-ACM (Communication Device Class - Abstract Control Model) application based on USB CDC class from TinyUSB.

The example does the below

- Initializes the TinyUSB USB core driver and CDC class.
- Create two virtual COM ports visible to a USB host.
- Any alphabetic input from the USB host will be echo-ed back in lower case on one COM port and in upper case in the other COM port.

# USB Logging Template Example

- This example also demonstrates how to enable logging for USB using shared memory log feature.
  - The R5FSS0_0_freertos/nortos core will write logs in the shared memory and R5FSS0_1_freertos/nortos core will read and print it on UART0.
- see USB for more information on how to enable USB logs.
- see Debug for more information on how to enable shared memory log feature.

Note
  - Enabling logs in debug build may lead to unwanted behaviour as the application code is build with -O0 flag.
  - It is recommended to use release build when USB logging is enabled.

# Supported Combinations

Parameter | Value
--- | ---
CPU + OS | r5fss0-0_nortos
Toolchain | ti-arm-clang
iar-arm
Board | am261x-lp, am261x-som
Example folder | examples/usb/device/cdc_echo

# Steps to Run the Example

## Build the example

- When using CCS projects to build, import the CCS project for the required combination and build it using the CCS project menu (see Using SDK with CCS Projects).
- When using IAR EW projects to build, import the IAR EW workspace for the required combination and build it using the IAR EW project menu (see Using SDK with IAR Embedded Workbench Projects).
- When using makefiles to build, note the required combination and build using make command (see Using SDK with Makefiles)

## HW Setup

### AM261x-LP

- To test the application, one can use a Windows/Linux PC as a USB host.
- Connect the J10 on AM261x-LP to the USB host.

USB Micro B Device Connector

### AM261X-SOM

- To test the application, one can use a Windows/Linux PC as a USB host
- Connect the J7 on AM261x SOM to the USB host

USB Micro B Device Connector

## Run the example

- Launch a CCS or IAR EW debug session and run the executable, see CCS Launch, Load and Run or IAR Launch, Load and Run
- When the application is running, two COM ports will be enumerated on the USB host

### For Window 10

- The two enumerated COM ports can be displayed using the Device Manager on Windows 10,

COM ports (COM3 and COM4) displayed using Device Manager

- On USB host, use any serial port communication program, like Tera-Term, to connect to those two COM ports

Using Tera Term to connect to port 1

Using Tera Term to connect to port 2

- Type in any alphabetic characters, the lower case of the input will be displayed on one COM port and the upper case of the input will be displayed on the other COM port

Lower Case Input Echo-ed

Upper Case Input Echo-ed

### For Linux

- The two enumerated serial ports can be enumerated as "/dev/ttyACM0" and "/dev/ttyACM1"
- On Linux, one has to change the access right for those two serial ports as shown below.
- Then use any serial port communication program, like putty, to connect to those two serial ports

Using putty to connect to port 1

Using putty to connect to port 2

- Type in any alphabetic characters, the lower case of the input will be displayed on one COM port and the upper case of the input will be displayed on the other COM port

Lower Case Input Echo-ed

Upper Case Input Echo-ed

# See Also

USB