cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 LTDC image artefact (touchGFX)

theophile
Associate

Hello,

My problem is now resolved but I think it can be useful to keep a trace of it for other people !

I configured a project with STM32CubeMX, which uses : TouchGFX + LTDC + DMA2D with a custom 800x480 TFT Display.

I was able to get an image on the display, but the text looked ugly, as if the resolution was reduced, the images also have a poor quality : they were not sharp, and some pixels had an incorrect value (sometimes there were white instead of white or black instead of deep blue...). Generally, the sames pixels were affected, but some of the altered pixels changed after a reboot of the system. 

On a steady screen, the wrong pixels were quite constants, but some flickering could be observed when looking attentively.

After wondering if the problem was due to alpha layer settings, LTDC or DMA2D configuration, I took an oscilloscope to observe the waveforms of the signals, and I saw that the DCLK signal amplitude was very little, less than 1 V. I checked the GPIO speed setting in CubeMX, and discovered that all LTDC signal speed were set to " Very Slow". I changed them to "High", and the problem was solved !?

I hope it can helps if you encouter the same problem ! 

 

1 REPLY 1
theophile
Associate

Hello, 

After restarting my device today, the problem reappeared ! I checked again the LTDC signals with an oscilloscope, and this time there were good. Nothing has changed in my code (I use git and I can confirm there's no change since my last commit, I did when the display was working correctly).

In fact, yesterday, I loaded another program, developped a long time ago with Keil, which was working correctly with the display, and I didn't cut the power before reloaded my current firmware (developped with CubeIDE). It appears that the initialisation of the RAM (custom code, not generated by CubeMX) contained one difference :

 

 

Command.CommandMode = FMC_SDRAM_CMD_LOAD_MODE;

Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;

Command.AutoRefreshNumber = 1;

Command.ModeRegisterDefinition = 0x230; // 0x230 is working, 0x380 was not working

 

I have confused the HAL FMC #define, with the SDRAM specific register definition for the CMD_LOAD_MODE.

So, if you have image alterations, check your SDRAM configuration (the problem was not visible when I performed a memset of the framebuffer to all white or all black)