cancel
Showing results for 
Search instead for 
Did you mean: 

STM keep getting reset at SCB_CleanInvalidateDCache (like 15-25 times) before working stable.

Hello, I am using STM32F746 with Touchgfx. I generated project with STM32CUBEMX. I notice that during first boot STM gets reset multiple times before running stable.

I try to debug issue and found that ound out its getting reset at function SCB_CleanInvalidateDCache () ( PC : 0x08011420 or 0x08011410 ).

0693W000008wIEEQA2.pngAnd SCB_CleanInvalidateDCache() is getting called by TouchGFXGeneratedHAL::flushFrameBuffer()

0693W000008wIEYQA2.png 

I didn't enable cache in cubemx project, Not sure about issue, Any suggestion ?

0693W000008wsi5QAA.pngThanks

8 REPLIES 8

@Martin KJELDSEN​  Any suggestions ?

Piranha
Chief II

Also SCB_CleanInvalidateDCache() is inefficient and mostly dangerous. Flushing buffers before passing them to DMA should be done by SCB_CleanDCache_by_Addr().

I had this out with some chap last week.

You're using GNU, and an OLD version of the CMSIS library that doesn't check the current cache state, and it's trashing the pending stack flush to memory.

The function is supposed to in-line completely, so it's not pushing on the stack. And it should be aware if the cache is currently enabled or not.

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

Going to be an absolute sloth with no caches enabled. The function expects the cache to be enabled, and doesn't check further

https://community.st.com/s/question/0D53W00000dQdZ8SAK/stm32f7-cpuenablecache-scbenabledcache-corrupts-stack

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

This code is generated by Touchgfx

I enabled both I and D cache. Do I need to enable MPU too ?

0693W000008wzkXQAQ.png

I enabled both I and D cache. Do I need to enable MPU too ?

0693W000008wzkcQAA.png

In the example of TouchGFX for the stm32h735g-dk devkit they enable the MPU for specific regions.
It works without the MPU, but it might be better to enable it so you have control over which regions are cached.

In "Table 6. Memory map and default device memory area attributes" of RM0468  you can see that many regions (including internal SRAM) have D-cache attribute set by default, but this may not be desirable?

According to Msolinas "the MPU is very important for RAM settings": https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/problem-when-i-use-external-sram-in-touchgfx-wrong-pixels/td-p/592117/page/2

Below is the configuration generated by TouchGFX:

 

unsigned_char_array_0-1710159232992.png

This is how I invalidate cache:

 

 

 

    if (SCB->CCR & SCB_CCR_DC_Msk)
    {
    	//https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/stm-keep-getting-reset-at-scb-cleaninvalidatedcache-like-15-25/td-p/205024
    	//"also SCB_CleanInvalidateDCache() is inefficient and mostly dangerous. Flushing buffers before passing them to DMA should be done by SCB_CleanDCache_by_Addr()."

		uint8_t bpp = lcdRef.bitDepth() / 8;
		SCB_CleanDCache_by_Addr((uint32_t *)TouchGFXGeneratedHAL::getTFTFrameBuffer(), FRAME_BUFFER_WIDTH * FRAME_BUFFER_HEIGHT * bpp);
    }

 

 

 

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.