summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-10-04 20:56:40 +0200
committerGitHub <noreply@github.com>2022-10-04 19:56:40 +0100
commitb6ea8837e4c81f364d30bdc74bf2cdccb2a1a185 (patch)
tree9d98fb8bf7ab2b65bfa30d573557937acc46c402
parent56f7b34289e7f80ac540a7c9c01a5c3a3838cd7c (diff)
[Bug] RP2040: only clear RX FIFO for serial pio driver clear (#18581)
-rw-r--r--platforms/chibios/drivers/vendor/RP/RP2040/serial_vendor.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/platforms/chibios/drivers/vendor/RP/RP2040/serial_vendor.c b/platforms/chibios/drivers/vendor/RP/RP2040/serial_vendor.c
index afd7e65ad8..dd4723a086 100644
--- a/platforms/chibios/drivers/vendor/RP/RP2040/serial_vendor.c
+++ b/platforms/chibios/drivers/vendor/RP/RP2040/serial_vendor.c
@@ -181,12 +181,13 @@ static inline void leave_rx_state(void) {}
181#endif 181#endif
182 182
183/** 183/**
184 * @brief Clear the RX and TX hardware FIFOs of the state machines. 184 * @brief Clear the FIFO of the RX state machine.
185 */ 185 */
186inline void serial_transport_driver_clear(void) { 186inline void serial_transport_driver_clear(void) {
187 osalSysLock(); 187 osalSysLock();
188 pio_sm_clear_fifos(pio, rx_state_machine); 188 while (!pio_sm_is_rx_fifo_empty(pio, rx_state_machine)) {
189 pio_sm_clear_fifos(pio, tx_state_machine); 189 pio_sm_clear_fifos(pio, rx_state_machine);
190 }
190 osalSysUnlock(); 191 osalSysUnlock();
191} 192}
192 193