2024-12-23 01:15 AM
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?
2024-12-23 01:26 AM
@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!
2024-12-23 01:56 AM
SPI_DMATransmitReceiveCplt is not called. Is there something we need to set? Do we need to set the ioc file?
2024-12-23 02:10 AM
Have you enabled the interrupt?
2024-12-23 02:19 AM
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.
2024-12-23 05:17 AM
You should set CS high in HAL_SPI_TxRxCpltCallback.
If that's not working, show the relevant code. Ensure DMA interrupts are enabled.
2024-12-23 06:39 AM
Hello @pass3master