2023-02-14 12:51 AM
I have custom clock widget in my project and its working fine on version 4.20 but when i upgraded it to 4.21.0 or 4.21.1 causing distortion on clock hands.
When I investigate the issue I saw that SCB_CleanInvalidateDCache() function removed from TouchGFXGeneratedHAL::flushFrameBuffer function. Here is the old function 4.20 has;
void TouchGFXGeneratedHAL::flushFrameBuffer(const touchgfx::Rect& rect)
{
HAL::flushFrameBuffer(rect);
// If the framebuffer is placed in Write Through cached memory (e.g. SRAM) then
// the DCache must be flushed prior to DMA2D accessing it. That's done
// using the function SCB_CleanInvalidateDCache(). Remember to enable "CPU Cache" in the
// "System Core" settings for "Cortex M7" in CubeMX in order for this function call to work.
if (SCB->CCR & SCB_CCR_DC_Msk)
{
SCB_CleanInvalidateDCache();
}
}
When I add this manually its working fine. I didnt understand why they removed this part of code in new version.
There is 2 more functions doing same cache clean;
void TouchGFXGeneratedHAL::InvalidateCache()
{
// If the framebuffer is placed in Write Through cached memory (e.g. SRAM) then
// the DCache must be flushed prior to DMA2D accessing it. That's done
// using the function SCB_CleanInvalidateDCache(). Remember to enable "CPU Cache" in the
// "System Core" settings for "Cortex M7" in CubeMX in order for this function call to work.
if (SCB->CCR & SCB_CCR_DC_Msk)
{
SCB_CleanInvalidateDCache();
}
}
void TouchGFXGeneratedHAL::FlushCache()
{
// If the framebuffer is placed in Write Through cached memory (e.g. SRAM) then
// the DCache must be flushed prior to DMA2D accessing it. That's done
// using the function SCB_CleanInvalidateDCache(). Remember to enable "CPU Cache" in the
// "System Core" settings for "Cortex M7" in CubeMX in order for this function call to work.
if (SCB->CCR & SCB_CCR_DC_Msk)
{
SCB_CleanInvalidateDCache();
}
}
But I can't see any call for this functions. Is this a migration issue or something wrong with my project?
Thanks.
2023-02-15 01:31 AM
Hello afergan,
Which TBS is your project based on ? I'll try to investigate on this issue..
/Osman
2023-02-15 01:58 AM
Hi @Osman SOYKURT ,
I'm using custom board not ready to use ones. I have STM32H743VIT6 on this board and using LTDC + DMA2D for filling the screen. And ICache and DCache are enabled in my project.
On TouchGFX 4.20 TouchGFXGeneratedHAL::flushFrameBuffer have SCB_CleanInvalidateDCache(); call inside by default. But after updating 4.21 this function call removed. I can still add it manually and its working but I couldn't understand why this line was removed.
/Ahmet
2023-02-15 02:17 AM
Hello @afergan,
Please take a look at this article, it explains how the switch mechanism between HW/SW rendering works.
/Yoann
2024-03-12 02:49 AM
Indeed. I have the same question. In the documentation of TouchGFX it says these methods are called by the framework, but they aren't.
https://support.touchgfx.com/docs/development/board-bring-up/how-to/02-cpu-running
"When the state transit from HARDWARE to SOFTWARE it will call the virtual method void touchgfx::HAL::InvalidateCache() and when the state transitions from SOFTWARE to HARDWARE it will call the virtual method void touchgfx::HAL::FlushCache(). The functionality of these two functions is left for the user to implement in the derived HAL class."
Maybe I don't fully understand what they mean with the transition. It uses either sw or hw rendering as far as I know. Now I always clear the cache in flushFrameBuffer, but maybe that is not needed?