Reference from CMSIS-Core, the description for __STATIC_FORCEINLINE void SCB_EnableDCache(void)
Before enabling the data cache, you must invalidate the entire data
cache SCB_InvalidateDCache(), because external memory might have
changed from when the cache was disabled. After reset, you must
invalidate SCB_InvalidateDCache() each cache before enabling it.
So I think you can try to SCB_InvalidateDCache() before SCB_EnableDCache().
On the other hand, can you provide the error message or the state of the error?
I think that helps figure out the root cause.