Skip to main content
ranran
Senior
Jan 22, 2019 5:09 PM UTC
Solved

InvalidateDCache with AXI-SRAM gives HardFault

Hello,

I have recently moved RAM from DTCM to AXI SRAM (so that I get more RAM).

It then failed in dma example.

After investigation I found out that the call to  SCB_InvalidateDCache results in HardFault_Handler.

I've changed it to use  

 SCB_InvalidateDCache_by_Addr((uint32_t *)aDST_Buffer, (BUFFER_SIZE));

and now it function OK, but I don't yet understand why SCB_InvalidateDCache fails with AXI SRAM.

I am using st32h743-eval

Thank you,

ranran

This topic has been closed for replies.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Jan 22, 2019 6:34 PM UTC

>> I don't yet understand why SCB_InvalidateDCache fails with AXI SRAM.

Doing a blanket level invalidate, doesn't flush, you likely just end up losing the stack and any pending writes against memory.

CleanDCache is the flushing method.

Use the Invalidate method of regions which DMA (to memory) has changed the underlying memory.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..

3 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Jan 22, 2019 6:34 PM UTC

>> I don't yet understand why SCB_InvalidateDCache fails with AXI SRAM.

Doing a blanket level invalidate, doesn't flush, you likely just end up losing the stack and any pending writes against memory.

CleanDCache is the flushing method.

Use the Invalidate method of regions which DMA (to memory) has changed the underlying memory.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
ranran
ranranAuthor
Senior
Jan 22, 2019 7:59 PM UTC

Right, I did invalidate regions using SCB_InvalidateDCache_by_Addr (as I wrote in the original post above)

Yet, why does AXI-SRAM behaves different from DTCM in term of cache ?

Tesla DeLorean
Guru
Jan 22, 2019 8:20 PM UTC

The DTCM memory isn't connected to the cache

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..