Commit Graph

16 Commits

Author SHA1 Message Date
Timo Kröger
93780fa31d uarte: Wait for the peripheral to be disabled
Prevents a panic in the case of:
1. Abort a receive future
2. Free Uarte::free()
3. Uarte::new()
->  panicked at 'assertion failed: uarte.enable.read().enable().is_disabled()'
2021-01-04 22:55:40 +01:00
Timo Kröger
9b1f7b8a17 uarte: Enable peripheral with first poll
This fixes a lockup when a future is dropped before it was polled.
2021-01-04 22:55:40 +01:00
Timo Kröger
85ec9dd16f uarte: Be on safe side with potentially racy code
The PS does not specify how many cycles it takes for a STARTXX task to
generate a XXSTARTED event. I think it is instantaneous but let’s be on
the safe side for the following sequence:
1. poll() starttx
2. drop() txstarted not yet set, but future gets dropped
3. txstarted set by hardware, peripheral enabled after it was dropped
2021-01-04 22:55:40 +01:00
Timo Kröger
a3b3305b8e uarte: Only stop TX forcefully when a transmissions is running
This comes with insignificant power consumption improvements but makes
the code of the RX and TX case symmetric.
2021-01-04 22:55:40 +01:00
Timo Kröger
a7c03e4cb6 uarte: Only stop RX forcefully when a reception is running
The STOPRX task always triggers a timeout of ~55bit times until the
RXTO event is generated. Before we disabled the receiver only after
the timeout.
With this change the receiver is stopped right after reception has ended
because the DMA buffer is full.
For forced RX aborts like `stop()` or on drop still need to wait for the
RXTO event before disabling the receiver.
2021-01-04 22:55:40 +01:00
Timo Kröger
9f28c7ab8d uarte: Do not spin when stopping a receive future
Spinning on drop() is still required when the future has not been
stopped so that DMA finishes before the buffer is released.
2021-01-04 22:55:40 +01:00
Dario Nieuwenhuis
0ab88ea279 Add Uart trait, implement it for nrf. 2021-01-02 19:59:37 +01:00
Dario Nieuwenhuis
3c7e7220b3 Don't use embedded_dma in nrf uarte. 2021-01-02 19:14:54 +01:00
Timo Kröger
6695bf0f21 Low power UART driver 2020-12-30 19:24:12 +01:00
Dario Nieuwenhuis
267ec334ac Rename Uarte -> BufferedUarte 2020-12-28 23:57:50 +01:00
Dario Nieuwenhuis
6f76c0ebcc Add support for log+defmt again, but better. 2020-12-01 17:46:56 +01:00
Dario Nieuwenhuis
78135a81d9 Remove anyfmt 2020-11-27 18:42:59 +01:00
Dario Nieuwenhuis
0a3590566d Fix ambiguous assert 2020-11-01 17:56:29 +01:00
Dario Nieuwenhuis
5e8608c7a5 Make defmt optional with new anyfmt crate 2020-11-01 17:17:24 +01:00
Dario Nieuwenhuis
0643095695 Fix build with all nrf chip models 2020-10-31 23:03:09 +01:00
Dario Nieuwenhuis
9a57deef9b First commit 2020-09-22 18:03:43 +02:00