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

1 ACCEPTED SOLUTION

Accepted Solutions
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

View solution in original post

21 REPLIES 21
GaetanGodart
ST Employee

Hello @Mathan Raja ,

 

Most likely the drivers of your screen don't use the same format as TouchGFX.
For instance, TouchGFX uses ARGB but your display's driver might be in ABGR.

Someone else had a similar issue with an STT7735, here is how they solved it : https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/touchgfx-wrong-color-issue/td-p/195514

 

Please tell me if that helped you.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Hi Gaetan Godart,

I display images in a loop, and pressing an external button changes the image (a small application).

Adjusting the data size resolved the colour issue, and now the correct colours appear.

However, the application is not functioning as expected. The callback and image-changing functions execute during debugging, but the issue persists, and the display appears frozen.

Thanks 

Mathan

Hello @Mathan Raja ,

 

I don't really understand the issue here.

You changed the format and now your first image is fine?
But once you execute your interrupt that changes to another image, then you get the wrong colors again and the application freeze?

 

Can you share your project?

How do you change the image?

Can you try to isolate the actions (one for the image change and one for the interrupt), what happens in each case?

Do you use data cache (Dcache)?

What is your memory protection unit settings? Do you prevent speculative reading?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Hi Gaetan Godart,

I'm running an application that displays five images in sequence, with each image changing upon pressing an external button (GPIO interrupt). Initially, this worked as expected.

After changing the SPI (polling mode) data size from 8 to 16 bits, the colours display correctly, but now the images seem frozen and do not change with the button press.

How do you change the image? External button press.

Do you use a data cache (Dcache)?  Not used.

What is your memory protection unit settings? Do you prevent speculative reading? 

Default STM32 memory regions are used; custom settings to prevent speculative reading are not enabled.

Thanks

Mathan

Hello @Mathan Raja ,

 

When I asked how you changed the image I was wondering if you changed the bitmap but I looked at your project and you just have all images preloaded and show visible the correct one.

Can you try to disable the instruction cache (ICache)?

Can you try to isolate the actions (one for the image change and one for the interrupt), what happens in each case?

Can you try to put your images in internal memory?

GaetanGodart_0-1730194181266.png

 

 

Regards,

 

Gaetan Godart
Software engineer at ST (TouchGFX)

Hi Gaetan Godart,

Sorry for the late reply—I was on vacation last week.

I have isolated the action items in the project, and here’s what I found:

With SPI data size at 8-bit:

  • Still seeing a color difference (blue shows as orange).
  • Image changes work fine.
  • GPIO interrupts are working fine too.

With SPI data size at 16-bit (after initial setup):

  • No color issues here.
  • But image changes aren’t working.
  • GPIO interrupts are still fine.

MathanRaja_0-1730714310727.png

Thanks

Mathan

Hello @Mathan Raja ,

 

No worries!

 

I think you should stick to 8 bits.

Have you looked at our documentation ?

I would suggest trying to fix the color issue, look at these resources:

 

If you still wants to go the 16 bits solution, maybe look at this community.st.com/t5/stm32-mcus-products/custom-spi-datasize/td-p/129849

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Hi Gaetan Godart,

can I get a direct answer?

Thanks

Mathan 

 

What do you mean by direct answer?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)