2024-06-28 12:34 PM - last edited on 2024-07-01 07:39 AM by GaetanGodart
PROBLEM:
I do not believe this is a bug. I am doing everything I can to read into this issue it seems like I am either not enabling all the correct options or I am using .invalidate wrong.
This is what my GUI looks like from a basic design.
This is what it looks like when I run the TouchGFX simulator(the right image is gone because I initialize it as false until it receives a signal)
This is the tearing image I am having trouble with(currently no inputs).
I am basing this example on a set of tutorials I found online, https://www.youtube.com/watch?v=Y7d6-59YQu8&t=525s.
At my current level of C programming he seems to provide a good amount of details. Where I fall short is once I start to run it on the board.
CODE IN QUESTION:
#include <gui/screen1_screen/Screen1View.hpp>
Screen1View::Screen1View()
{
}
void Screen1View::setupScreen()
{
Screen1ViewBase::setupScreen();
}
void Screen1View::tearDownScreen()
{
Screen1ViewBase::tearDownScreen();
}
void Screen1View::setLight(bool state)
{
Light_ON.setVisible(state);
Light_OFF.setVisible(!state);
Light_ON.invalidate();
Light_OFF.invalidate();
}
WHAT I HAVE TRIED:
-> My first impression was that I was refreshing my screen to fast. I took out the .invalidate line, the gentlemen in the tutorials described it as a way to let the system know the widgets graphical representation needs to be reset. If I did that it would stop "tearing" and stay still, no matter what input I gave in D6(PD15) which I set as my GPIO Input.
-> I created a timer which would only call .invalidate every second. This partially worked! it correctly showed my inputs were working and the images changed but alas every second before the new image showed up it would "tear". All other examples I saw of the STM32H735G-DK did not do this.
-> I looked more into invalidate. The closest I got to a proper explanation was that some boards use "Double buffer". Double buffer seems to be a way to ensure the board will not try to clear and write to the screen at the same time. I am unsure of how to find the option to start double buffering.
ENDING:
Although double buffering may not be the issue, it is my best first steps. If this does not seem plausible and you guys have other ideas on what could be causing this issue please let me know. Thank you for all of your help.
NOTE: it says "your post has changed because of invalid HTML" I apologize if the grammar is strange or missing in any areas I missed.
2024-07-01 03:10 AM
Hello @tmehok ,
Please review these recommendations on how to post a thread on this community especially how to share a code source.
Thank you for your understanding.
2024-07-01 05:00 AM
Maybe you need to invalidate the cache in the flushing operation, to force the LTDC to use the hole frame buffer instead of some cached data
void TouchGFXGeneratedHAL::flushFrameBuffer(const touchgfx::Rect& rect)
{
// invalidate the cache before flushing
SCB_CleanInvalidateDCache();
SCB_InvalidateICache();
HAL::flushFrameBuffer(rect);
}
2024-07-01 05:06 AM
Or your frame buffer is located in the same area where your instructions are, some times access priority between CPU and LTDC to the RAM ( internal or external) create that starving issue
2024-07-01 08:10 AM
These few lines of code definitely changed what was happening with the display but did not fix it. I read through your second post; I am not to that knowledge level yet to hone in on where I can access and edit that code where access to the CPU and the LTDC can be found. Do you have any other ideas or resources I could look at. In the mean time I will search through the documentation for this board.
Thank you for your time.
2024-07-01 08:36 AM
share the hole project or the .map file so I can help
2024-07-01 09:14 AM
2024-07-01 09:38 AM
I see that you invalidate the cache after flushing, it's incorrect
need to add :
2024-07-01 11:01 AM - edited 2024-07-01 11:02 AM
2024-07-02 06:17 AM
I was using CHAT GPT to better understand the lines you gave me for the code. The line "HAL::flushFrameBuffer(rect)" is used to "flush" a certain rectangular part of the screen to my understanding. Does this mean I should be setting rect somewhere?