This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 22949419146c6a0447f38ff79914f8be6042e5ea
Author: raiden00pl <[email protected]>
AuthorDate: Wed Nov 18 11:31:44 2026 +0100

    arch/arm/stm32: Invalidate the SPI v5 RX buffer after the DMA transfer.
    
    The CPU can fetch RX buffer lines into the D-cache while the DMA
    writes them.  Invalidate the buffer again when the transfer is done,
    as the STM32H7 SPI driver does.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: raiden00pl <[email protected]>
---
 arch/arm/src/common/stm32/stm32_spi_v5.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/src/common/stm32/stm32_spi_v5.c 
b/arch/arm/src/common/stm32/stm32_spi_v5.c
index ab1e958f076..a284ec0444f 100644
--- a/arch/arm/src/common/stm32/stm32_spi_v5.c
+++ b/arch/arm/src/common/stm32/stm32_spi_v5.c
@@ -2413,6 +2413,14 @@ static int  spi_exchange_dma(struct spi_dev_s *dev, 
const void *txbuffer,
                           SPI_CFG1_RXDMAEN, 0);
       spi_enable(priv, true);
 
+      /* Force RAM re-read */
+
+      if (rxbuffer)
+        {
+          up_invalidate_dcache((uintptr_t)rxbuffer,
+                               (uintptr_t)rxbuffer + nbytes);
+        }
+
       /* Second copy: Copy the DMA internal buffer to caller's buffer */
 
       if (orig_rxbuffer && priv->rxbuf)

Reply via email to