Go Down

Topic: MCUfriend_kbv not working with R61505W and R61505V LCD Driver Chip (Read 737 times) previous topic - next topic

Ravi_kanchan2004

Hi David,

Need your help. I have one recently purchasef 2.4" Mcufriend LCD. I am using your  mcufriend 2.9.3 lib. but screen is still displaying white.

The LCD_ ID_Readreg Serial output is :-
----------------------------------------------------------------------
reg(0x0000) 15 05   ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00   Manufacturer ID
reg(0x0009) 00 00 00 00 00   Status Register
reg(0x000A) 00 00   Get Power Mode
reg(0x000C) 00 00   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) 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.
-------------------------------------------------------------------------------------------

This mean I have R61505W and R61505V LCD Driver Chip.

When I am running graphictest_kbv The screen display only white.
I have tried after change ID to 0xB505 & 0xC505 but no success screen continue display white.

So I appreciate  your help.

Thanks in advance.

david_prentice

0x1505 means R61505
0xB505 means R61505V
0xC505 means R61505W

All three IDs are treated the same.   And others have said that it does not work.

1.  I suggest that you Upgrade from v2.9.3 to the current v2.9.6 Release via the Library Manager.
2.  Please try tft.begin(0x9320) and tft.begin(0x9325)

Report back.

I do not have any R61505 displays.   If you are prepared to do some testing,  I can post some other initialisation sequences.

David.

Edit.  I googled for R1605 and found this video which is using an old v2.8.x of my library and a R61505W controller.
There should not be much difference between R61505, R61505V, R61505W chips.

Ravi_kanchan2004

Thank you for your Reply.

Now I have upgrade the Lib. to 2.9.6.
I have changed the code as you suggest.

Ist testing >>>
----------------------------------------------------------
Code
----------------------------------------------------------
    Serial1.begin(9600);
    delay(50);
    uint32_t when = millis();
    //while (!Serial1) ;   //hangs a Leonardo until you connect a Serial1
    if (!Serial1) delay(5000);           //allow some time for Leonardo
    Serial1.println("Serial1 took " + String((millis() - when)) + "ms to start");


   
    tft.reset();                 //hardware reset
    delay(50);
    uint16_t ID = tft.readID(); //
    uint16_t result = tft.deb();
    Serial1.print("ID = 0x");
    Serial1.println(ID, HEX);
    Serial1.print("Read Reg ID = 0x");
    Serial1.println(result, HEX);
    if (ID == 0xD3D3) ID = 0x9481; // write-only shield
    ID = 0x9320; 
    tft.begin(ID);
----------------------------------------------------------------
Serial Output of Ist Attempt.

ID = 0xD3D3
Read Reg ID = 0x0
Reset LCD

Result:   On Start after uploading display flickring. After this Only White display

Second  Attempt: >>>
Code
----------------------------------------------------------------
    Serial1.begin(9600);
    delay(50);
    uint32_t when = millis();
    //while (!Serial1) ;   //hangs a Leonardo until you connect a Serial1
    if (!Serial1) delay(5000);           //allow some time for Leonardo
    Serial1.println("Serial1 took " + String((millis() - when)) + "ms to start");


   
    tft.reset();                 //hardware reset
    delay(50);
    uint16_t ID = tft.readID(); //
    Serial1.print("ID = 0x");
    Serial1.println(ID, HEX);
    Serial1.print("Read Reg ID = 0x");
    Serial1.println(result, HEX);
    if (ID == 0xD3D3) ID = 0x9481; // write-only shield
    ID = 0x9325; 
    tft.begin(ID);
-------------------------------------------------------------------------------
Serial Output
ID = 0xD3D3
Read Reg ID = 0x0
Reset LCD

Result:   On Start after uploading display flickring. After this Only White display




One thing I observe that when I am running the LCD_ID_readreg.

The LCD Identified as   R61505
Output is given below
The LCD_ ID_Readreg Serial output is :-
----------------------------------------------------------------------
reg(0x0000) 15 05   ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00   Manufacturer ID
reg(0x0009) 00 00 00 00 00   Status Register
reg(0x000A) 00 00   Get Power Mode
reg(0x000C) 00 00   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) 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.
-------------------------------------------------------------------------------------------
but when I am running the graphicstest_kbv sketch
Then output of ID is changing and reported as 0xD3D3
-------------------------------------------------------------------------------------------

I am using the STM32F103C8 based board with mcufriend 2.4" LCD. Pin Configuration detail has
given below.
-------------------------------------------------------------------------------------------
//Control Pins.

#define LCD_RD  PA0     //Chip Select goes to Analog 3
#define LCD_WR  PA1    //A2 // Command/Data goes to Analog 2
#define LCD_RS  PA2     //A1 // LCD Write goes to Analog 1
#define LCD_CS  PA3     //A0 // LCD Read goes to Analog 0
#define LCD_RST PB0     // Can alternately just connect to Arduino's reset pin

//LCD Data D0 to D7
#define LCD_D0  PB8 
#define LCD_D1  PB9 
#define LCD_D2  PB10 
#define LCD_D3  PB11 
#define LCD_D4  PB12
#define LCD_D5  PB13
#define LCD_D6  PB14
#define LCD_D7  PB15


david_prentice

Quote
Code: [Select]
    ID = 0x9320;
    tft.begin(ID);

----------------------------------------------------------------
Serial Output of Ist Attempt.

ID = 0xD3D3
Read Reg ID = 0x0
The TFT sketch is identifying the ID as 0xD3D3 or 0x0000.   This means it is not recognising 0x1505


I do not recognise your "wiring" as any of the official STM32 boards in mcufriend_shield.h
And it is not in any of the SPECIALs in mcufriend_special.h

I suggest that you plug the shield into a regular Uno, Mega, Zero, Leonardo, Due, ...
These should all work 100% as default.
If you want to write a SPECIAL,  then it should read the ID correctly.

I don't have a R61505.  The video shows a R61505W controller working.

I am quite happy to write a SPECIAL for you.   But first off,  I would like you to plug the shield into a regular Arduino.

David.

Ravi_kanchan2004

I have just order Arduino UNO R3 to test this LCD through ebay.this will take approximate 3-4 days. Then I will check and share you result.



david_prentice

Can you not borrow a Uno?   They are very common (and cheap) nowadays.

David.

Ravi_kanchan2004

Thank for your suggestion.

Actually it is not available in our city. So I have no other option except buy. So I am buying it from ebay. it will deliver on 4th of Sept. .

I can also use in future.


 

david_prentice

I can ever understand the Indian marketplace.    I would expect an enterprising shopkeeper to import a whole batch from China.    And sell them locally.   Much like any hobbyist shop/mailorder does in Europe or America.

Of course,  the enterprising businessman could build them in India with Indian components.   Sell them in India.

Buying stuff from China takes about 10-50 days to arrive in the UK.
Buying from a UK mailorder takes 1-2 days.

If your Display is wired up to the STM32 with the wiring in #2,   I will post a SPECIAL for you.

David.

david_prentice

Here is a SPECIAL.   Instructions are in mcufriend_how_to.txt

Add this to the list of USE macros at the top of mcufriend_special.h
Code: [Select]

#define USE_RAVI_KANCHAN_BLUEPILL

and this block to the #elif sequence
Code: [Select]

#elif  defined(USE_RAVI_KANCHAN_BLUEPILL) && (defined(__STM32F1__) || defined(STM32F103xB)) // MAPLECORE or STM32CORE
#warning USE_RAVI_KANCHAN_BLUEPILL

#if defined(ARDUINO_NUCLEO_F103C8)   //regular CMSIS libraries
#define REGS(x) x
#define GPIO_INIT()   { RCC->APB2ENR |= RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN | RCC_APB2ENR_IOPCEN | RCC_APB2ENR_IOPDEN | RCC_APB2ENR_AFIOEN; \
        AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_1;}
#else                                                                  //weird Maple libraries
#define REGS(x) regs->x
#endif

#define WRITE_DELAY { }
#define READ_DELAY  { RD_ACTIVE; }
#define GROUP_MODE(port, reg, mask, val)  {port->REGS(reg) = (port->REGS(reg) & ~(mask)) | ((mask)&(val)); }
#define GP_OUT(port, reg, mask)           GROUP_MODE(port, reg, mask, 0x33333333)
#define GP_INP(port, reg, mask)           GROUP_MODE(port, reg, mask, 0x44444444)
#define PIN_OUTPUT(port, pin) {\
        if (pin < 8) {GP_OUT(port, CRL, 0xF<<((pin)<<2));} \
        else {GP_OUT(port, CRH, 0xF<<((pin&7)<<2));} \
    }
#define PIN_INPUT(port, pin) { \
        if (pin < 8) { GP_INP(port, CRL, 0xF<<((pin)<<2)); } \
        else { GP_INP(port, CRH, 0xF<<((pin&7)<<2)); } \
    }

#define PIN_HIGH(port, pin)   (port)-> REGS(BSRR) = (1<<(pin))
#define PIN_LOW(port, pin)    (port)-> REGS(BSRR) = (1<<((pin)+16))

#define RD_PORT GPIOA
#define RD_PIN  0
#define WR_PORT GPIOA
#define WR_PIN  1
#define CD_PORT GPIOA
#define CD_PIN  2
#define CS_PORT GPIOA
#define CS_PIN  3
#define RESET_PORT GPIOB
#define RESET_PIN  0

// configure macros for the data pins
#define write_8(d)    { GPIOB->REGS(BSRR) = 0xFF00 << 16; GPIOB->REGS(BSRR) = ((d) << 8) & 0xFF00; }
#define read_8()      ((GPIOB->REGS(IDR) & 0xFF00) >> 8)
//                                          PB15..PB8
#define setWriteDir() {GP_OUT(GPIOB, CRH, 0xFFFFFFFF); }
#define setReadDir()  {GP_INP(GPIOB, CRH, 0xFFFFFFFF); }

#define write8(x)     { write_8(x); WRITE_DELAY; WR_STROBE; }
#define write16(x)    { uint8_t h = (x)>>8, l = x; write8(h); write8(l); }
#define READ_8(dst)   { RD_STROBE; READ_DELAY; dst = read_8(); RD_IDLE; }
#define READ_16(dst)  { uint8_t hi; READ_8(hi); READ_8(dst); dst |= (hi << 8); }



Untested.
Always check your wiring with the readregs sketch defines first.

Life is safer with a Uno.   The Shield plugs into the Uno.   I know that the wiring is 100%.

David.

Ravi_kanchan2004

Hi,


I tested it. I found Some flickering during application start. but screen is still displaying white light.

david_prentice

Do you have a Uno now?
Run the LCD_ID_readreg sketch.   Verify that it reads the registers ok.
Run the graphictest_kbv sketch.   Observe the ID reported on the Serial Terminal.

If you are using the Bluepill,   you do exactly the same.   Note that you must follow the instructions for a SPECIAL.

Both targets should report ID = 0x1505

Please tell me how you get on.   The 1505  might be different to the 1505W.

David.


Ravi_kanchan2004

Still not received my order with ebay.Waiting for delivery.


I was using it with STM32 board.


I am attaching the STM32 board with this reply.

david_prentice

That is a regular BluePill.

From the mcufriend_how_to.txt in the extras/ folder:
Code: [Select]

17. If you do not have a standard Uno Shield, you can add a SPECIAL to the mcufriend_special.h
    Edit mcufriend_shield.h:  #define USE_SPECIAL
    Edit mcufriend_special.h: e.g. #define USE_MEGA_16BIT_SHIELD
    If your "special" is write-only,  the library can not read the ID.  It always returns 0xD3D3

18. Please run LCD_ID_readreg.ino to verify your non-standard wiring.  Paste the defines to a Forum message.



In your case,  you have to add your "USE_RAVI" macro and USE_RAVI conditional block to the mcufriend_special.h file.

If you have verbose compilation (set in Preferences),   you will see an orange message saying warning USE_RAVI_KANCHAN_BLUEPILL

Yes,   I know it is fiddly.    Yes, I could make it easier.    No,  I want you to buy standard Arduino hardware instead of special wiring.

David.

Ravi_kanchan2004

Hi David,


Finally I received Arduino Uno R3 with one more LCD.

Wiring is same as default:
//-- Arduino UNO or Mega 2560 Plugged as shield
#define LCD_RST A4
#define LCD_CS A3
#define LCD_RS A2
#define LCD_WR A1
#define LCD_RD A0

#define LCD_D0 8
#define LCD_D1 9
#define LCD_D2 2
#define LCD_D3 3
#define LCD_D4 4
#define LCD_D5 5
#define LCD_D6 6
#define LCD_D7 7






Now I am using the fresh MCUFRIEND_kbv Lib with this.


Now with uno the new LCD identified as 0x9340.

The given below is the output of Readreg sketch.
------------------------------------------------------------------------------------------------
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 61 00 00   Status Register
reg(0x000A) 00 08   Get Power Mode
reg(0x000C) 00 06   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) 00 02   Inversion Control
reg(0x00B6) 00 0A 82 27 04   Display Control
reg(0x00B7) 00 07   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(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00   GAMMA
reg(0x00CC) 00 3B   Panel Control
reg(0x00D0) 00 00 00   Power Control
reg(0x00D2) 00 00 00 03 03   NVM Read
reg(0x00D3) 00 00 93 40   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 08 0E 12 05 03 09 47 86 2B 0B 04 00 00 00 00   GAMMA-P
reg(0x00E1) 00 08 1A 20 07 0E 05 3A 8A 40 04 18 0F 3F 3F 0F   GAMMA-N
reg(0x00EF) 00 00 00 00 00 00   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
-------------------------------------------------------------------------------------------------

And this is the output of graphicstest_kbv

Serial took 0ms to start
ID = 0x9340
-------------------------------------------------------------------------------------------------

Result : LCD was working fine. and display all the pattern.





Now when I was replacing the LCD with Previous LCD on UNO :

The Output was as given below:
--------------------------------------------------------------------------------------------------
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) 15 05   ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00   Manufacturer ID
reg(0x0009) 00 00 00 00 00   Status Register
reg(0x000A) 00 00   Get Power Mode
reg(0x000C) 00 00   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) 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
--------------------------------------------------------------------------------------------------
LCD Identified as 0x1505

when I was testing with graphictest_kbv sketch with UNO board:

The Output was :

Serial took 0ms to start
ID = 0x1505
-------------------------------------------------------------------------------------------------

Result: Only white screen display with some random flickering.




In this test I am using the Uno R3 with 2 different set of 2.4" LCD .Both are manufactured by mcufriend. I think mcufriend_kbv library require some extra code for 0x1505 LCD driver.

In second test with 0x1505. I have tested by replace the ID with static ID like. 0x0B505 and 0xC505 but nothing change in result.

The one other thing I want to share you that in case of UNO the both sketch identified LCD correctly which is not working in case of SPECIAL. I think some alignment of data pins related code require in case of graphictest_kbv to work with BLUEPILL.

I found when I was testing the LCD (0x9340) with graphictest_kbv sketch on STM32F103 board. It was not working. So I am sure that some Data pins related definition code require change to work with STM32F103C8 .



 


 

 

david_prentice

Ah-ha.  So the ILI9340 worked ok.   Please can you confirm that all the colours, directions and Software Scroll work 100%.

Follow the procedure in #12.   i.e. edit mcufriend_shield.h and mcufriend_special.h for your SPECIAL
then test Special wiring with LCD_ID_readreg.   

What ID does the BluePill report on the Serial Terminal?  i.e. it should be 0x9340

This should get your BluePill working.



Now we have to play with the R61505 on the Uno.   
I have a confession.  I never studied the differences between R61505W and your R61505U.
I just assumed the register sequences would be "similar".

Looking at the Differences between R61505V and R61505U on page 10 of the V datasheet,  they are significant.

A punter complained about 0x1505.  But she never replied to questions or advice.   So I spent no time on it.

If you are prepared to do the testing,  I will see if I can produce a suitable initialisation that will work on R61505U.

If there is a R61505W or R61505V owner out there,   it would be good to hear from them.

David.


Go Up