소스 검색

[Bug] RP2040: only clear RX FIFO for serial pio driver clear (#18581)

Stefan Kerkmann 2 년 전
부모
커밋
b6ea8837e4
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      platforms/chibios/drivers/vendor/RP/RP2040/serial_vendor.c

+ 4 - 3
platforms/chibios/drivers/vendor/RP/RP2040/serial_vendor.c

@@ -181,12 +181,13 @@ static inline void leave_rx_state(void) {}
 #endif
 
 /**
- * @brief Clear the RX and TX hardware FIFOs of the state machines.
+ * @brief Clear the FIFO of the RX state machine.
  */
 inline void serial_transport_driver_clear(void) {
     osalSysLock();
-    pio_sm_clear_fifos(pio, rx_state_machine);
-    pio_sm_clear_fifos(pio, tx_state_machine);
+    while (!pio_sm_is_rx_fifo_empty(pio, rx_state_machine)) {
+        pio_sm_clear_fifos(pio, rx_state_machine);
+    }
     osalSysUnlock();
 }