RZT Flexible Software Package Documentation
Release v2.1.0
|
|
This module provides a USB Peripheral Communications Device Class Driver (PCDC). It implements the USB PCDC Interface.
Refer to USB (r_usb_basic) for the common API (r_usb_basic) to be called from the application.
The r_usb_pcdc module combines with the r_usb_basic module to provide a USB Peripheral Communications Device Class (PCDC) driver. The PCDC driver conforms to Abstract Control Model of the USB Communications Device Class (CDC) specification and enables communication with a CDC host device.
The r_usb_pcdc module has the following key features:
Configuration | Options | Default | Description |
---|---|---|---|
Bulk In Pipe |
| USB PIPE1 | Select the USB pipe to use for bulk input transfers. |
Bulk Out Pipe |
| USB PIPE2 | Select the USB pipe to use for bulk output transfers. |
Interrupt Out Pipe |
| USB PIPE6 | Select the USB pipe to use for interrupts. |
Configuration | Options | Default | Description |
---|---|---|---|
Name | Name must be a valid C symbol | g_pcdc0 | Module name. |
Refer to the USB (r_usb_basic) module.
Refer to the USB (r_usb_basic) module.
The Abstract Control Model subclass of CDC is a technology that bridges the gap between USB devices and earlier modems (employing RS-232C connections), enabling use of application programs designed for older modems.
This driver notifies the application when receiving the following class requests:
Request | Code | Description |
---|---|---|
SetLineCoding | 0x20 | Sets communication line settings (bitrate, data length, parity, and stop bit length) |
GetLineCoding | 0x21 | Acquires the communication line setting state |
SetControlLineState | 0x22 | Set communication line control signals (RTS, DTR) |
The data format of supported class requests is described below:
bmRequestType | bRequest | wValue | wIndex | wLength | Data |
---|---|---|---|---|---|
0x21 | SET_LINE_CODING (0x20) | 0x0000 | 0x0000 | 0x0007 | usb_pcdc_linecoding_t |
0xA1 | GET_LINE_CODING (0x21) | 0x0000 | 0x0000 | 0x0007 | usb_pcdc_linecoding_t |
0x21 | SET_CONTROL_LINE_STATE (0x22) | usb_pcdc_ctrllinestate_t | 0x0000 | 0x0000 | None |
The following class notifications are supported:
Notification | Code | Description |
---|---|---|
SERIAL_STATE | 0x20 | Notification of serial line state |
The data types returned are as follows:
bmRequestType | bRequest | wValue | wIndex | wLength | Data |
---|---|---|---|---|---|
0xA1 | SERIAL_STATE (0x20) | 0x0000 | 0x0000 | 0x0002 | usb_serial_state_bitmap_t |
When connected to a PC the CDC device can be used as a virtual COM port. After enumeration, the CDC class requests GetLineCoding and SetControlLineState are executed by the target, and the CDC device is registered in Windows Device Manager as a virtual COM device.
Registering the CDC device as a virtual COM-port in Windows Device Manager enables data communication with the CDC device via a terminal app such as PuTTY. When changing settings of the serial port in the terminal application, the UART setting is propagated to the firmware via the class request SetLineCoding.
Data input (or file transmission) from the terminal app window is transmitted to the board using endpoint 2 (EP2); data from the board side is transmitted to the PC using EP1.
When the last packet of data received is the maximum packet size, and the terminal determines that there is continuous data, the received data may not be displayed in the terminal. If the received data is smaller than the maximum packet size, the data received up to that point is displayed in the terminal.
The main functions of the PCDC loopback example are as follows:
A template for PCDC descriptors can be found in ra/fsp/src/r_usb_pcdc/r_usb_pcdc_descriptor.c.template. Also, please be sure to use your vendor ID.