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.
| Byte Index | Command | Description | |
|---|---|---|---|
| 0 | 0x21 | bmRequestType | Host to device |
| 1 | 0x20 |
bRequest (Command code) | Configure the UART baud rate, stop bits, parity, and data width |
| 2 | 0x00 | wValue – lower byte | Reserved |
| 3 | 0x00 | wValue – higher byte | |
| 4 | 0x00 | wIndex – lower byte | Interface 0 |
| 5 | 0x00 | wIndex – higher byte | |
| 6 | 0x07 | wLength – lower byte | Payload length in bytes |
| 7 | 0x00 | wLength – higher byte | |
| 8 | L(dwBaud) | dwBaud – lowest byte | Baud rate in 32-bit hexadecimal format |
| 9 | H1(dwBaud) | dwBaud – higher byte | |
| 10 | H2(dwBaud) | dwBaud – next higher byte | |
| 11 | H3(dwBaud) | dwBaud – highest byte | |
| 12 |
|
1 Stop bit 2 Stop bits | Number of stop bits |
| 13 |
|
No parity Odd parity Even parity | Data parity |
| 14 |
|
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.
| |||
