diff --git a/rp2040-hal/src/uart.rs b/rp2040-hal/src/uart.rs index 8f57f63..6b46788 100644 --- a/rp2040-hal/src/uart.rs +++ b/rp2040-hal/src/uart.rs @@ -221,6 +221,12 @@ impl UartPeripheral { let effective_baudrate = configure_baudrate(&mut device, &config.baudrate, &frequency)?; + device.uartlcr_h.write(|w| { + w.fen().set_bit(); + set_format(w, &config.data_bits, &config.stop_bits, &config.parity); + w + }); + // Enable the UART, both TX and RX device.uartcr.write(|w| { w.uarten().set_bit(); @@ -229,13 +235,6 @@ impl UartPeripheral { w }); - device.uartlcr_h.write(|w| { - w.fen().set_bit(); - - set_format(w, &config.data_bits, &config.stop_bits, &config.parity); - w - }); - device.uartdmacr.write(|w| { w.txdmae().set_bit(); w.rxdmae().set_bit();