Serial Port Complete - Latest Microcontroller projects

(lily) #1

Chapter 16


on an internal serial port. On a USB virtual COM-port device, the host must
send a request in a control transfer to perform these actions.

$  $ #


Figure 16-1 shows descriptors for a typical generic, full-speed COM-port device
that supports the abstract control model. The descriptors identify the device as
a CDC device with two interfaces. The communication interface names the
abstract control model subclass and defines an interrupt IN endpoint for send-
ing notifications. The data interface defines two bulk endpoints for exchanging
COM-port data.
Table 16-3 shows a complete set of descriptors for this type of device. For a
high-speed device, the descriptors are much the same except the bulk endpoints
must use wMaxPacketSize = 512 instead of 64. Devices that support both full
and high speeds have additional descriptors that inform the host about device
characteristics and behavior when using the speed that isn’t currently selected.

 8  $


In the example device descriptor, bDeviceClass = 02h to indicate that the device
belongs to the communication devices class. Windows uses the values of idVen-
dor and idProduct to identify drivers for the device. All devices with the same
idVendor and idProduct pair should use the same driver on the host.
The descriptor includes three string indexes (iProduct, iManufacturer, and iSer-
ialNumber). Each index references a string descriptor. String descriptors are
optional, but a serial-number string referenced by iSerialNumber is recom-
mended for virtual COM-port devices. If there is no string, the string index is
zero.

 3 
 $


The configuration descriptor indicates how the device uses power. In the exam-
ple descriptor, the device is bus powered and doesn’t support the remote
wakeup feature. The bNumInterfaces field indicates that the configuration has
two interfaces. The wTotalLength field is the number of bytes in the configura-
tion descriptor and all subordinate descriptors, including interface descriptors
and any class-specific and endpoint descriptors for the interfaces, but not
including string descriptors. When the host computer requests a configuration
Free download pdf