cancel
Showing results for 
Search instead for 
Did you mean: 

Old content/screen when updating information on screen.

Marco.R
Senior

Hello

I'm using TouchGFX 4.10 with a custom board (STM32F767) and I have a problem, where old value/content will be displayed when updating another value on screen.

Procedure in which the problem occurs:

  • I have two textareas on screen (e.g. TextA and TextB)
  • The initial values are: TextA: "ABC" / TextB: "DEF"
  • In General: The values will be updated through Model->Presenter->View / Touch is not used
  • (Step1) Updating TextA to "123" and invalidating TextA
    • Text on Screen -> TextA: "123" / TextB: "DEF"
  • (Step 2) Updating TextB to "456" and invalidating TextB
    • Text on Screen -> TextA: "ABC" / TextB: "456"
    • TextA is wrong!
  • (Step3) Updating TextB to "789" and invalidating TextB
    • Text on Screen -> TextA "123" / TextB: "789"
    • TextA and TextB are correct
  • When I repeat Step 2 then I have the wrong values again

I don't know where the problem is, but I assume it has something to do with the doublebuffering. When I invalidate both values in every steps, it works correctly.

But this can/should not be the solution, because this happens not only with texts also with bitmaps and other widgets.

Has anyone an idea what is wrong?

Thanks

Best regards

Marco

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Marco.R​,

I've been on easter holida, apologies. Trying to catch up.

Generally, there's no copying from one framebuffer to the other. If you're running a double framebuffer configuration the DMA will be updating the "other" framebuffer while the LTDC is reading from the framebuffer that is "done" and being displayed.

Can you provide some screenshots? And tell me what you're expecting to see?

Also, there's no documentation on that yet, but i'm trying to get it written ("Understanding TouchGFX").

/Best regards,

Martin

View solution in original post

13 REPLIES 13
cameronf
Senior

Can you post code for the screen this is happening on? Is there any chance for anything weird to happen elsewhere that also invalidates these text areas or for the screen to be re-entered and rebuilt in between these events?

Marco.R
Senior

​Hi @Community member​ 

Below some code. I simplified it and I used integer values instead of texts but the result is the same. Each method will only called once when updating ValueA and ValueB.

Model.cpp:

void Model::updateValueA(const uint32_t newValue)
{
    m_valueA = newValue; 
    if (modelListener != 0)
    {
        modelListener->updateValueA(m_valueA);
    }
}
 
void Model::updateValueB(const uint32_t newValue)
{
    m_valueB = newValue;
    if (modelListener != 0)
    {
        modelListener->updateValueB(m_valueB);
    }
}

DevelopmentPresenter.cpp

void DevelopmentPresenter::updateValueA(const uint32_t newValue)
{
    view.updateValueA(newValue);
}
void DevelopmentPresenter::updateValueB(const uint32_t newValue)
{
    view.updateValueB(newValue);
}

DevelopmentView.cpp

void DevelopmentView::updateValueA(const uint32_t newValue)
{
    Unicode::snprintf(txt_aBuffer, TXT_A_SIZE, "%d", newValue);
    txt_a.invalidate();
}
 
void DevelopmentView::updateValueB(const uint32_t newValue)
{
    Unicode::snprintf(txt_bBuffer, TXT_B_SIZE, "%d", newValue);
    txt_b.invalidate();
}

In my opinion it is not wrong code for the screen, because the error happens on different screens and also with generated code (e.g. buttons -> old state will displayed).

I think TouchGFX use an outdated screenbuffer when updating a new value. We are using a HAL/DMA implementation which is adapted from the TouchGFX examples. I investigating this implementation but I did not found a difference until now. I also tried NoDMA instead of the DMA Implementation -> same result.

Any other ideas? I'm grateful for every hint.

Best regards

Marco

Marco.R
Senior

​A short update:

I investigated the DMA when updating screen from Step 1 to Step 2. The following steps will be done:

  • setupDataFill with blitoperation 2 (BLIT_OP_FILL -> Fill the destination with color) @ Framebuffer 1
  • setupDataFill with BLIT_OP_COPY_A4 (Copy 4-bit source text to destination) -> copies "4" to Framebuffer 1
  • setupDataFill with BLIT_OP_COPY_A4 -> copies "5" to Framebuffer 1
  • setupDataFill with BLIT_OP_COPY_A4 -> copies "6" to Framebuffer 1

Between all this steps getBlitCaps (2x) and DMA Irq will be called. There is nothing about the TextA "123" or "ABC"

From Step 2 to Step 3 the following steps will be done:

  • setupDataFill with blitoperation 2 (BLIT_OP_FILL -> Fill the destination with color) @ Framebuffer 2
  • setupDataFill with BLIT_OP_COPY_A4 (Copy 4-bit source text to destination) -> copies "7" to Framebuffer 2
  • setupDataFill with BLIT_OP_COPY_A4 -> copies "8" to Framebuffer 2
  • setupDataFill with BLIT_OP_COPY_A4 -> copies "9" to Framebuffer 2

In general, the steps looks as expected. But the content on screen is wrong. What I miss is the copy of the whole screen from Framebuffer 1 to Framebuffer 2 and vice versa. I don't know where this will be done. I assume this will be done within the TouchGFX Library.

@Martin KJELDSEN​ : Is my assumption correct? Is there a documentation, where I can see what happens in screen update? Thanks

cameronf
Senior

@Marco.R​ , the only thing I can think of if you think it's frame buffer related is to double check that your touchgfx HAL is writing the address of the right framebuffer to the CFBAR register based on the address being given to setTFTFrameBuffer(uint16_t* adr). You could also try disabling double buffering and see what happens.

Other than that, I'm not familiar enough with how touchgfx works to have any good ideas about why this would be happening, I've never had this issue before.

Hi @Marco.R​,

I've been on easter holida, apologies. Trying to catch up.

Generally, there's no copying from one framebuffer to the other. If you're running a double framebuffer configuration the DMA will be updating the "other" framebuffer while the LTDC is reading from the framebuffer that is "done" and being displayed.

Can you provide some screenshots? And tell me what you're expecting to see?

Also, there's no documentation on that yet, but i'm trying to get it written ("Understanding TouchGFX").

/Best regards,

Martin

​@Community member​ : Thanks for your reply and hints. I already checked the touchgfx HAL (see my last post). It is writing to the right address -> setTFTFrameBuffer toggles between 0xC00BB800 and 0xC0000000 . I also tried to disable double buffering. It works as expected -> no old/wrong content appears on display. But single buffering is no option. The display is flickering (screen tearing) because the touchgfx task has not the highest priority.

​Hi @Martin KJELDSEN​ 

Thanks for your reply. I hope you had nice holidays. :smiling_face_with_smiling_eyes:

If I understand you correct, I have to update (invalidate) every text (or element) on screen even I only want to update one text. Is that correct? Is there a function, where I can invalidate the entire screen without invalidating every element one-by-one? I attached a pdf with some screens and my expectation. But after the reply from you, I think everything's working the way it should (and I have to update my code :smiling_face_with_smiling_eyes: )

Best regards

Marco

Hi Marco,

Yes, you're right that you need to invalidate manually to tell TouchGFX that something should be updated in the framebuffer. Some methods do this explicitly (e.g. moveTo() ) - Invalidating the entire screen would be very costly (potentially) performance wise because you're re-rendering all the elements even if they don't change.

If you have several elements that change at the same time i'd simply create a specific method to invalidate them - e.g. updateTexts() or something.

Best regards,

Martin

Can you share the project? Is this also an issue with the simulator?