2024-09-02 01:21 PM - edited 2024-09-02 02:48 PM
I'm using STM32H743 in my project.
If anyone knows how to disable D-cache, please help!
D-cache really interferes with my work - I'm tired of fighting it!
SCB_DisableDCache() - leads to nothing.
Solved! Go to Solution.
2024-09-03 01:55 PM - edited 2024-09-03 01:55 PM
Try LL_MPU_CTRL_HFNMI_PRIVDEF instead of LL_MPU_CTRL_HFNMI_PRIVDEF_NONE.
2024-09-03 10:54 PM
I don't see that any cache is enabled by default, neither in the AN4839 (see 4 Mistakes to avoid and tips, the advice to invalidate cache before enabling it sounds like it's OFF at CPU start), nor in my H723/733/735 source code (not using HAL). I'm not using any cache, and I'm not disabling it.
2024-09-04 01:28 AM - edited 2024-09-04 01:43 AM
Hello,
First, in next time, please use </> button to paste your code. I'm updating your last post.
Second, Table 2 shows the default MPU memory region attributes for Cortex-M. So, this does not mean the cache is enabled by default but the region is cacheable. For example for the regions defined by default as device or strongly ordered and even you enable the cache using SCB_EnableXCache(), that region will not be cacheable.
Third, the difference between what I provided as MPU config is the MPU control mode: MPU privileged default:
/* Enable the MPU */
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
Your code: MPU HFNMI privileged none:
/* Enables the MPU */
LL_MPU_Enable(LL_MPU_CTRL_HFNMI_PRIVDEF_NONE);
So set it to MPU privileged default.
In CubeMx:
You need also to look at the Cortex-M7 programming manual PM0253 STM32F7 Series and STM32H7 Series Cortex®-M7 processor
2024-09-05 12:18 AM
Sorry for the long answer - I was testing!
Thanks to everyone - advice with LL_MPU_CTRL_HFNMI_PRIVDEF - the cache is disabled for the necessary memory areas - this is what you need!
2024-09-05 12:21 AM
This is how it was configured in the cube, but this is not the first bug of the cube - I don’t pay attention anymore - I use the cube only for setting up pins and clocking :)
Thank you!
2024-09-05 12:23 AM
Hello @SKS2CNC if your question has been answered please mark Accepted as Solution the comment that answered your question.
2024-09-05 12:23 AM
Thanks for the links to AN4839 and PM0253 - it helped for general understanding.
2024-09-05 12:31 AM
Did the config I provided solved your issue?
2024-09-05 01:10 AM
I don't use the cube much - it was enough for me to solve
LL_MPU_Enable(LL_MPU_CTRL_HFNMI_PRIVDEF);
By the way, for some reason I didn’t find these LowLevel functions in the UM2217 ;)