Ux_Device_CDC_ACM Application Description

This application provides an example of Azure RTOS USBX stack usage on NUCLEO-C071RB board, it shows how to develop USB Device communication Class “CDC_ACM” based application. The application is designed to emulate an USB-to-UART bridge following the Virtual COM Port (VCP) implementation, the code provides all required device descriptors framework and associated Class descriptor report to build a compliant USB CDC_ACM device. At the beginning ThreadX call the entry function tx_application_define(), at this stage, all USBx resources are initialized, the CDC_ACM Class driver is registered and the application creates 3 threads with the same priorities :

During enumeration phase, three communication pipes “endpoints” are declared in the CDC class implementation :

In this application, two requests are implemented:

- Set line: Set the bit rate, number of stop bits, parity, and number of data bits
- Get line: Get the bit rate, number of stop bits, parity, and number of data bits

The other requests (send break, control line state) are not implemented.

Expected success behavior

When plugged to PC host, the NUCLEO-C071RB must be properly enumerated as an USB Serial device and an STlink Com port. During the enumeration phase, the device must provide host with the requested descriptors (Device descriptor, configuration descriptor, string descriptors). Those descriptors are used by host driver to identify the device capabilities. Once NUCLEO-C071RB USB device successfully completed the enumeration phase, Open two hyperterminals (USB com port and UART com port(USB STLink VCP)) to send/receive data to/from host from/to device.

Error behaviors

Host PC shows that USB device does not operate as designed (CDC Device enumeration failed, PC and Device can not communicate over VCP ports).

Assumptions if any

User is familiar with USB 2.0 “Universal Serial BUS” specification and CDC_ACM class specification.

Known limitations

None.

Notes

ThreadX usage hints

Keywords

RTOS, ThreadX, USBX, USBXDevice, USB_DRD, Full Speed, CDC, VCP, USART, DMA.

Hardware and Software environment

How to use it ?

In order to make the program work, you must do the following :