SPI DMA with STM32U5
Hi everyone,
I want to connect 2 stm32 via SPI DMA mode. My wish is that the master first sends 512 bytes of command to the slave, then the slave processes this data to respond to the master. On the master side, the delay between sending 512 command bytes and sending 512 dummy bytes is 10 (ms). As for the slave side, the delay time between receiving 512 command bytes and 512 dummy bytes from the master is 5 (ms), but currently the system is not working as I want when the slave cannot respond data to the master the second time it receives a clock pulse from the master.
P/s: on the slave side I use SPI DMA mode and on the master side I use SPI Polling. I tried to change the delay time between transmission and reception on both the master and slave sides but all failed. I think the problem is that I call the HAL_SPI_TransmitReceive_DMA function twice within the while loop, do I need to disable DMA after the first receive and re-enable DMA to call the HAL_SPI_TransmitReceive_DMA function again the second time? I have attached the test code in the main function of both slave and master below:
Master:

Slave:

