cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding SPI communication using DMA and manual SPI_CS operation

pass3master
Senior

We are performing SPI communication using DMA.

In this case, we manually set the GPIO to High/Low as SPI_CS, but (obviously) SPI_CS goes High before all of the SPI CLK is sent.

How can we manually return SPI_CS to its original state after all of the SPI CLK has been sent?
Should We use SPI_DMATransmitReceiveCplt?

4 REPLIES 4

@pass3master wrote:

we manually set the GPIO to High/Low as SPI_CS, but (obviously) SPI_CS goes High before all of the SPI CLK is sent.


No, that's not obvious at all - that's an error in your code!

When you choose to "manually" control CS, it's up to your code to ensure that it is asserted & released at the appropriate times.

 


@pass3master wrote:

Should We use SPI_DMATransmitReceiveCplt?


That would be the obvious way to do it - as the name suggests, that tells you when the transaction is complete!

SPI_DMATransmitReceiveCplt is not called. Is there something we need to set? Do we need to set the ioc file?

Have you enabled the interrupt?

By interrupt, do you mean a DMA interrupt?
The DMA1 stream2 global interrupt (the DMA stream we are using) is enabled.
The target SPI global interrupt is disabled.