cancel
Showing results for 
Search instead for 
Did you mean: 

Need SPI example with DMA mode for STM32F411

contact239955_stm1
Associate II
Posted on April 17, 2017 at 09:01

Does anyone have some example code for the STM32F411VE to allow me to use the function 'HAL_SPI_TransmitReceive_DMA'?

I had a look through the ST examples and none of them seemed to use this code. If someone has some sample code or can point me in the direction of some ST supplied sample code, that would be great. I'm struggling to understand how it is supposed to work, and particularly which callback I'm supposed to grab - and how.

#stm32f411ve #dma
3 REPLIES 3
Max
ST Employee
Posted on April 17, 2017 at 09:37

Did you have a look at the SPI_FullDuplex_ComDMA example available in the CubeF4 package for most of the DISCOVERY boards?

Posted on April 17, 2017 at 10:01

I thought I had, I guess I havent! I'll have another look - thanks! 

Sorry about the apparently silly question, it has been a long project, particularly being my first with ARM devices.

Posted on April 17, 2017 at 10:38

Hey mate,

I remember why I wasn't completely happy with that example. After the DMA command, it polls a flag to identify when the transmission is complete. I was hoping to implement the 

HAL_SPI_TxRxCpltCallback function to trigger my code to process the received data.

I have tried to implement it (and Ive also called the IRQ Handler function when the DMA IRQ comes in), however it's not triggering, so I believe I've badly initialised it. Thats why I was hoping to find another example, so I can identify what I'm doing wrong and continue.

I can't currently post my code, as it's on my computer at work, and it's a long block of code. I was hoping to get some code which has that callback implemented already so I can investigate myself.

Sorry I didn't put that in my initial question!