cancel
Showing results for 
Search instead for 
Did you mean: 

InvalidateDCache with AXI-SRAM gives HardFault

ranran
Senior II

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

1 ACCEPTED SOLUTION

Accepted Solutions

>> 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
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

3 REPLIES 3

>> 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
Up vote any posts that you find helpful, it shows what's working..
ranran
Senior II

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 ?

The DTCM memory isn't connected to the cache

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