Bodmer / TFT_eSPI

Arduino and PlatformIO IDE compatible TFT library optimised for the Raspberry Pi Pico (RP2040), STM32, ESP8266 and ESP32 that supports different driver chips
Other
3.56k stars 1.03k forks source link

ILI9341 Driver Peculiarities #2890

Closed CHCHmark closed 9 months ago

CHCHmark commented 9 months ago

Hi All, I am a newbie. I hav4 4 TFT screens from china that purport to be 240x320 and driven by the ILI9341 chip. I am working with an ESP32 WRRoom on Platform IO and Arduino and I have had many other screen working perfectly with the wonderful driver code. TFT_eSPI library version bodmer/TFT_eSPI@^2.4.31 TFT driver SetupILI9341 SPI TFT to processor connections used TFT_CS= 5 TFT_DC= 25

TFT_1

This photo shows my issue. It appears the screen dimensions are not quite correct and the colours are Red where they should be Blue and vice versa. The display appears to be working in all ways so I am hoping this is a coding tweak as opposed to a faulty display.

Any thought gladly received.

Cheers

Mark

Bodmer commented 9 months ago

Run the Read_User_Setup sketch and post the serial monitor output.

The displays don't appear to be ILI9341 types. Can you get example code from the vendor?

Post a link to the display sales page.

CHCHmark commented 9 months ago

[code] TFT_eSPI ver = 2.5.0 Processor = ESP32 Frequency = 240MHz Transactions = Yes Interface = SPI Display driver = 9341 Display width = 240 Display height = 320

MOSI = GPIO 23 SCK = GPIO 18 TFT_CS = GPIO 5 TFT_DC = GPIO 25 TOUCH_CS = GPIO 33

Font GLCD loaded Font 2 loaded Font 4 loaded Font 6 loaded Font 7 loaded Font 8 loaded Smooth font enabled

Display SPI frequency = 40.00 Touch SPI frequency = 2.50 [/code]

https://ae04.alicdn.com/kf/H616e8d76d0fa407cb3256ec2f2c81514l.jpg_640x640.jpg

Sorry no examples available

Bodmer commented 9 months ago

That all looks good. One possibility is that it is a landscpe format display.

Try:

define ILI9342_DRIVER

TangerineDreamer commented 9 months ago

You can also test with ILI9486,ILI9488 and ST7796,i noticed some similarities between them,as i can make them all get working using the ILI9486 setup,but colors and dimensions change :)

CHCHmark commented 9 months ago

Hi Bodmer Yes you were correct. A change to #define

Mark Weir

On 14/10/2023, at 05:59, Bodmer @.***> wrote:



That all looks good. One possibility is that it is a landscpe format display.

Try:

define ILI9342_DRIVER

— Reply to this email directly, view it on GitHubhttps://github.com/Bodmer/TFT_eSPI/issues/2890#issuecomment-1761826248, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A4IZX5SNZZOZA72CWGFEEDDX7FXPXANCNFSM6AAAAAA54SSQAQ. You are receiving this because you authored the thread.Message ID: @.***>

CHCHmark commented 9 months ago

Hi Bodmer, Many thanks for your help. I started a message earlier and messed it up. The change of #define driver cured my problem with the screen layout. I had to set the rotation to 0 also. I works well. I now need to change the colour order as the Red and Blue are transposed. Is this some thing I can change? I have done this successfully before with the ST7735 driver. I also want to thank you for this excellent library, the support and the very useful examples. Your effort has changed what looks quite scary into a great experience for experimenters.

Bodmer commented 9 months ago

Try one of these lines in the setup. I am not sure if it is enabled to work with ILI9341/2 displays though:

define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue

or:

define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red

Edit: yes, it should work.

CHCHmark commented 9 months ago

Hi Bodmer

Sorry no joy with that. I can work with it for now

Thanks again for your help

Mark Weir

On 15/10/2023, at 16:40, Bodmer @.***> wrote:



Try one of these lines in the setup. I am not sure if it is enabled to work with ILI9341/2 displays though:

define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue

or:

define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red

— Reply to this email directly, view it on GitHubhttps://github.com/Bodmer/TFT_eSPI/issues/2890#issuecomment-1763258034, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A4IZX5VIW26DOTUFTAUCLRTX7NLITANCNFSM6AAAAAA54SSQAQ. You are receiving this because you authored the thread.Message ID: @.***>

Bodmer commented 9 months ago

It works for me, so try again, or manually change the setting to TFT_MAD_RGB here: https://github.com/Bodmer/TFT_eSPI/blob/master/TFT_Drivers/ILI9341_Defines.h#L66

CHCHmark commented 9 months ago

Hi Bodmer, Once again you are so right. I foolishly tried to put the #define in my sketch setup not really thinking.

Thanks again

Mark