From b82f1746ba427a77a6c229d9b7b769dabed37bf4 Mon Sep 17 00:00:00 2001 From: Jesse Braham Date: Tue, 7 Jan 2025 08:11:40 +0100 Subject: [PATCH] Only use `crate::interrupt:free` for ESP32 --- esp-hal/src/uart.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/esp-hal/src/uart.rs b/esp-hal/src/uart.rs index fe12fe2cfd..7ca3ed6cd9 100644 --- a/esp-hal/src/uart.rs +++ b/esp-hal/src/uart.rs @@ -863,7 +863,15 @@ where } if self.rx_fifo_count() > 0 { - let byte = crate::interrupt::free(|| fifo.read().rxfifo_rd_byte().bits()); + // https://docs.espressif.com/projects/esp-chip-errata/en/latest/esp32/03-errata-description/esp32/cpu-subsequent-access-halted-when-get-interrupted.html + cfg_if::cfg_if! { + if #[cfg(esp32)] { + let byte = crate::interrupt::free(|| fifo.read().rxfifo_rd_byte().bits()); + } else { + let byte = fifo.read().rxfifo_rd_byte().bits(); + } + } + Ok(byte) } else { Err(nb::Error::WouldBlock)