How to cancel HAL_SPI_TransmitReceive_DMA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-12-08 9:38 PM
How to cancel HAL_SPI_TransmitReceive_DMA
We are developing SPI communication devices using HAL_SPI_TransmitReceive_DMA.
We would like to cancel or stop HAL_SPI_TransmitReceive_DMA even in the middle of transmission by GPIO interrupt, but we do not know how to do it.
Is it possible to cancel in the middle of transmission?
Also, how should I program it?
Solved! Go to Solution.
- Labels:
-
STM32H7 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-12-08 10:36 PM
If you are using SPI to access a large amount of data in SPI flash in a single operation, then you need to stop the DMA operation in some situation. I don't see any stopping DMA mechanism inside HAL_SPI_TransmitReceive_DMA API. I think you might implement your own SPI DMA functions in which you can inject the GPIO interrupt or polling this GPIO to determine whether or not to exit DMA mode. To do this, you need to dig into how the SPI DMA works, which is not in a quick kick.
In the same time you might need a strategy to process the available data transmitted or received.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-12-08 10:36 PM
If you are using SPI to access a large amount of data in SPI flash in a single operation, then you need to stop the DMA operation in some situation. I don't see any stopping DMA mechanism inside HAL_SPI_TransmitReceive_DMA API. I think you might implement your own SPI DMA functions in which you can inject the GPIO interrupt or polling this GPIO to determine whether or not to exit DMA mode. To do this, you need to dig into how the SPI DMA works, which is not in a quick kick.
In the same time you might need a strategy to process the available data transmitted or received.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-12-09 1:29 AM
@NEdom.1 wrote:you might need a strategy to process the available data transmitted or received.
also to ensure that the Slave is left in a "sensible" state ...
A complex system designed from scratch never works and cannot be patched up to make it work.
