cancel
Showing results for 
Search instead for 
Did you mean: 

SPI DMA Correct Implementation

Linkpad
Associate III

Hi, I am trying to use DMA in my project for SPI and noticed there are 2 type definitions as below:-

 

 

SPI_HandleTypeDef hspi1;
DMA_HandleTypeDef hdma_spi1_tx;

 

 

Which one do I need to use for SPI transmission as I am having problems using 'hspi1' as below:-

 

 

HAL_SPI_Transmit_DMA(&hspi1, "Test",sizeof"Test");

HAL_SPI_Transmit_DMA(&hdma_spi1_tx, "Test",sizeof"Test");

 

 

 I just wasn't sure which handle was the correct to use...

1 ACCEPTED SOLUTION

Accepted Solutions
AScha.3
Chief II

afaik you need it to do this way:

HAL_DMA_Init(&hdma_spi1_tx);
HAL_SPI_Transmit_DMA(&hspi1, "Test",sizeof"Test");

 

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

3 REPLIES 3
STTwo-32
ST Employee

Hello @Linkpad 

I suggest you to take a look at the following example to understand how the spi dma configuration works exactly. 

Best Regards.

STTwo-32 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

AScha.3
Chief II

afaik you need it to do this way:

HAL_DMA_Init(&hdma_spi1_tx);
HAL_SPI_Transmit_DMA(&hspi1, "Test",sizeof"Test");

 

If you feel a post has answered your question, please click "Accept as Solution".

Hi,

Thanks for the explanation I now understand!