cancel
Showing results for 
Search instead for 
Did you mean: 

How to use HAL_SPI_Receive_DMA with dma1 and SPI6 ?

ALE C.1
Associate II

Hi,

I am currently working on the STM32H743 and i'm trying to bring data from SPI6 to a buffer in D2. As I have a lot of data to read i would like to use the DMA in order to transfer data without using the cpu. I don't understand whether I can use the DMA1/2 in order to do this or not.

For instance, with the SPI1, in D2, I can choose the DMA request as the DMA_REQUEST_SPI1_RX/TX. However the only request I can use with SPI6 is BDMA_REQUEST_SPI6_RX/TX. does it mean that I can only use the bdma here ?

However as BDMA is restricted to the D3 domain, it can't write data on a buffer in D2. How can I write it then ?

Do someone have a clear answer to this ? if so could you explain the required step i would need to implement the solution.

14 REPLIES 14

Hi MHana.1,

I took a look at the code, i don't understand the presence of PG9 as external interrupt. Also, the togglepin PE5 which means?

Do u have also test SPI6 as Slave?

Thanks!!

MHana.1
Associate III

Hi GCava.2,

PG9 and toggling PE5 to test something related to my application. What do you mean by "Do u have also test SPI6 as Slave?", do you mean using my board as an SPI slave?. I did not use it as a slave I only used it as master with BDMA to communicate with SLAVE chip. But I think you can modify the example attached above to do so.

Thanks

Hi @MHana.1​ ,

thanks for ur answer. Yes, my idea is to use SPI6 as a slave.

However, I'm trying to debug ur sharing code, I noticed a very strange thing. Suppose to not connect anything to SPI6, and it is configurated likes ur code. If I debug HAL_SPI_Transmit(&hspi6,(uint8_t *)"HELLO",10, 500); I have HAL_ERROR with ErrorCode 32d (So timeout problems) but also if I analyze registers, with Live Expressions, I can see that this code line *((__IO uint8_t *)&hspi->Instance->TXDR) = *((uint8_t *)hspi->pTxBuffPtr); doesn't modify the TXDR register, that is every 0.

Have u some suggestion about this situation?

Thanks and regards!!!

I also tried using a different SPI, without DMA. and I have the same problem.....

Thanks!!

Dear GCava.2 <> , I'll give it a try and reply to you soon.