Skip to main content
FMaup.1
Associate
June 26, 2023
Question

STM32F4. Transfert data from SPI3 to SPI1 and DMA ?

  • June 26, 2023
  • 1 reply
  • 1089 views

Hello,

I need with STM32F4 to read datas (multiple bytes) from a sensor connected to SPI3 and transfert the bytes i read from this SPI3 to an external memory connected to SPI1.

I would like to use DMA (if possible). Seemingly SPI1 can only be connected to DMA2 whereas SPI3 can only be connected to DMA1. Is it a no-go to use DMA for this transfert "from SPI3 to SPI1" ? or is there any other option to optimize this transfert and reduce CPU load. 

Note: I cannot remap my SPI connections, hardware is frozen.

Thanks in advance 

This topic has been closed for replies.

1 reply

waclawek.jan
Super User
June 26, 2023

DMA2 can read from SPI3_DR, but I'm not sure this is what you want. The external memory surely needs extra data added to indicate "start of write", for example; and also that external memory probably has some paging scheme so you won't be able to transfer too much data without stopping/restarting.

You may want to use one DMA stream (tied to one SPI) to transfer data to RAM, and then another to transfer data from RAM to the destination.

I'd recommend to try experimentally only one of the transfers first.

JW

FMaup.1
FMaup.1Author
Associate
June 27, 2023

Hi JW,

Sure reading and writing operation need some datas packaging so i don't consider to simply receive and resend datas without any processing. I was thinking about using  the DMA to store the "true" datas but also adding the necessary extra bytes to handle the complete command. As i cannot seemingly use the same DMA then i need more processing.