cancel
Showing results for 
Search instead for 
Did you mean: 

Discrepancy in colours between TouchGFX and the display

Mathan Raja
Associate III

Hi,

I am using the STM32H563 with an ST7735S display and encountering a colour difference between TouchGFX and the display. How can this issue be resolved?

MathanRaja_0-1729768799673.png

MathanRaja_1-1729769132153.png

Thanks

Mathan

21 REPLIES 21

To fix this colour issue

Thanks

Mathan

I think that you should keep the 8 bits SPI interface but I assume there is a problem in the way you set the color format.
Maybe you set it as RGB565 somewhere and RGB888 somewhere else, maybe you have the wrong format in your screen's driver, etc.
I cannot help you much because you have a custom board so I do not know what you have done, I need more information, that is why I redirected you to our guides for color format.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

what information do you want? I will share you.

Can you try the GUI share as an attached file and share a picture of all the screen that don't look like their preview?

Can you check in your driver the color format of the pixels?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Hi Gaetan Godart,

Here are the result 

MathanRaja_1-1730887388882.png   MathanRaja_4-1730888131200.png

MathanRaja_5-1730888180654.png    MathanRaja_6-1730888208925.png

Can you check in your driver the color format of the pixels?

MathanRaja_3-1730887945217.png

0x05: 16-bit colour depth (5 bits for red, 6 bits for green, 5 bits for blue).

 

FYI:

I previously encountered a colour issue with the ST7735 driver before integrating TouchGFX. Therefore, I converted the colour's hexadecimal value as follows.

 

 

#define RGB565_TO_BGR565(rgb) ((((rgb) & 0x001F) << 11) | ((rgb) & 0x07E0) | (((rgb) & 0xF800) >> 11))

#define RED RGB565_TO_BGR565(0xF800)

#define GREEN RGB565_TO_BGR565(0x07E0)

#define BLUE RGB565_TO_BGR565(0x001F)

 

Thanks

Mathan

Hello @Mathan Raja ,

 

Thank you for the extra information.

 

In TouchGFX, the red and blue are clearly swapped. I don't know about before integrating TouchGFX.

What happens if you remove the change you made to fix it before integrating TouchGFX?

If you only use TouchGFX to control your display, this could work.

 

There is also a squiggly red horizontal line through the display that is not straight and of various shades.

Is it a pen drawing? This looks like nothing I have seen before as it is not straight

If it is not a pen drawing on top of the screen, could you try to set all the pixels to a single color without using TouchGFX, so before TouchGFX starts for instance (let's use green for safety :face_with_tears_of_joy:).

You could also use a logic analyzer to check if all the pixels' color were indeed sent as green.

Finally, you could try on another screen to see if the issue persists.

 

Also, weird thing, but the squiggly line is blue when you set the screen to blue (red in TouchGFX).

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Hi Gaetan Godart,

What happens if you remove the change you made to fix it before integrating TouchGFX?

The issue remains the same.

Is it a pen drawing?

yes, it is a pen drawing.

 

Thanks

Mathan

How to fix this issue?

Michael K
Senior III

The ST7735 has a register called MADCTL (Memory Access Data Control), address 0x36. Notice that one of the bitfields is the RGB/BGR Order. You could try toggling this bit, which will tell the driver to interpret the red and blue channels opposite to what they currently are now.

MichaelK_1-1731245826858.png

 

In your project file drv_st7735.c, check the DRV_ST7735_SetRotation function. Notice that some pre-processor "if" sections set the madctl variable to the ST7735_MADCTL_RGB define and some others set it to ST7735_MADCTL_BGR. 

MichaelK_2-1731246208501.png

Try swapping the ST7735_MADCTL_RGB with ST7735_MADCTL_BGR and vice versa for all rotation cases.

 

Embedded UI/UX Consulting: cadenza.design

Hello @Mathan Raja ,

 

What happens if you remove the change you made to fix it before integrating TouchGFX?

Tell me what happens when you try @Michael K 's solution.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)