4.1.1 SET_LINE_CODING Command

The SET_LINE_CODING command configures the UART with the specified parameters.

Send this request through Endpoint 0x00, with the parameters described in the following table, to configure the UART baud rate, parity stop bits, and data width.

Note: Avoid issuing a SET_LINE_CODING request while the UART data transfer is in progress.
Table 4-2. SET_LINE_CODING - Command
Byte IndexCommandDescription
00x21bmRequestTypeHost to device
10x20

bRequest

(Command code)

Configure the UART baud rate, stop bits, parity, and data width
20x00wValue – lower byteReserved
30x00wValue – higher byte
40x00wIndex – lower byteInterface 0
50x00wIndex – higher byte
60x07wLength – lower bytePayload length in bytes
70x00wLength – higher byte
8L(dwBaud)dwBaud – lowest byteBaud rate in 32-bit hexadecimal format
9H1(dwBaud)dwBaud – higher byte
10H2(dwBaud)dwBaud – next higher byte
11H3(dwBaud)dwBaud – highest byte
12

0x00

0x02

1 Stop bit

2 Stop bits

Number of stop bits
13

0x00

0x01

0x02

No parity

Odd parity

Even parity

Data parity
14

0x05

0x06

0x07

0x08

5-bit(1) data width

6-bit data width

7-bit data width

8-bit data width

Data byte width
CAUTION: When the data width is set to five bits, the UART communication with no flow control may not operate properly beyond the baud rate of 921,600 bps.