TFT_eSPI: Raspberry Pi Pico with Pico-ResTouch-LCD-3.5 not working

Dear all.

First of all: I am new to this forum.
If my topic is in the wrong section, don't hesitate to move it to the right place.

I have tried to resolve this issue now for several days, but I cannot figure out a solution.

My hardware:

According to the manufacturer, the board is equipped with a

  • ILI9488 controller for the LCD (interestingly, it says ST7789 at some place)
  • XPT2046 for the Touch function

The sample code does not work, if no SD-card is present. After some difficulty (setting up cmake on Windows...) I was able to modify the sample and get the LCD and Touch working.

However, I would like to use the display with @bodmer 's TFT_eSPI library. According to all documentation I could find, this should work, as the library supports all the relevant components.

I modified the User_Setup.h file to suit the Pins. But whatever I try, I cannot get the TFT_eSPI.h library to do anything.

Lastly, I tried to "trick" the setup, by initialising both, the manufacturer's library and TFT_eSPI.h, as suggested in this discussion (before the closing and reopening on 10 Sept 2018).
My code compiles without errors and all the other parts of my code (serial output or display functions from the manufacturer's library) work.

Does anybody else have this display and can test it with the TFT_eSPI.h library?

Best

Moses

No, I don't have any Waveshare "Shift Register" displays.
I suggest that you adapt
C:\Users\ .. \Documents\Arduino\libraries\TFT_eSPI\User_Setups\Setup60_RP2040_ILI9341.h

e.g.

#define RPI_ILI9486_DRIVER // 20MHz maximum SPI

// For the Pico use these #define lines
#define TFT_MISO  12 //0
#define TFT_MOSI  11 //3
#define TFT_SCLK  10 //2
#define TFT_CS    9 //20  // Chip select control pin
#define TFT_DC    8 //18  // Data Command control pin
#define TFT_RST   15 //19  // Reset pin (could connect to Arduino RESET pin)
#define TFT_BL    13 // LED back-light

#define TOUCH_CS 16 //21     // Chip select pin (T_CS) of touch screen

#define SPI_FREQUENCY  20000000

Remember to rename your custom Setup file and select in User_select file

Untested. But it looks fairly straightforward.

David.

Thanks @david_prentice
Sorry for the late reply, I was on holiday.

I tried your suggestion, but I still cannot see anything on the screen.
My code seems to do something, but the screen is black.

#include <SPI.h>
#include <stdio.h>
#include <TFT_eSPI.h>             // Invoke hardware library
TFT_eSPI tft = TFT_eSPI();        // Invoke custom library

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  
  delay(3000);
  Serial.println("Hello");
  
  //initialise TFT_eSPI library
  tft.init();
  tft.begin();

  delay(1000);

}

void loop() {
  // put your main code here, to run repeatedly:
  tft.fillScreen(TFT_WHITE); //if this line is commented out, the next serial output is much faster --> something seems to happen.
  Serial.println("White?");
  delay(200);

}

I have the feeling, that the backlight might be switched off. However, I cannot figure how to switch it on. I tried changing #define TFT_BACKLIGHT_ON HIGH to #define TFT_BACKLIGHT_ON LOW in the user setup, but without any obvious effect.

Do you have any suggestion on how to turn on the backlight?

EDIT:
The backlight works properly (I found a position on the device, where I can see it). I can switch it on/off and even dim it via digitalwrite or analogwrite commands.
Accordingly, the LCD screen seems to be "off".

If I run the TFT_ReadWrite_Test.ino, I only get errors like this
Pixel value written = 2
Pixel value read = 0
ERROR ^^^^
Pixel value written = 4
Pixel value read = 0
ERROR ^^^^
Pixel value written = 8
Pixel value read = 0
ERROR ^^^^
Pixel value written = 10
Pixel value read = 0
ERROR ^^^^
(and so on)

EDIT2:
I ran the ReadUserSetup tool. The result looks wrong to me. Shouldn't there be positive PIN-numbers?

TFT_eSPI ver = 2.3.70
Processor    = Transactions = Yes
Interface    = SPI
Display driver = 9486
Display width  = 320
Display height = 480

MOSI    = GPIO -111
MISO    = GPIO -112
SCK     = GPIO -110
TFT_CS   = GPIO -1
TFT_DC   = GPIO -1
TFT_RST  = GPIO -1
TOUCH_CS = GPIO -1

TFT_BL           = GPIO -1
TFT_BACKLIGHT_ON = HIGH

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

Display SPI frequency = 2.00
Touch SPI frequency   = 2.50

I further tried to use a "blank" Raspberry Pi Pico (only board, not used previously, no hardware attached).

If I run an example sketch from the TFT_eSPI library, and then read the User-Settings, the output is the same as above. (negative values for the Pins, pin numbers seem to be extended with a leading "1": MOSI pin is actually 11, not 111, MISO is 12,...)

I am not sure where the problem lies. If I flatten the waveshare sample code to one folder, I can successfully use it with the Arduino IDE and my setup. However, as soon as I try to use the same setup with @bodmer's library, I am not able to control the display except the backlight by using an analogwrite command.

Hi,
I am using the same hardware combination and got the display working with the
Bodmer tft library after contacting the author opening an issue.
I am runnig my test with the "Master" of the library copied at 2022-01-14.

See Question Support for Waveshare ILI9488 + RP2040 (Pico-ResTouch-LCD-3.5) · Issue #1551 · Bodmer/TFT_eSPI · GitHub

My config...

// Setup000_RP2040_ILI9488.h
// Works with Waveshare "Pico-ResTouch-LCD-3.5" HAT (SKU: 19907)

//#define RP2040_PIO_SPI  // Doesn't work for me
#define RPI_DISPLAY_TYPE  // <= Needed to get it working

#define ILI9488_DRIVER     // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)

#define TFT_MISO  12  //0
#define TFT_MOSI  11  //3
#define TFT_SCLK  10  //2
#define TFT_CS     9  //20  // Chip select control pin
#define TFT_DC     8  //8   // Data Command control pin
#define TFT_RST   15  //19  // Reset pin (could connect to Arduino RESET pin)
#define TFT_BL    13  //       LED back-light

//#define TOUCH_CS 21     // Chip select pin (T_CS) of touch screen

#define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6  // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7  // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8  // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF  // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts

#define SMOOTH_FONT

#define TFT_SPI_PORT 1 // Set to 0 if SPI0 pins are used, or 1 if spi1 pins used

// #define SPI_FREQUENCY   1000000
// #define SPI_FREQUENCY   5000000
// #define SPI_FREQUENCY  10000000
// #define SPI_FREQUENCY  20000000
// #define SPI_FREQUENCY  27000000
#define SPI_FREQUENCY  32000000
// #define SPI_FREQUENCY  40000000
//#define SPI_FREQUENCY  70000000

// Optional reduced SPI frequency for reading TFT
#define SPI_READ_FREQUENCY  20000000

// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
#define SPI_TOUCH_FREQUENCY  2500000

Cheers

Thank you very much @lame!
Your setup works for me as well now. I was able to run the tests from @bodmer 's library. The TFT_WriteRead_Test.ino throws errors for every read, but the display and touch tests work fine.

I have the feeling that this was the actual trick/solution:

#define TFT_SPI_PORT 1

Cool that it works for you as well.

The SPI Port and the Pin definition was Part 1 of the Solution
but Bodmer pointed me to #define RPI_DISPLAY_TYPE to activate to the 16Bit Command Mode.