cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_SPI_TransmitReceive_DMA (STM32_FW_V1.7.0)

Tim Michals
Associate II
Posted on July 31, 2017 at 22:35

In STM32Cube_FW_F7_V1.7.0/Projects/STM32746G-Discovery/Examples/SPI/SPI_FullDuplex_ComDMA example shows a simple DMA transfer with data cache on. 

How can aRxBuffer buffer can be updated correctly without a region defined non-cacheable?

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on August 01, 2017 at 14:28

Allocate your receive buffers such that they're on a cache line boundary and extend an integral number of cache lines.  In the DMA completion call SCB_InvalidateDCache_by_Addr() before expecting the data to be valid.

View solution in original post

3 REPLIES 3
Posted on August 01, 2017 at 14:28

Allocate your receive buffers such that they're on a cache line boundary and extend an integral number of cache lines.  In the DMA completion call SCB_InvalidateDCache_by_Addr() before expecting the data to be valid.

Tim Michals
Associate II
Posted on August 01, 2017 at 15:07

After looking at the code more, the reason why this works once is aRxBuffer is not in the data cache since it has not been read.  I would hope the examples for the F7/H7 would be updated to reflect cache issues, not just 'lucky' code,

Posted on August 01, 2017 at 17:47

Well, hope but don't count on it.  Treat all example code as just that: a very specific, narrow example.  Once you incorporate any example code you own it...and its 'luck'.  ;)