cancel
Showing results for 
Search instead for 
Did you mean: 

I would like to perform a Red Blue Swap for my LCD display, may I know what are the options available?

SLeon.3
Associate

An example would be having a pixel color of #0000FF(R = 0, G = 0, B = 255) in TouchGFX designer to be displayed on the physical lcd screen as #FF0000 (R = 255, G = 0, B = 0). I have tried the methods below:

  1. Modifying the image conversion process such that red and blue pixel data in the resultant C++ files are swapped. I am assuming that $(touchgfx_path)/framework/tools/imageconvert/build/win/imageconvert.out does this conversion. Is there an option to make imagecovert.out perform some operations and generate C++ files in the RGB/BGR format just like the way LCD-Image-Converter-20161012(as recommended AN4861) tool does it in the matrix? Refer to the differences between the images - BGR.png and RGB.png attached.
  2. Editing the DMA2D registers in STM32H7DMA.cpp. I have tried this method with limited success. Some images are not converted and some texts are partially converted.

Please let me know I am doing something wrong or if there are any methods to perform the red blue swap. Thanks!

1 REPLY 1
Romain DIELEMAN
ST Employee

Hi,

Unfortunately TouchGFX does not have a library patch that swaps the colors. We can only write the framebuffer in RGB order. The LTDC does not allow swap either (would require to swap the wires). A solution would be to use an extra framebuffer and then use DMA2D to copy from RGB565 to BGR565. This would require extra memory and might impact performances. You could also use the partial framebuffer strategy where you first draw in the partial framebuffers in the normal RGB565 mode. When a buffer is full you copy that buffer to a real framebuffer using DMA2D, and then have the LTDC read from that real framebuffer.

/Romain