cancel
Showing results for 
Search instead for 
Did you mean: 

basic working example for SPI usage between 2 different blocks

VKats.1
Associate II

ia m using STM32h743II MCU and I am trying to transfer SPI data from the spi4 block defined as SPI MASTER to the spi5 block defined as SPI SALVE without success using DMA.

I'm looking for any basic example that actually works for transferring SPI payload between 2 different blocks (from spi4 block- > to spi5 block).

the example I saw under FW_Projects_Example\NUCLEO-H743ZI

describe and use only 1 block and not communicate between two blocks.

I would be very happy for someone who has previously implemented something similar to this or a guide he has come across that can help me implement SPI using DMA

5 REPLIES 5
MM..1
Chief II

I mean nobody implement one chip loopback spi communication. For what?

But simply as first you need init all. Then Call nonblocking receive SPI5 and next nonblocking transmit SPI4.

Full duplex is more complicated.

Nikita91
Lead II

If you use interrupt, DMA and non blocking functions you can do this.

I made it to test an application with only 1 card which played both roles of transmitter and receiver.

Hi,

one chip loopback spi communication is for my debug - as you wrote my goal is a Full duplex between 2 different boards.

but unfortunately did not succeed to write code using

HAL_SPI_Transmit_DMA

HAL_SPI_Receive_DMA

or

HAL_SPI_TransmitReceive_DMA

that is the reason i am looking for some working basic example that actually works

hi,

what did you mean by "you can do this"?

did you attach any files?

Nikita91
Lead II

I mean it's quite possible to do full duplex between two SPIs of the same MCU (Too bad ST only provides complicated examples requiring two boards...)

As I don't use HAL, I can't provide an example corresponding to your wish.

Were you inspired by the SPI_FullDuplex_ComDMA example (STM32CubeH7/Projects/NUCLEO-H723ZG/Examples/SPI/SPI_FullDuplex_ComDMA at master · STMicroelectronics/STM32CubeH7 (github.com))? As it is the same source for the master and the slave you can modify it to use the 2 functionalities at the same time.

As you are using an M7 and the DMA, don't forget the data cache management (STM32H7 SPI_FullDuplex_ComDMA example)