diff --git a/esp-hal/src/dma/buffers.rs b/esp-hal/src/dma/buffers.rs index 54412b9451d..b96dc02af8b 100644 --- a/esp-hal/src/dma/buffers.rs +++ b/esp-hal/src/dma/buffers.rs @@ -345,6 +345,8 @@ pub enum TransferDirection { } /// Holds all the information needed to configure a DMA channel for a transfer. +#[derive(PartialEq, Eq, Debug)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct Preparation { /// The descriptor the DMA will start from. pub start: *mut DmaDescriptor, diff --git a/esp-hal/src/dma/mod.rs b/esp-hal/src/dma/mod.rs index 2862bf53b4a..e1421153854 100644 --- a/esp-hal/src/dma/mod.rs +++ b/esp-hal/src/dma/mod.rs @@ -1908,6 +1908,9 @@ where ) -> Result<(), DmaError> { debug_assert_eq!(preparation.direction, TransferDirection::In); + debug!("Preparing RX transfer {:?}", preparation); + trace!("First descriptor {:?}", unsafe { &*preparation.start }); + #[cfg(psram_dma)] if preparation.accesses_psram && !self.rx_impl.can_access_psram() { return Err(DmaError::UnsupportedMemoryRegion); @@ -2199,6 +2202,9 @@ where ) -> Result<(), DmaError> { debug_assert_eq!(preparation.direction, TransferDirection::Out); + debug!("Preparing TX transfer {:?}", preparation); + trace!("First descriptor {:?}", unsafe { &*preparation.start }); + #[cfg(psram_dma)] if preparation.accesses_psram && !self.tx_impl.can_access_psram() { return Err(DmaError::UnsupportedMemoryRegion); diff --git a/hil-test/tests/spi_full_duplex.rs b/hil-test/tests/spi_full_duplex.rs index 35179c81749..03bf1676bc7 100644 --- a/hil-test/tests/spi_full_duplex.rs +++ b/hil-test/tests/spi_full_duplex.rs @@ -204,6 +204,9 @@ mod tests { unit.channel0 .set_input_mode(EdgeMode::Hold, EdgeMode::Increment); + dma_rx_buf.set_length(TRANSFER_SIZE); + dma_tx_buf.set_length(TRANSFER_SIZE); + // Fill the buffer where each byte has 3 pos edges. dma_tx_buf.as_mut_slice().fill(0b0110_1010); @@ -242,6 +245,9 @@ mod tests { unit.channel0 .set_input_mode(EdgeMode::Hold, EdgeMode::Increment); + dma_rx_buf.set_length(TRANSFER_SIZE); + dma_tx_buf.set_length(TRANSFER_SIZE); + // Fill the buffer where each byte has 3 pos edges. dma_tx_buf.as_mut_slice().fill(0b0110_1010);