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

Good Morning!

I was able to run 4 samples from the MCUFRIEND_kbv library (showBMP_kbv_as7; GLUE_Demo_480x320; graphictest_kbv; testcard_kbv), make some changes in SKETCH. Other examples of this library and other libraries did not work, why?
To create a SKETCH from scratch will I have to make edits in other libraries?

You should run the graphictest_kbv sketch. Try different IDs. e.g. 0x9090, 0x9481, 0x9486, 0x9488, 0x1581, ...

Report back with which ID works best. i.e. correct colours, text, rotations, directions, ...

When you have found the best ID, you use it in your sketches.
Tell UTFTGLUE.h this ID and every GLUE sketch will work without any editing.

David,

I made once again LCD_ID_readreg

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 00 00 Manufacturer ID
reg(0x0009) 00 00 00 00 00 Status Register
reg(0x000A) 02 02 Get Power Mode
reg(0x000C) 00 01 Get Pixel Format
reg(0x0061) 20 21 RDID1 HX8347-G
reg(0x0062) 22 22 RDID2 HX8347-G
reg(0x0063) 22 23 RDID3 HX8347-G
reg(0x0064) 20 21 RDID1 HX8347-A
reg(0x0065) 20 21 RDID2 HX8347-A
reg(0x0066) 22 23 RDID3 HX8347-A
reg(0x0067) 22 23 RDID Himax HX8347-A
reg(0x0070) 20 21 Panel Himax HX8347-A
reg(0x00A1) 20 21 20 21 20 RD_DDB SSD1963
reg(0x00B0) 20 20 RGB Interface Signal Control
reg(0x00B4) 20 20 Inversion Control
reg(0x00B6) 22 22 22 22 22 Display Control
reg(0x00B7) 22 23 Entry Mode Set
reg(0x00BF) 22 23 22 23 22 23 ILI9481, HX8357-B
reg(0x00C0) 00 01 00 01 00 01 00 01 00 Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA
reg(0x00CC) 00 01 Panel Control
reg(0x00D0) 00 01 00 Power Control
reg(0x00D2) 02 02 02 02 02 NVM Read
reg(0x00D3) 02 03 02 03 ILI9341, ILI9488
reg(0x00D4) 00 01 00 01 Novatek ID
reg(0x00DA) 02 03 RDID1
reg(0x00DB) 02 03 RDID2
reg(0x00DC) 00 01 RDID3
reg(0x00E0) 20 21 20 21 20 21 20 21 20 21 20 21 20 21 20 21 GAMMA-P
reg(0x00E1) 20 21 20 21 20 21 20 21 20 21 20 21 20 21 20 21 GAMMA-N
reg(0x00EF) 22 23 22 23 22 23 ILI9327
reg(0x00F2) 22 23 22 23 22 23 22 23 22 23 22 23 Adjust Control 2
reg(0x00F6) 22 23 22 23 Interface Control

@Andron,

#1679 and #1687 show different results. I do not believe that you are plugged in properly. Every male pin should connect intimately with its corresponding female socket.
You should always get the same result.

Have you tried plugging it into another Uno, Mega, Zero, Due, ... ?
Do you get the same output?

David.

I have 2- UNO R3.
Results are identical.
I checked connections - everything is OK.

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

Go on. You are taking the p*ss. #1679, #1687 and #1689 all show different results.

Some Renasas R61526 displays appeared without proper sticky pads. So the TFT module was shorting out against the pcb. Dismantling a module from the pcb has to be done very carefully. Do not try it until you have some sticky foam pads to mount it properly.

in #1684 I asked:

How did you get a "red" screen? Other "readreg" sketches apply random initialisations.
You can try tft.begin(0x9320) or tft.begin(0x9325)

You appear to have at least one set of male pins plugged in.
I have never used one of those perspex cases. Do they stress the pcb? Do the mounting bolts short?

If you are prepared to answer questions, we can offer advice. e.g. how to check for shorts.

David.

Good afternoon!
I tried several IDs in the graphictest_kbv sketch, the results follow:

--- They did not work.
-0x9320; 0x9325; 0x9326; 0x9335; 0x8340; 0x8347; 0x8352; 0x8353; 0x8833; 0x61509;
0 x 0164; 0x1121; 0x1289; 0x1963; 0x19122; 0x5420; 0x7753; 0x7793

--- OPAQUE COLOUR, RESOLUTION OK, PORTRAIT AND PORTRAIT_REV reversed, LANDSCAPE and LANDSCAPE_REV ok (horizontal scrolling).
-0x9327; 0x9329; 0x9341

--- COLOR OK, RESOLUTION OK, PORTRAIT AND PROTRACK_REV reversed, LANDSCAPE and LANDSCAPE_REV ok (horizontal scrolling).
-0x9481; 0x9090; 0x9481; 0x9486; 0x9488; 0x1581; 0x8357; 0x61581;

--- It worked correctly.
-0x6814;
COLOR OK, RESOLUTION OK, PORTRAIT AND PORTRAIT_REV OK.
LANDSCAPE and LANDSCAPE_REV ok (horizontal scrolling), why?

First off. Your 3.5" display is 320x480. There is absolutely no point in trying any 240x320 or even 240x400 controllers.

So we have concluded that you probably have a Raydium RM68140 controller.

  1. Edit every regular sketch: if (ID == 0xD3D3) ID = 0x6814;
  2. Edit UTFTGLUE.h too. Then it will work with every GLUE sketch automatically.

That is it. Your write-only screen can never read GRAM or read registers.
But it can do everything else. And it works quite fast too.
Your XPT2046 Touch controller will work with the URTouch.h library.

The Uno shields work on a Mega2560 but are appallingly SLOW.

David.

I collected on wires - the same effect.
I tested TFT LCD_ID_Reader from http://misc.ws
Reading ID...0x0001
changing values - lcdFillScreen(0xF800); I saw different colors on the screen

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

Good evening!

I'm trying to calibrate the 3.95 "MCUFRIEND TFT display, why can not I use the touch of the display?
I have tested several libraries, including URTouch.h library, and the touch of the display does not work. Why?

As far as I can remember, you have a non-standard Mega Shield with RM68140 controller.

These shields should have a XPT2046 Touch controller. Use the URTouch library. Try the examples.

Just check for (myTouch.dataAvailable() == true) and read the position to the Serial Terminal.

I have a non-standard Mega Shield with HX8357-D controller. I will try it tomorrow.

David.

david_prentice:
As far as I can remember, you have a non-standard Mega Shield with RM68140 controller.

These shields should have a XPT2046 Touch controller. Use the URTouch library. Try the examples.

Just check for (myTouch.dataAvailable() == true) and read the position to the Serial Terminal.

I have a non-standard Mega Shield with HX8357-D controller. I will try it tomorrow.

David.

It's a MEGA SHIELD, but the controller that worked was the RM6814.
I have edited all regular sketches: if (ID == 0xD3D3) ID = 0x6814 and also UTFTGLUE.h.
Sorry for my ignorance but, (myTouch.dataAvailable () == true), is it an edit?
Tests with the URTouch library samples, the characters were inverted, and the serial monitor returned no result.
The test with the XPT2046 library example, the screen turns white, and the serial monitor 1 (!! ⸮⸮⸮ 1 (!! ⸮⸮⸮ 1 (!! ⸮⸮⸮ 1.
The test with the UTouch_Calibr_kbv library example, the characters are correct, and the serial monitor shows UTouch_Calibr_kbv,
But the touch does not work.

The test with the example of the TouchScreen_Calibr_kbv library, the characters are correct, and the serial monitor shows on TouchScreen.h Calibration
,
But the touch does not work.

Thanks for your patience and your help.

I tried my 8-bit HX8357-D Mega Shield. Anyway, this Shield does not seem to work.
The Touch on my 16-bit RM68140 Mega Shield does work.

The 8-bit Shield has a HR2046 chip which is supposed to be the same as XPT2046, ADS7843, ADS7846, ...

It looks as if it is wired like all the other Mega Shields.
i.e. BUSY=7, SCK=6, CS=5, MOSI=4, MISO=3, IRQ=2.

I will try it with a Logic Analyser tomorrow.

David.

Hi, David! Thanks a lot for your great library! It works fine with my 3.5 480x320 ILI9481 shield and arduino uno, but i want to use this shield with esp32 (it is only important that not with arduino uno )... I will be very thankful if you say what should i change in your library or suggest me some other libraries so that i can do this. Sorry for my question, but i couldn t find the solution for myself.

I don't have an ESP32. I do have an ESP8266 Arduino board. The shield fits but the GPIO pins are not all available.

It does not have enough GPIO pins for a parallel TFT. It works beautifully with an SPI TFT e.g. ILI9341.

Which ESP32 board do you have?
If it receives UNO shields, I will buy one for myself.

I have no inclination to buy a breakout board.

David.

david_prentice:
I don't have an ESP32. I do have an ESP8266 Arduino board. The shield fits but the GPIO pins are not all available.

It does not have enough GPIO pins for a parallel TFT. It works beautifully with an SPI TFT e.g. ILI9341.

Which ESP32 board do you have?
If it receives UNO shields, I will buy one for myself.

I have no inclination to buy a breakout board.

David.

I have doit esp32 devkit v1 like this https://ru.aliexpress.com/item/ESP32-Development-Board-WiFi-Bluetooth-Ultra-Low-Power-Consumption-Dual-Cores-ESP-32-ESP-32S-Board/32772569634.html . And it doesn t recieve UNO shields but i will make a board with soldered esp32 and ili9481 (now i am connecting esp 32 and ili9481 with arduino dupon wires). I haven t problems with hardware, but the libraries written for arduino UNO even don t compile. Thanks for a quick answer!

I could buy ESP32 module from a UK Seller.

I could solder it onto a UNO Protoshield. I am not very enthusiastic. i.e. time and effort for something that is not "standard".

I have no problems with buying and porting to any board with "Uno style headers". For example. Nucleo, FRDM, STM32 Maple, ...

What wiring do you propose?
Does it have enough GPIO pins for TFT? And still have pins for USART, SPI, I2C ?
Can you persuade me?

David.

I want to do a weather widget like this ESP8266+3.5" TFT Internet Weather Station - Final version - YouTube . So, i think that using esp32 will be convenient to do this. But if you say that it is so difficult (or not difficult for you, but you don t want to do this) i will make it by other way (now i have an idea to drive display using arduino nano but get data using esp8266). Thanks again for such useful and convenient library.
P.S Yes, esp32 have many gpios (ADC also). https://cdn-shop.adafruit.com/product-files/3269/pinout_wroom_pinout.png .My board have less pins, but i think also enough.

Yes, it looks pretty cool.

It is incredibly easy to use a 240x320 ILI9341 via SPI.
Your video shows a 240x400 parallel ILI9327.

My Wemos ESP8266 board does not have enough GPIO.
Quite honestly, I do not like the idea of running an 8-bit parallel on 11 GPIO pins.

But if you can find an SPI module, that would be fun to use. It only costs you a chip-select pin.
SPI ILI9481 or HX8357D are available. But a lot more expensive than parallel versions.

As I said earlier. If you design and propose a wiring scheme, I could be persuaded to mount an ESP board on a Uno Protoboard.

David.

david_prentice:
I tried my 8-bit HX8357-D Mega Shield. Anyway, this Shield does not seem to work.
The Touch on my 16-bit RM68140 Mega Shield does work.

The 8-bit Shield has a HR2046 chip which is supposed to be the same as XPT2046, ADS7843, ADS7846, ...

It looks as if it is wired like all the other Mega Shields.
i.e. BUSY=7, SCK=6, CS=5, MOSI=4, MISO=3, IRQ=2.

I will try it with a Logic Analyser tomorrow.

David.

Okay, thank you David for the help.
I will continue working and looking for alternatives.

Paulo