The screen is shaked when button is pressed in the case of STM32H743 with SD card

Description:as the title, the screen is shake when button is pressed for the case of STM32H743 with SD CARD. But In the case of stm32F767 with SD card, the screen is normal.

STM32H743(abnormal) and STM32F767(normal)

What LVGL version are you using?

8.0

What do you want to achieve?

fix the abnormal of screen in the case of STM32H743 with SD card.

What have you tried so far?

I compare the case of H743 with SD card, H743 without SD card, F767 with SD card, only the first case is abnormal, the other two are normal

Code to reproduce

Since it is independent of code but related to the mcu. I do not post the code here. The different between the abnormal case and normal case is the MDMA is enable in the case of abnormal(the MDAM must be enable in the case of H743 with SD in CubeMX)

Screenshot and/or video

the abnormal case(H743 with SD card):

the normal case (F767 with SD card)

Thanks for your advice, best wishes

Are you using SDRAM at all? On F746, if you don’t use the memory swapping feature, there is bus contention which causes the display to flicker. The only solution I found was to enable memory swapping. I assume H743 will have a similar feature.

Yes, The SRAM is used in my project. I will try your solution. Thank you for your solution!

Hi Guys,

I’ve absolutely the same problem with ESP32-S3 based display (ESP32 display-7.0 Inch HMI Display 800x480 RGB TFT LCD Touch Screen Compatible with Arduino/LVGL)

I’ve tried to split the SD_writeFunction() to make the written data package smaller so as to let display render itself in the next loop() cycle.

Also I’ve reduced the written data size but in general the flickering keeps up.

In our project, we don’t need high FPS rendering; so it’s even OK if the display is suspended for about 500ms while SD_Write is ongoing. But I couldn’t find a proper LVGL function for this either. I tried to do the same from LovyanGFX but no luck until now.

P.S. Please mind that my embedded programming experience may not be sufficient for too complex operations; in case you may suggest something too advanced… :slight_smile:

Update: I keep trying new things in SD_Write(). So far what i found is that, below line is the main reason which causes the flickering:

    File file = fs.open(path, FILE_APPEND); 

The problem is you are using an RGB display. The RGB driver uses the SPIRAM and it transmits the frame buffer using interrupts. This is done as fast as possible because the RGB display doesn’t have any GRAM. so you cannot just stop the transmitting. It has to keep on sending at a very specific mspeed. if you are writing a lot of data to the SDCard you are more than likely using SPIRAM to do this. With multiple read operations happening from the SPIRAM you are running into a bandwidth issue at the memory level. The only way to handle this is to write smaller amounts of data to the SDCard at any given time. it’s a juggling act.

I’m very pleased to get your kind explanation @kdschlosser and sorry for my late reply.

Even if I’ve written into SD card with smaller chunks, the problem persisted. What I’ve discovered so far is that, IF i keep file open, then there’s no flickering -whether or not i write big or smaller chunks. Therefore, I tried to keep file open and do file.flush() after each file.write() operation to see the result.
Turns out that the flickering is almost completely dismissed.

What do you think about this then?

Thanks in advance…