nrf: fix wrong order configuring gpios.

Docs say "PSEL.RXD, PSEL.RTS, PSEL.RTS, and PSEL.TXD must only be configured when the UARTE is disabled."
For some reason nrf52 doesn't care but nrf91 does.
This commit is contained in:
Dario Nieuwenhuis 2024-06-17 22:50:13 +02:00
parent 3c414e99cb
commit ef2f5f0417
2 changed files with 6 additions and 2 deletions

View File

@ -306,6 +306,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> {
U::Interrupt::pend();
unsafe { U::Interrupt::enable() };
U::regs().enable.write(|w| w.enable().enabled());
U::state().tx_rx_refcount.store(2, Ordering::Relaxed);
@ -407,6 +408,7 @@ impl<'d, U: UarteInstance> BufferedUarteTx<'d, U> {
U::Interrupt::pend();
unsafe { U::Interrupt::enable() };
U::regs().enable.write(|w| w.enable().enabled());
U::state().tx_rx_refcount.store(1, Ordering::Relaxed);
@ -604,6 +606,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarteRx<'d, U, T> {
U::Interrupt::pend();
unsafe { U::Interrupt::enable() };
U::regs().enable.write(|w| w.enable().enabled());
U::state().tx_rx_refcount.store(1, Ordering::Relaxed);

View File

@ -221,6 +221,7 @@ impl<'d, T: Instance> Uarte<'d, T> {
T::Interrupt::unpend();
unsafe { T::Interrupt::enable() };
r.enable.write(|w| w.enable().enabled());
let s = T::state();
s.tx_rx_refcount.store(2, Ordering::Relaxed);
@ -319,9 +320,7 @@ pub(crate) fn configure(r: &RegisterBlock, config: Config, hardware_flow_control
r.psel.cts.write(|w| w.connect().disconnected());
r.psel.rts.write(|w| w.connect().disconnected());
// Enable
apply_workaround_for_enable_anomaly(r);
r.enable.write(|w| w.enable().enabled());
}
impl<'d, T: Instance> UarteTx<'d, T> {
@ -369,6 +368,7 @@ impl<'d, T: Instance> UarteTx<'d, T> {
T::Interrupt::unpend();
unsafe { T::Interrupt::enable() };
r.enable.write(|w| w.enable().enabled());
let s = T::state();
s.tx_rx_refcount.store(1, Ordering::Relaxed);
@ -567,6 +567,7 @@ impl<'d, T: Instance> UarteRx<'d, T> {
T::Interrupt::unpend();
unsafe { T::Interrupt::enable() };
r.enable.write(|w| w.enable().enabled());
let s = T::state();
s.tx_rx_refcount.store(1, Ordering::Relaxed);