Go Down

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

foobarrer

Thanks David.

I downloaded the latest mcufriend_kbv master lib and run the LCD_ID_readreg.ino again and I attached the result below. Register 0x00 0xBF 0xD3 0xEF are all 00, does it mean if we get 00 result from reading these registers then the controller IC should be HX8357-D?

By the way, I bought it on eBay, here is the link of the item http://www.ebay.com/itm/401202226171?_trksid=p2057872.m2748.l2649&ssPageName=STRK%3AMEBIDX%3AIT

Pictures of the LCD I received, a little different from the item's pictures on eBay.



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



david_prentice

Life is becoming easier.   The shields often have a sticky label:  35310
This is another good clue.

My earlier reply was a little premature.   I saw reg(0x0004) with xx 00 80 00 which might be HX8357-D.
However I then need to write a special value to reg(0xB9) and read reg(0xD0) to confirm.

I will try to find a datasheet for "NT35310" or RM68042 and come back to you.
Edit. I have found RM68042 datasheet and your device is not a RM68042.

David.

joe_smits

Hello to everyone!
What is the controller IC of the 2.4 inch mcufriend (red pcb, 8-bit parallel interface) TFT LCD according to the info below?
I bought it on aliexpress, here is the link of the item https://ru.aliexpress.com/item/LCD-module-TFT-2-4-inch-TFT-LCD-screen-for-Arduino-UNO-R3-Board-and-support/32653693580.html?spm=2114.13010608.0.0.DOvj4g
Pictures of the LCD I received, a little different from the item's pictures on ali.

    readReg(0x00, 2)  0x00, 0x00  ID: ILI9320, ILI9325, ILI9335, ...
    readReg(0x04, 4)  0x00, 0x00, 0x00, 0x00 Manufacturer ID
    readReg(0x09, 5)  0x00, 0x00, 0x61, 0x00, 0x00 Status Register
    readReg(0x0A, 2)  0x00, 0x08 Get Powsr Mode
    readReg(0x0C, 2)  0x00, 0x06 Get Pixel Format
    readReg(0x61, 2)  0x06, 0x06 RDID1 HX8347-G
    readReg(0x62, 2)  0x06, 0x06 RDID2 HX8347-G
    readReg(0x63, 2)  0x06, 0x06 RDID3 HX8347-G
    readReg(0x64, 2)  0x06, 0x06 RDID1 HX8347-A
    readReg(0x65, 2)  0x06, 0x06 RDID2 HX8347-A
    readReg(0x66, 2)  0x06, 0x06 RDID3 HX8347-A
    readReg(0x67, 2)  0x06, 0x06 RDID Himax HX8347-A
    readReg(0x70, 2)  0x06, 0x06 Panel Himax HX8347-A
    readReg(0xA1, 5)  0x06, 0x06, 0x06, 0x06, 0x06 RD_DDB SSD1963
    readReg(0xB0, 2)  0x06, 0x00 RGB Interface Signal Control
    readReg(0xB4, 2)  0x00, 0x02 Inversion Control
    readReg(0xB6, 5)  0x02, 0x0A, 0x82, 0x27, 0x04 Display Control
    readReg(0xB7, 2)  0x04, 0x07 Entry Mode Set
    readReg(0xBF, 6)  0x07, 0x00, 0x00, 0x00, 0x00, 0x00 ILI9481, HX8357-B
    readReg(0xC0, 9)  0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 Panel Control
    readReg(0xC8, 13)  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 GAMMA
    readReg(0xCC, 2) 0x00, 0x3A Panel Control
    readReg(0xD0, 3) 0x3A, 0x00, 0x00 Power Control
    readReg(0xD2, 5) 0x00, 0x00, 0x00, 0x03, 0x03 NVM Read
    readReg(0xD3, 4)  0x03, 0x00, 0x93, 0x40 ILI9341, ILI9488
    readReg(0xDA, 2)  0x00, 0x00  RDID1
    readReg(0xDB, 2)  0x00, 0x00  RDID2
    readReg(0xDC, 2)  0x00, 0x00  RDID3
    readReg(0xE0, 16)  0x00, 0x08, 0x0E, 0x12, 0x05, 0x03, 0x09, 0x47, 0x86, 0x2B, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 GAMMA-P
    readReg(0xE1, 16)  0x00, 0x08, 0x1A, 0x20, 0x07, 0x0E, 0x05, 0x3A, 0x8A, 0x40, 0x04, 0x18, 0x0F, 0x3F, 0x3F, 0x0F GAMMA-N
    readReg(0xEF, 6)  0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F ILI9327
    readReg(0xF2, 12)  0x0F, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 Adjust Control 2
    readReg(0xF6, 4); // 0x02, 0x01, 0x00, 0x00  Interface Control

This tft lcd module is connected to stm32 board. It seems that readReg output looks good and i believe that all wire soldered well.
From this string (readReg(0xD3, 4)  0x03, 0x00, 0x93, 0x40 ILI9341, ILI9488) i see that i have ili9340 controller probably.
So i download lastest MCUFRIEND_kbv-master and look for init code for ili9340 chip.
The first code, labeled as "BOE 2.4" give me black screen with slow weak flickering. I try fill screen function with red color - nothing happens on lcd.
The second code, labeled as "Adafruit_TFTLCD" giv e me white screen. If i try fill screen with red color - i got black screen. Any color (white, red, blue ... any) give me black screen.

questions:
1. What is the controller IC?
2. if IC is ili9430 - what is correct init code ?

Joe.

sorry for terrible english

david_prentice

You have an ILI9340.   It is very similar to the ILI9341.   If you try the Beta library on GitHub,  ID=0x9340 will use the 0x9341 initialisation.

If you have an earlier version,  I suggest that you force tft.begin(0x9341) and report back.

If your ILI9340 does not work with 0x9341,  I will post a test_9340 branch on GitHub for you.

How did you get such an unusual output from LCD_ID_readreg.ino?   i.e. all those commas

David.

joe_smits

thanks for your reply.
I have already tried the beta version from GitHub. It does not work for me.
Here my init code:
uint8_t ILI9340_5[] = { //
  0x01, TFTLCD_DELAY, 200,  // 200 ms waits
  0x28, 0,              // Display Off
  0xF6, 3, 0x01, 0x00, 0x00,  //Interface Control needs EXTC=1
  0xB0, 1, 0x40,      //RGB Signal [00]
  0xB1, 2, 0x00, 0x1B,        //Frame Control [00 1B]
  0xC0, 2, 0x26, 0x00,     //Power Control 1 [26]
  0xC1, 1, 0x00,      //Power Control 2 [00]
  0xC5, 2, 0x31, 0x3C,        //VCOM 1 [31 3C]
  0xC7, 1, 0xC0,      //VCOM 2 [C0]
  0x36, 1, 0x48,      //Memory Access [00]
  0x3A, 1, 0x55,
  0x26, 1, 0x01,      //Gamma Set [01]
  0xE0, 15, 0x0f, 0x26, 0x24, 0x0b, 0x0e, 0x09, 0x54, 0xa8, 0x46, 0x0c, 0x17, 0x09, 0x0f, 0x07, 0x00,
  0xE1, 15, 0x00, 0x19, 0x1b, 0x04, 0x10, 0x07, 0x2a, 0x47, 0x39, 0x03, 0x06, 0x06, 0x30, 0x38, 0x0f,
  0x11, TFTLCD_DELAY, 200,
  0x29, 0,               // Display On
  0xFF                  // end of list
};

I have my own function readReg (void readReg (uint16_t reg, uint8_t n)). I does not use LCD_ID_readreg.ino

Joe

david_prentice

Your 0xFF for end of list will crash the library.    In fact your table is seriously wrong.

Would you like me to create a test_9340 branch on GitHub?   Or do you prefer to "do your own function"?

David.

joe_smits

which command in table have the wrong parameters? (except the last 0xFF)

Don't create branch on GitHub. Can you show the correct init sequence for ili9340?

Joe

joe_smits

just test next init code (from GitHub):

uint8_t ILI9340_6[] = { //
  0xF6, 3, 0x01, 0x01, 0x00,  //Interface Control needs EXTC=1 MV_EOR=0, TM=0, RIM=0
  0xCF, 3, 0x00, 0x81, 0x30,  //Power Control B [00 81 30]
  0xED, 4, 0x64, 0x03, 0x12, 0x81,    //Power On Seq [55 01 23 01]
  0xE8, 3, 0x85, 0x10, 0x78,  //Driver Timing A [04 11 7A]
  0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02,      //Power Control A [39 2C 00 34 02]
  0xF7, 1, 0x20,      //Pump Ratio [10]
  0xEA, 2, 0x00, 0x00,        //Driver Timing B [66 00]
  0xB0, 1, 0x00,      //RGB Signal [00]
  0xB1, 2, 0x00, 0x1B,        //Frame Control [00 1B]
//            0xB6, 2, 0x0A, 0xA2, 0x27, //Display Function [0A 82 27 XX]    .kbv SS=1 
  0xB4, 1, 0x00,      //Inversion Control [02] .kbv NLA=1, NLB=1, NLC=1
  0xC0, 1, 0x21,      //Power Control 1 [26]
  0xC1, 1, 0x11,      //Power Control 2 [00]
  0xC5, 2, 0x3F, 0x3C,        //VCOM 1 [31 3C]
  0xC7, 1, 0xB5,      //VCOM 2 [C0]
  0x36, 1, 0x48,      //Memory Access [00]
  0xF2, 1, 0x00,      //Enable 3G [02]
  0x26, 1, 0x01,      //Gamma Set [01]
  0xE0, 15, 0x0f, 0x26, 0x24, 0x0b, 0x0e, 0x09, 0x54, 0xa8, 0x46, 0x0c, 0x17, 0x09, 0x0f, 0x07, 0x00,
  0xE1, 15, 0x00, 0x19, 0x1b, 0x04, 0x10, 0x07, 0x2a, 0x47, 0x39, 0x03, 0x06, 0x06, 0x30, 0x38, 0x0f,
  0x11, TFTLCD_DELAY, 200,
  0x29, 0,               // Display On
  0xFF                  // end of list
};

the screen went black, and has a slight flicker.

david_prentice

I have created a test_9340 branch.   You can see where your "syntax" was wrong.

Please tell me whether the ILI9340_regValues_ada table works.   And then try the ILI9340_5 and ILI9340_6 tables.

Which target are you building for?
The tables must be 100% accurate format.   If the target is Harvard,  SRAM tables and Flash tables are different.   On an ARM,  your definition does not matter.

David.

Edit.   Ilitek publish App Notes for ILI9341 e.g. Initialisation sequences for different panels
Similar App Notes are published for ILI9163, ILI9481, ILI9486, ...
I can't find one for an ILI9340.

joe_smits

i test three init code from branch on GitHub.
1. ILI9340_regValues_ada give me white screen. One line of pixels flickers. Writing data to graphics memory does not affect the screen.
2. ILI9340_5 - white screen, but not as bright as in the case ILI9340_regValues_ada. Writing data to graphics memory does affect the screen. But i get only one color - black.
3. ILI9340_6 - black screen with weak flickering. Writing data to graphics memory does not affect the screen.

my target is stm32f103rb.
thank you for pdf "Initialisation sequences for different panels". i did not see it before. i will try tomorrow.

david_prentice

Are you sure that everything else is working?
Shields are easiest to test on a Uno.   Or on a NUCLEO-F103RB

i.e. are all other shields working correctly?   e.g. ILI9341

If you look in extras/ili9341_init.h you will see some machine generated sequences.  i.e. I passed the App Note through a SED script.

You have to do some hand-editing.   i.e. extract the argument count. make sure that you have the correct commas.

I will do the edits and add them to the test branch tomorrow.

David.

joe_smits

what do you mean "everything else is working"?
unfortunately i do not have UNO or NUCLEO-F103RB.
as for other shields, i have 1.8'' tft lcd with ST7735R controller (SPI version). Work fine with bitbang (slow) and with hardware SPI (fast). And another one is NHD‐2.7‐12864UCY3 (OLED, SPI) - also work fine.
i will try init from extra folder tomorrow.

But, I'm starting to think that the 2.4'' module on (ILI9340) is defective.

david_prentice

I can't believe that you do not own a regular Arduino board.   This is an Arduino forum.

If you have an STM32,   which STM32 board?
The stm32duino software is full of "features".

Life is much easier if I know what hardware and software you are using.
e.g.  your ILI9340 Shield plugged into a Uno, Mega, Zero, Due, ...

I bet your Shield is 100% fine.

David.

david_prentice

I have added init sequences from ILI9341 app note to GitHub.

They were hand-edited.  So I might have a typo.

David.

foobarrer

I got different register read result by putting the same LCD on UNO board. Previous result was from MEGA2560.

By the way, I have found datasheet for NT35310 at http://jmp.sh/qNZRuT9

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


Life is becoming easier.   The shields often have a sticky label:  35310
This is another good clue.

My earlier reply was a little premature.   I saw reg(0x0004) with xx 00 80 00 which might be HX8357-D.
However I then need to write a special value to reg(0xB9) and read reg(0xD0) to confirm.

I will try to find a datasheet for "NT35310" or RM68042 and come back to you.
Edit. I have found RM68042 datasheet and your device is not a RM68042.

David.

Go Up