Need help with TFT 2.4 shields with the SPFD5408 controller

I have a TFT 2.4 shields with the SPFD5408 controller that white screens with any code using the Adafruit TFT libraries.

After a lot of google and youtube I found this library:

And the TFT works using all the examples.

My question is I'm building a project with this code below, how do I adjust it to use the SPFD5408 variant library? (if that's possible?)

Solved! well sort of :slight_smile:

  1. run LCD_ID_readreg.ino to identify the actual controller

  2. or just report the result of tft.readID()
    it is unlikely that you have a genuine SPFD5408

  3. then we can tell you which libraries are suitable. (there are many libraries for the popular chips)

  4. the item on PasteBin seemed to have some random includes.

  5. if you want help with "porting" a working program to your hardware and your library, post a link to the original working code.

  6. if you have solved it for yourself, please post an explanation. this will benefit others.

David.

david_prentice:
6. if you have solved it for yourself, please post an explanation. this will benefit others.

David.

Thanks, David.

I solved by using uninstalling the Arduino IDE and all my Arduino folders, and when I went with a fresh install it seems to have worked :o (though the screen is a little dim and dims out around every 10 seconds, but usable).

That code was the original that came with the project, there is a more advanced version I would love to get working if you can at all help with that as it uses the Adafrut Libarys I can get to work with this TFT.

The project code is here, but think it may be for a 2'8" rather than 2'4"so not sure how possible it will be to get working with what I am limited to here during the lockdown.

But here is the code if you have any time to help pint me in the right direction.

Also a youtube video of the project

Oh and this is what I get from LCD_ID_Reader

Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 00	ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) FF FF FF FF	Manufacturer ID
reg(0x0009) 00 00 00 00 00	Status Register
reg(0x000A) 08 08	Get Power Mode
reg(0x000C) 66 66	Get Pixel Format
reg(0x0061) 00 00	RDID1 HX8347-G
reg(0x0062) 00 00	RDID2 HX8347-G
reg(0x0063) 00 00	RDID3 HX8347-G
reg(0x0064) 00 00	RDID1 HX8347-A
reg(0x0065) 00 00	RDID2 HX8347-A
reg(0x0066) 00 00	RDID3 HX8347-A
reg(0x0067) 00 00	RDID Himax HX8347-A
reg(0x0070) 00 00	Panel Himax HX8347-A
reg(0x00A1) FF FF FF FF 00	RD_DDB SSD1963
reg(0x00B0) 00 00	RGB Interface Signal Control
reg(0x00B4) 00 00	Inversion Control
reg(0x00B6) 00 00 00 00 00	Display Control
reg(0x00B7) 00 00	Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00	ILI9481, HX8357-B
reg(0x00C0) 00 00 00 00 00 00 00 00 00	Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00	GAMMA
reg(0x00CC) 00 00	Panel Control
reg(0x00D0) 00 00 00	Power Control
reg(0x00D2) 00 00 00 00 00	NVM Read
reg(0x00D3) 00 00 00 00	ILI9341, ILI9488
reg(0x00D4) 00 00 00 00	Novatek ID
reg(0x00DA) 00 00	RDID1
reg(0x00DB) 00 00	RDID2
reg(0x00DC) 00 00	RDID3
reg(0x00E0) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00	GAMMA-P
reg(0x00E1) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00	GAMMA-N
reg(0x00EF) 00 00 00 00 00 00	ILI9327
reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00	Adjust Control 2
reg(0x00F6) 00 00 00 00	Interface Control

The LCD_ID_readreg report does not seem to show any ID.
What does tft.readID() from MCUFRIEND_kbv say?

It looks as if you have a MIPI-style controller e.g. ILI9341. But it is NOT an ILI9341.
It is definitely NOT an SPFD5408.

David.

david_prentice:
The LCD_ID_readreg report does not seem to show any ID.
What does tft.readID() from MCUFRIEND_kbv say?

Sorry I don't understand this part, I have the MCUFRIEND_kbv library but how do I find does tft.readID()? is it this from the serial print?

tft.readID() finds: ID = 0x1526

Ah-ha. You have a Renesas R61526 controller. As far as I know, MCUFRIEND_kbv is the only library that supports R61526.

You need to "unlock" the R61526 for LCD_ID_readreg to report all the registers.

Regarding "porting" your program.

#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

is all that you need to do.

David.

david_prentice:
Ah-ha. You have a Renesas R61526 controller. As far as I know, MCUFRIEND_kbv is the only library that supports R61526.

You need to "unlock" the R61526 for LCD_ID_readreg to report all the registers.

Regarding "porting" your program.

#include <MCUFRIEND_kbv.h>

MCUFRIEND_kbv tft;



is all that you need to do.

David.

Thanks David

This is what I have now #include "TimerOne.h" - Pastebin.com but I get this error

CombinedSliderControl:55:16: error: conflicting declaration 'Adafruit_TFTLCD tft'

 #define LCD_CS A3 // Chip Select goes to Analog 3

                ^

C:\Users\BROOKL~1\AppData\Local\Temp\arduino_modified_sketch_847185\CombinedSliderControl.ino:109:21: note: in expansion of macro 'LCD_CS'

 Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

                     ^~~~~~

C:\Users\BROOKL~1\AppData\Local\Temp\arduino_modified_sketch_847185\CombinedSliderControl.ino:8:15: note: previous declaration as 'MCUFRIEND_kbv tft'

 MCUFRIEND_kbv tft;

               ^~~

Multiple libraries were found for "TouchScreen.h"
 Used: D:\Documents\Arduino\libraries\TouchScreen
 Not used: D:\Documents\Arduino\libraries\Adafruit_TouchScreen
exit status 1
conflicting declaration 'Adafruit_TFTLCD tft'

You can only have one TFT constructor (and include) at a time. You just comment out the unused lines e.g.

// #include <Adafruit_TFTLCD.h> // Hardware-specific library

// Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

I would follow the const int TS_LEFT style rather than the weird #define TS_MINX that you are using. But your style should work fine.

David.

david_prentice:
You can only have one TFT constructor (and include) at a time. You just comment out the unused lines e.g.

// #include <Adafruit_TFTLCD.h> // Hardware-specific library

// Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);




David.

Thank you so much for all your help with this.

I have commented out the lines above, but just get a white screen

Look at your ID logic. You are forcing 0x9341 when the ID is actually 0x1526 !!
Your setup() sequence should be:

  uint16_t identifier = tft.readID();
  tft.begin(identifier);

David.

david_prentice:
Look at your ID logic. You are forcing 0x9341 when the ID is actually 0x1526 !!
Your setup() sequence should be:

  uint16_t identifier = tft.readID();

tft.begin(identifier);




David.

SO it should be:

uint16_t identifier = tft.readID();
  
    identifier = 0x1526;
  }


  tft.begin(identifier);

Really sorry about this David, I really don't do well with code.

No. You should always read the ID. And use the result.

Yes, 0x1526 will work with your Shield.
Buy a new Shield and it probably contains a different controller.

MCUFRIEND_kbv supports about 40 controllers. Your program will still work.

Adafruit_TFTLCD or JoaoLopesF's SPFD5408 library supports 3 or 4 controllers.
These libraries will work fine with those controllers.

David.