2025-07-17 1:42 PM
I'm looking for some guidance on using DMA with SPI. I have the M4 core on an STM32H755 set up as a master in full duplex mode, and as long as I invoke the SPI transfer using interrupts, the program runs fine. When I try to migrate to DMA, however, I note that the program is successful on the first pass only, triggering the callback, etc., but on the second time through, I always get an error, apparently because the transmit is still busy (?) I have used SPI and DMA often before without incident, but I don't know what else to check in this case. Any insights are appreciated. See the screen shots of where the code is finally failing. Line 2508 is in the HAL SPI driver C file, the point at which the driver attempts to start the DMA with IT, and the second shot shows the result of this call in the HAL DMA file, line 695.
Thanks
Solved! Go to Solution.
2025-07-18 1:28 AM
Hello @VO
It appears that the DMA peripheral is currently engaged with another task or has not been properly unlocked after the initial SPI DMA transfer. I recommend investigating the following areas:
2025-07-18 1:28 AM
Hello @VO
It appears that the DMA peripheral is currently engaged with another task or has not been properly unlocked after the initial SPI DMA transfer. I recommend investigating the following areas:
2025-07-18 9:20 AM
Thank you. It seems there was something interfering with the transfer complete flag, or else, as you mentioned, the unlock was not working correctly. It is hard to say which, so I essentially started fresh from a known good state and now the DMA is working as it should.