2021-03-24 03:42 PM
I had some wrong bytes when transferring data over SPI, so I tried to clean the DCache. But I get a hard fault if I do this:
I'm using the NUCLEO-H723ZG board.
2021-03-24 04:09 PM
And is D cache enabled?
Try this:
if (SCB->CCR & SCB_CCR_DC_Msk) {
SCB_CleanDCache();
}
2021-03-24 09:35 PM
Thanks, looks like it was not enabled, because with your test, it works. It was a project created from STM32CubeMX. Is it possible to enable it in CubeMX? I added SCB_EnableDCache() in the main function, and this solves the problem as well.
Why doesn't the default CubeMX project generate code which enables it? I guess the speed difference can be big. I didn't check it, is the instruction cache not enabled by default as well?
2021-03-25 09:29 AM
> is the instruction cache not enabled by default as well?
Caches are not enabled after reset. You can check it easily: if (SCB->CCR & SCB_CCR_IC_Msk) ...
But STM32 has additional proprietary cache for internal flash, called ART.
--pa