Preserving SPI data in DMA circular mode
I'm trying to establish communication between a Raspberry Pi and an STM32F407. The Pi is Master and the F407 is a full duplex slave. The SPI is configured with circular mode DMA. When the data is sent from the Pi, I do receive it at the F407. However, the moment that transaction ends, the receive buffer in the F407 becomes 0x00 again wiping away all received data. I'm guessing this is because of the circular DMA?
I tried creating a copy of the original receive buffer in the HAL_SPI_TxRxCpltCallback function but that did not work. It seems to get called after the If I configure the DMA in normal mode, the SPI transaction runs once and then stops whereas I want it to run continuously in the background.
How do I solve this?