MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields

@veter72,

I am attaching your project. There are some instructions in the "touchcode.cpp" file.

I really do not like the "URTouch.h" library. But many people use it. And it does the bit-bashing of the XPT2046 on digital#2-6 pins.

The "HCTFT_Touch.h" library works more reliably (for me). It bit-bashes the #2-6 pins
The phonecall example shows how you can have a "standard" project and use different Touch libraries to suit your hardware.

Only the FT6206 library is available through the Library Manager.
You should be able to Google for all the other libraries. Download the ZIP from GitHub. (Green button on right of GitHib page). Thin install library from ZIP.

Please let me know how you get on.

David.

phonecal_universal.zip (4.48 KB)

veter72_universal.zip (24.7 KB)

Hi guys
Thought you might be interested in a YouTube video covering a project of mine to build a dash display for my Rally Car using this LCD Library, and it actually works!

It looks nice!

Hi, David!

Thank you. The sketch you sent works fine.
I have filling that I must press pretty strong to accept my press. Where can I adjust needed pressure?

Thank you again for all your help and best regards.

You can change the minimum pressure by changing MINPRESSURE in Resistive TouchScreen.

The XPT2046 calculates the pressure. Neither URTouch or HCTFT_Touch have any method to change the threshold.
My finger does not require much pressure. A stylus needs even less pressure.

Incidentally, a Capacitive sensor works nicely with a gentle finger. No response at all to a plastic stylus.

David.

Hi, David!

I installed and tested the phonecall sketch, too.
It works fine.
I have only one question: If I install HCTFT_library, the compiler did not recognise HCTFT_touch.h file
Only when I insert into phonecal_universal.ino: #include <cTFT_Touch.h>, then compiler stop to complain.
And it is the same with veter72_universal.ino sketch. I must include #include <URTouch.h> into this sketch, too.
But the skect wokks fine.
And thank you again for your great contribution and help regarding this touch screens.

Best regards!

My apologies. The Arduino IDE scans the INO files for any library #includes.
It searches for the actual header location and adds this particular library to the "build list"
It kludges forward references etc so that you do not need to worry about them.

It treats C and CPP files like regular source files. i.e. it does not do any kludging.

If you add the #include for each library that you might use in the CPP file, the IDE will build everything ok.

The reason that I chose CPP for the conditional code was because the IDE does not handle conditionals very well in INO files.

The mystery is : why did it build ok for me?

David.

Hi!

Thank you for your answer. I learn something new again :slight_smile:

Best regards!

Hello !!!
Just biiiiiiiig Thank youuuuu !!!
You just saved my day with your library : I've been looking for how to get my screen to work for at least 4 days, on the cliffs of despair and suddenly I saw things on it !!!
Have a good day ! :wink:

Which controller do you have?

I do not own all the supported devices. If you have an uncommon controller you might be able to give me some feedback.

David.

Hey having some trouble with our mcufriend uno display running on a mega2560. When my partner initially tested the library all examples worked fine and he was drawing on the display and everything. After a switch was made to a second mega the display only gives a white screen. Now we can't get anything but a white screen on either mega. The LCD_ID_readreg was not run when the display was working but here is the output when it is run now and it seems to be giving an ID of 0x8080 which is not on your list of ID's.

reg(0x0000) 80 80       ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 80 80 80 80 Manufacturer ID
reg(0x0009) 80 80 80 80 80      Status Register
reg(0x000A) 80 80       Get Power Mode
reg(0x000C) 80 80       Get Pixel Format
reg(0x0061) 80 80       RDID1 HX8347-G
reg(0x0062) 80 80       RDID2 HX8347-G
reg(0x0063) 80 80       RDID3 HX8347-G
reg(0x0064) 80 80       RDID1 HX8347-A
reg(0x0065) 80 80       RDID2 HX8347-A
reg(0x0066) 80 80       RDID3 HX8347-A
reg(0x0067) 80 80       RDID Himax HX8347-A
reg(0x0070) 80 80       Panel Himax HX8347-A
reg(0x00A1) 80 80 80 80 80      RD_DDB SSD1963
reg(0x00B0) 80 80       RGB Interface Signal Control
reg(0x00B4) 8C 8C       Inversion Control
reg(0x00B6) 82 82 88 88 88      Display Control
reg(0x00B7) 80 80       Entry Mode Set
reg(0x00BF) 80 80 80 80 80 80   ILI9481, HX8357-B
reg(0x00C0) C4 C4 C4 90 90 80 80 80 80  Panel Control
reg(0x00C8) 80 80 80 80 80 80 80 80 80 80 80 80 80      GAMMA
reg(0x00CC) 80 80       Panel Control
reg(0x00D0) 80 80 80    Power Control
reg(0x00D2) 80 80 80 80 80      NVM Read
reg(0x00D3) 80 80 80 80 ILI9341, ILI9488
reg(0x00D4) 81 81 D3 90 Novatek ID
reg(0x00DA) 80 80       RDID1
reg(0x00DB) 80 80       RDID2
reg(0x00DC) 80 80       RDID3
reg(0x00E0) 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80     GAMMA-P
reg(0x00E1) 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80     GAMMA-N
reg(0x00EF) 80 80 80 80 80 80   ILI9327
reg(0x00F2) F1 F1 D4 A5 A4 9E C4 90 82 AC AC B2 Adjust Control 2
reg(0x00F6) 80 80 BA 80 Interface Control

Not sure if our display is broken now or what but thanks for any information you can give us.

What ID did the screen have (when it worked) ?
Is it an Open-Smart pcb or a Mcufriend pcb?

If it is Open-Smart you need to enable the appropriate SPECIAL.

Plug the Uno shield into a Uno. Does it work?

David.

It is a mcufriend display. The serial monitor wasn't open when it worked so unfortunately we didn't get the ID then. Assuming 0x8080 is not a valid ID? I will put the shield on an uno tonight and report the findings.

Does not work on an uno. Same id of 8080 when running readreg sketch and graphicstest with just a white screen.

It sounds like you have killed it. There is no controller that matches your LCD_ID_readreg output.
Only you know what you have done to it.

You can try tft.begin(0x9329) but I suspect it just needs a burial.

David.

p.s. the graphictest_kbv sketch reports the ID on the Adafruit_tests screen. Obviously only any good before you killed it.

Hi,

I need some help, I bought a 3.5" mcu friends display, and I have some problem.
I have mirrored screen on both axis, and the collors are wierd, I think it inverted, but if I invert the colors, I have still some problem. Like the red and the blue collors are not right.

Can someone help me?

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) 00 00 80 00 Manufacturer ID
reg(0x0009) 00 00 00 00 00 Status Register
reg(0x000A) 08 08 Get Powsr 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) 00 00 00 00 00 RD_DDB SSD1963
reg(0x00B0) 00 00 RGB Interface Signal Control
reg(0x00B4) 0C 0C Inversion Control
reg(0x00B6) 02 02 08 08 08 Display Control
reg(0x00B7) 00 00 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 44 44 44 10 10 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) 80 80 00 00 00 NVM Read
reg(0x00D3) 00 00 00 00 ILI9341, ILI9488
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 80 80 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) F1 F1 54 A5 24 1E 44 90 02 2C 2C 32 Adjust Control 2
reg(0x00F6) 00 00 3A 00 Interface Control

I am not a a PC. It looks like a Himax HX8357-D controller. And you have a very OLD library version.

Goto the Library Manager and upgrade the MCUFRIEND_kbv library.
Please report back with the ID

David.

Edit. I checked on the PC. It is actually a Novatech NT35310. From memory, the first ones that appeared on Ebay were set up for 8080-16 interface. Please post a photo of bad coloured screen from graphictest_kbv sketch.
I suggest that you ask for a refund unless you are prepared to do some SMD soldering.

Thank you for helping David!

I updated the library, this is the result:

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) 00 00 80 00 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) 00 00 00 00 00 RD_DDB SSD1963
reg(0x00B0) 00 00 RGB Interface Signal Control
reg(0x00B4) 0C 0C Inversion Control
reg(0x00B6) 02 02 08 08 08 Display Control
reg(0x00B7) 00 00 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 44 44 44 10 10 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) 80 80 00 00 00 NVM Read
reg(0x00D3) 00 00 00 00 ILI9341, ILI9488
reg(0x00D4) 01 01 53 10 Novatek ID
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 80 80 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) F1 F1 54 A5 24 1E 44 90 02 2C 2C 32 Adjust Control 2
reg(0x00F6) 00 00 3A 00 Interface Control

The library update fixed everything, every function is working perfectly, big thanks David!

If everything is working ok, it means that the Ebay vendors have fixed the 8080-16 vs 8080-8 interface problem.

It always amazed me that they put the original 8080-16 versions on the market in the first place.

The NT35310 works very well (with the correct interface).

David.

A user has reported that his SPFD5408 shield has visible scan lines on the display.
Here is a youtube video
Here is another youtube video

Although Ebay vendors often call these 2.4" shields "SPFD5408" very few contain genuine Orise SPFD5408.
Are there any other ID=0x5408 owners with a "bad" display?

David.