diff options
| author | MDLZCOOL <[email protected]> | 2025-12-13 23:40:53 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2025-12-14 08:51:51 +0800 |
| commit | b1ca0406a539d9e54c9e2da27e87897fe14f4301 (patch) | |
| tree | 8462d64c28db04535eebf282750013beafdd5919 | |
| parent | 799ae48f7c39dcd1e64a80e01ee982aa268a81dc (diff) | |
fix(usbh_ch34x): program baudrate registers after divisor calculation
| -rw-r--r-- | class/serial/usbh_ch34x.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/class/serial/usbh_ch34x.c b/class/serial/usbh_ch34x.c index 2bc3df10..4e31a1af 100644 --- a/class/serial/usbh_ch34x.c +++ b/class/serial/usbh_ch34x.c @@ -240,15 +240,14 @@ static int usbh_ch34x_set_line_coding(struct usbh_serial *serial, struct cdc_lin reg_value |= CH341_L_SB; } - reg_value |= 0xC0; + usbh_ch34x_get_baudrate_div(line_coding->dwDTERate, &factor, &divisor); + reg_value |= 0xC0; value |= 0x9c; value |= reg_value << 8; index |= 0x80 | divisor; index |= (uint16_t)factor << 8; - usbh_ch34x_get_baudrate_div(line_coding->dwDTERate, &factor, &divisor); - return usbh_ch34x_control_out(serial, CH34X_SERIAL_INIT, value, index); } |
