cancel
Showing results for 
Search instead for 
Did you mean: 

Callbacks for SPI in DMA mode

Hrishikesh
Senior

I have both TX and RX on SPI1 on a F407 running in DMA circular mode. In the HAL_SPI_TxRxCpltCallback I parse the data that I receive from the Pi (since the Pi and the STM32 communicate over SPI1).

Does the TxRx callback get called when BOTH, TX and RX are complete or when either is complete? Also, I tried starting the SPI for Tx and Rx in DMA mode but separately like this,

HAL_SPI_Transmit_DMA(&hspi1, rpi_tx, 55);
HAL_SPI_Receive_DMA(&hspi1, rpi_rx, 55);

And then defined separate RX and TX callbacks. But this does not seem to work and they do not trigger nor receive the data from the Pi. Is there a way to define two separate callbacks?

1 REPLY 1
Curtis B.
Senior

I think you must use HAL_SPI_TransmitReceive_DMA... Data is transmitted and received synchronously to the master clk. TxRx callback ist called afterwards.