Go Down

Topic: MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields (Read 406534 times) previous topic - next topic


After I observe the flexible part of the lcd, it looks like this lcd uses a 8080 9 BIT parallel configuration.
IM3 => GND
IM2 => IOVCC via unknown chip
IM1 => GND via unknown chip
IM0 => IOVCC via unknown chip

the unknown chip is 6 pin ic with ground plane,
and have marking code

IM2 =|""""""""|= IOVCC
IM0 =|          |= IOVCC
IM1 =| o        |= GND

However, if the IC i remove, and its IMx pins I connect directly to the corresponding path.
lcd has unknown ID or cannot be read.


Regarding unlock.   Many devices use reg(0xC0).   Normally 0x00 to unlock.
If the device uses another location like Himax,  you have to know the key before you start.

Regarding the ID detection.   Yes, it is fine to remove that FFFF test.   If anyone owns a R61526 I can show them how to use the R61526 EEPROM.

I would still like to see one clear photo of a Penguin screen e.g. Portrait.   (BLUE)

You can change attributes for 0x2910 e.g. REV_SCREEN, INVERT_SS, INVERT_RGB, ... to get something readable

When I can see a clear photo,  I can probably suggest different values in 0x3A register.

Regarding the Pakistani gentleman.   Yes,  that is the one.   Picture is 7 years old.    You can try emailing him.

On a ILI9341 IM# = 0.0. could be 8080-8 (0000), 8080-16 (0001), 3-wireSPI (0101)

My money is on 8080-8 or 8080-16



Dear David,
I know I don't have a picture of cute girl in my avatar, but could I still get an answer? I don't mind if it's no.
I would just like to know, so if you are not interested I can devote my time and interest elsewhere.
Thank you.


My apologies.   I missed your post #2383.

Your photo with 0x9320 require INVERT_SS attribute
If 0x9325 shows correct text but in reverse,  you remove the REV_SCREEN attribute.

The easiest solution is to use tft.begin(0x9325) and add tft.invertDisplay(1) to setup() in most sketches.

Since the graphictest_kbv example deliberately has a "INVERT_DISPLAY" screen,  you need to  put tft.invertDisplay(1) in the loop() instead of setup()

What ID is reported in the Adafruit_Tests report screen?
What is reported in SOFTWARE SCROLL?  e.g. readPixel()) error   

Are you happy with editing library files?


p.s. I don't think that tongbajiel looks like that photo.    I think that he is male and comes from Indonesia.


No worries. It's understandable that beautiful people like tongbajiel get all the attention, and ugly and dirty old men like me are occasionally overlooked.:P

To answer to your questions.
readPixel() read as BRG

In Adafruit test screen
ID: 0x1

I have done some fiddling my own and got the text mirrored. I made these changes to the MCUFRIEND_kbv::begin();

Code: [Select]

#ifdef MDM63
 case 0x9999:
      _lcd_capable = 0 | READ_BGR | REV_SCREEN | MIPI_DCS_REV1;
              goto common_9320;


Now the image is correct, but it still has issues to initialize sometimes. It works every time I upload a sketch, but sometimes after reset or power off (disconnecting USB cable) if fails to initialize. It looks like it's trying and the screen flashes black couple of times very rapidly, but it stays white.

Could this be because some timing values in the registers are not set correctly? I don't think there is anything physically wrong with the display. I have tested this with three different Arduino Uno's, with same behavior, so I think I can rule the Arduino's out of the equation.

"Are you happy with editing library files?"
Editing libraries with text editor? I would not go as far and say it makes me "happy", but I can manage. ;) To be clear, I have some experience in coding, but I have absolutely no experience on TFT displays and their inner workings. So basically I can code some and google plenty, and I am willing to learn.


Well,   you have managed to edit the MCUFRIEND_kbv.cpp file successfully.

It is VERY unlikely that it is MIPI compliant.

I would expect:
Code: [Select]

    case 0x0001:
        _lcd_capable = 0 | REV_SCREEN | READ_BGR | INVERT_SS;
        goto common_9320;

There are several legacy controllers with similar Power Control registers and READ_BGR.   e.g. R61580 and UC8230

I would choose whichever controller starts up the most reliably and shows a steady display.
It is easy enough to alter the attributes to get the directions and colours correct.

Check Portrait is correct.  ribbon at bottom of screen.
Check colours are correct
Check directions of text.
Check directions of vertical scroll.   (no,  a 9320 can not Band Scroll)
Check Software Scroll
Check Invert Display

You can go through the checklist.   Or post a video.

Then you can test the readPixel example.   Followed by calibrating your Touch Panel.



Thanks. I will do as you suggest. I will let you know if I have any success. This might take a while as I am very busy for several weeks. All work no play makes Jack a dull boy. :smiley-confuse:


Hi, get the same register results as mdm63 but trying the id 0x9320 or 0x9325 still gives white screen.


I have no idea what your controller is.   An ID=0x0001 is pretty unlikely.   But mdm63 seemed to get a response for 0x9320 and 0x9325 even if the Power Registers need adjusting for optimum picture.

I would follow #2382.   Ebay or AliExpress should refund your money because your item does NOT work.

If the shop asks its supplier what controller is mounted,   I will add support for it.
It costs the shop nothing to ask its supplier.   It costs the shop a lot of money to refund every customer that received this display.

What country are you in?




David thank you very much for your wonderfull lib and your hard work !!!

i need your help with a TFT that dont work, the wiring is connected to the 8 bit databus, but the TFT take me only a white screen.

my first display and then something like that... :)

I test with the adafruit_TFTLCD, UTFT Rinky and your mcufriend_kbv lib.

Can you please Help me with the LCD_ID_readnew log ?
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)

diagnose any controller
reg(0x0000) 00 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 61 00 00 Status Register
reg(0x000A) 00 08 Get Powsr Mode
reg(0x000C) 00 06 Get Pixel Format
reg(0x0030) 00 00 00 00 00 PTLAR
reg(0x0033) 00 00 00 00 00 00 00 VSCRLDEF
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(0x00B3) 00 00 1B 1B 1B Frame Memory
reg(0x00B4) 00 02 Frame Mode
reg(0x00B6) 00 0A 82 27 04 Display Control
reg(0x00B7) 00 06 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 00 21 00 00 00 00 00 00 00 Panel Control
reg(0x00C1) 00 10 10 10 Display Timing
reg(0x00C5) 00 31 Frame Rate
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA
reg(0x00CC) 00 71 Panel Control
reg(0x00D0) 00 00 00 00 Power Control
reg(0x00D1) 00 00 00 00 VCOM Control
reg(0x00D2) 00 00 00 Power Normal
reg(0x00D3) 00 00 93 41 ILI9341, ILI9488
reg(0x00D4) 00 00 00 00 Novatek
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 00 RDID3
reg(0x00E0) 00 0F 16 14 0A 0D 06 43 75 33 06 0E 00 0C 09 08 GAMMA-P
reg(0x00E1) 00 08 2B 2D 04 10 04 3E 24 4E 04 0F 0E 35 38 0F GAMMA-N
reg(0x00EF) 00 03 80 02 02 02 ILI9327
reg(0x00F2) 00 02 02 02 02 02 02 02 02 02 02 02 Adjust Control 2
reg(0x00F6) 00 01 00 00 Interface Control

I would like to address the display with the 8bit data bus and hope the display has not only a 16 bit data bus. (Arduino UNO R3)

I test one week with the display, i hope i didn't play it broken.

the specs are in the attachment...

the completet specs from the seller its here...
but the display doesn't exist anymore.

In the specs from the seller its an ili9325, but the libs say me its a ili9341... :smiley-confuse:

Here is the link to the 2.4 TFT version, but the pins are a bit different.

thanks digi


You have a regular ILI9341 with 16-bit bus.
Plug the shield into a Uno, Mega,  Due, ... and it will just work.


Oops.   It is not a Uno shield.   You must buy a 40-pin Adapter shield that will plug into a Mega and provide the level shifting.
I suggest that you use UTFT (or the appropriate SPECIAL with MCUFRIEND_kbv)


So, I tried using your library with an arduino due. Right now I am using a 2.8" TFT LCD shield. At first, mainly all examples worked well, with the exception of demo 320 x 240 and the touchscreen demo. Since i got to make the rest of them working, i tried to fix the touchscreen, as I couldn't even get past the calibration instruction screen.

Looking throughout the forum, I found that the pins needed to be changed. Finally, I got a combination which got me past the instruction screen which was the following:

ILI9320 => YP=A2, XM=A3, YM=8, XP=9

After calibrating, I thought it was finally set up, however, when I tried doing the drawing example, I noticed that when i traced to the left, the pointer went up, and vice-versa.

Been reading a couple of hours, however, haven't found a clue on how to fix this.

Can I get some help please?



Update / replace with current library via Library Manager.

The Calibration sketch will diagnose the correct pins for XM, YP etc
And give you the physical TS_LEFT, TS_TOP etc values for Portrait orientation.

XP, XM pins refer to the  short side of the physical screen i.e. pixel x coordinate in portrait..

In Landscape orientation the logical values map differently to the physical values.
Study the Touch example sketches.



Updated the library, howver the calibration example didn't work. Still stuck with inverted axis at the drawing example.

Kind regards,

Go Up