Go Down

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

ardcp

Hi David,

I have now got a 3.5" mcufriend display with an ili9481 driver as a replacement for a bad display with ili9486.
However, I see that the ili9481 is not in the list of supported displays.
But as the display is marked www.mcufriend.com, for info here are the results of a few tests.
Code: [Select]


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 ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 00 00 00 Status Register
reg(0x00BF) 00 02 04 94 81 FF ILI9481
reg(0x00D0) 00 00 HX8357
reg(0x00D2) 00 01 22 NVM Read
reg(0x00D3) 00 01 22 00 ILI9341, ILI9488
reg(0x00DA) 00 00 00 RDID1
reg(0x00DB) 00 00 00 RDID2
reg(0x00DC) 00 00 00 RDID3
reg(0x00EF) 00 00 00 00 00 00 ILI9327
reg(0x00B0) 00 RGB Interface Signal Control
reg(0x00B4) 00 Inversion Control
reg(0x00B6) 00 00 00 00 Display Control
reg(0x00B7) 00 Entry Mode Set
reg(0x00F6) 00 80 80 Interface Control


Testing with a modified tftbmp ( adding #include <MCUFRIEND_kbv.h>), it returns an ID of 2200.
The tftbmp is also modified to show a still image (for photos to the supplier ;) ).
Forcing the id to 0x9341 it does show an overexposed woof.bmp image on a white background.
The image is aligned to the right, not left as on other diplays.
I have searched for an Arduino library, but have only found UTFT and libraries for Mega and STM32.
Guess I have to look deeper into the datasheet for the ili9481 to set it up for 8-bit mode.

And using TouchScreen_Calibr_kbv blindfolded on a white screen reveals through the serial output that the touch panel is working.

Other example sketches also only show a white screen.

david_prentice

No problem.    I have had a ILI9481 write-only target for a while.    So I just need some testing on a read-write display.    PM me with your email,   and I will email you the ZIP.

I am hoping to receive an ILI9327 read-write display soon.    I will release v2.5 when I have tested ILI9327.

How portable is your Gamma_Adjust sketch?
Do you have a "testcard" image to do the adjusting on?

David.

scanfff

Is it possible to get this display into serial mode? I'm trying to figure out if we have access to the IM register pins and put it into 3 or 4 wire mode so I can send it 16bit color. 

My display has the ili9341 driver.

BTW, thanks for the hard work I thought the display was junk till I found this thread.

david_prentice

The library is designed for MCUFRIEND UNO shields.

What display do you have?
Very few have access to the IMn pins.

Which Arduino do you want to use?

For an AVR: 3-wire mode can only be done by bit-bashing.
4-wire mode can use SPI hardware and work very well.   Look at Marek's "ILI9341_due" library

David.

david_prentice

I have just posted version 2.5 of the MCUFRIEND_kbv library at message #1 of this thread.

The new test sketch should illustrate features (and problems).

I would appreciate feedback for the following controllers:

Code: [Select]

ILI9335  240x320  ID=0x9335 new ----- Edit ----- ok
ILI9481  320x480  ID=0x9481 new ----- Edit ---- ok
LGDP4535 240x320  ID=0x4535 new Untested
RM68090  240x320  ID=0x6809 new Untested
S6D0139  240x320  ID=0x0139 new Untested
ST7789V  240x320  ID=0x7789 new ----- Edit ---- ok


but any suggestions are welcome.

David.

JimmyHats

Corrected Version of 2.5 works perfectly with ST7789v!

Thanks again, thats the only way to use this display. Im so happy right now xD

ardcp

With version 2.5 my ili9481 equipped display passes all tests without problems. Great.

I see the LCD_ID_readreg output has changed, here is the result:

Code: [Select]

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 ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 00 00 00 Status Register
reg(0x00BF) 00 02 04 94 81 FF ILI9481, HX8357-B
reg(0x00D0) 00 00 Power Control
reg(0x00D2) 00 01 22 NVM Read
reg(0x00D3) 00 01 22 00 ILI9341, ILI9488
reg(0x00DA) 00 00 00 RDID1
reg(0x00DB) 00 00 00 RDID2
reg(0x00DC) 00 00 00 RDID3
reg(0x00EF) 00 00 00 00 00 00 ILI9327
reg(0x00B0) 00 RGB Interface Signal Control
reg(0x00B4) 00 Inversion Control
reg(0x00B6) 00 00 00 00 Display Control
reg(0x00B7) 00 Entry Mode Set
reg(0x00F2) 00 00 33 00 00 00 00 00 00 00 00 00 Adjust Control 2
reg(0x00F6) 00 80 80 Interface Control

david_prentice

Thanks for the feedback.

The readreg has changed slightly.   The rightmost "description" field is nothing more than a hint.

The "operational" registers tend to be the same for the "8-bit parameter" style of controllers.
But the "configuration" registers vary greatly for different models and manufacturers.

e.g. the controller ID register and format varies.
e.g. the "Manufacturer ID" is not always filled in.

David.

sthiy

Hi, thank you for your work with the library, it is really appreciated!

I have a ILI9335, reported ID is 0x9335. I've been have to run "GLUE_Demo_320x240" but screen was inverted (not color wise, but mirrored).

I edited file "MCUFRIEND_kbv.cpp"

in "begin" function, I changed the GS bit for the scan line (at line 1182, for version 2.5 of the files):
this: 0x60, 0xA700,
became : 0x60, 0x2700,

But it didn't work. After some snooping around, I found GS gets changed in setRotation too.

so, I changed the following:
    case 0x9335:  // MOVING THIS A LITTLE LOWER
    case 0x4535:
    case 0x7783:
        val ^= 0x80;            //.kbv ILI9320 has NOT inverted logic on GS (MY)
    case 0x9320:
for
    case 0x4535:
    case 0x7783:
        val ^= 0x80;            //.kbv ILI9320 has NOT inverted logic on GS (MY)
    case 0x9335:   // <<-- THIS IS LINE 280
    case 0x9320:
... so GS won't get XOR'ed and will be set properly.

And it worked!

I've attached my version, search for STHIY for my modifications. Probably you should only keep my setRotation modification.


david_prentice

Thanks for the feedback.    As I do not possess an ILI9335,   I have to rely on users.

Please run the "graphictest_kbv" sketch.   This should demonstrate every method.
The GLUE demos show the typical UTFT operation.   They do not exercise the hardware at all !!

Now that you have corrected the GS behaviour,  all the tests should work except for the "COLOR BAND SCROLL"
The whole screen will scroll when the modern controllers can scroll a variable number of rows.

Yes,   as you have seen,   I manipulate SS, GS, ORG and do not touch I/D or AM.
This makes the setRotation() complicated but means the "normal" operations work efficiently.

I will wait until I hear from you about the "graphictest_kbv" sketch.
Then I can update the "Untested" status.

David.

tlk888

Thank you all for the work on the library! Library works great!

Please tell me if there any function to enable / disable (on/off) the screen? Ready to listen to any advice and recommendations! I have 3.95 mcufriend shield... Thanks!

sthiy

I ran the graphictest_kbv and it seems to work fine on my ili9335. The benchmark runs in 6.93 seconds (see attached picture).

As you said, "color band scroll" doesn't work.

"Software scroll" scrolls only a rectangle under "Hello world" (again, see picture). Is this normal? If yes, mark it "tested"!

david_prentice

Thanks for your report.   Yes,   both JPEGs look correct.     I will update the "tested" list.

The reason for this odd window for "software scroll" is for compatibility. ( if the sketch is running on tiny 128x128 displays with different library)

If you change the #if in the sketch,   you can use a more intuitive demo of the scroll.
But it is out of view on a small screen.

David.

david_prentice

Please tell me if there any function to enable / disable (on/off) the screen? Ready to listen to any advice and recommendations! I have 3.95 mcufriend shield... Thanks!
No,   I do not have a method for sending the controller to sleep or on/off.

It is easy to do with "modern" controllers like the ILI9488.    It will make little difference to the power consumption.

Most current goes to the backlight.     There is no way to turn this off without hacking the shield.
You would need to switch the 5V pin.

Most of these shields use the 5V pin from the Arduino to supply the backlight.
They use the 3.3V pin from the Arduino for the controller logic.

Cut the trace between 5V pin and the shield LDO regulator.
Place a 500mA PNP transistor between 5V and LDO.    
Control the transistor with the (unused) A5 pin via a resistor to the base.

UNTESTED.   Do any mods at your own risk.   The backlights take 100mA - 200mA.

David.

wolfrose

I have mcufriend 2.4" ST7781

I ran you code in the post #1

1st:
I got this error:

graphictest_kbv.ino:19:29: fatal error: Adafruit_TFTLCD.h: No such file or directory
compilation terminated.
Error compiling.

Then, I tried these modifications:



Uncommented:
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

Commented:
//#include <Adafruit_TFTLCD.h>
//Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);


And got this message:
Sketch uses 32,228 bytes (99%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,907 bytes (93%) of dynamic memory, leaving 141 bytes for local variables. Maximum is 2,048 bytes.


Low memory available, stability problems may occur.


And ...



:)

yaayee wow you are a hero

I'm really happy.

That's so nice.

Thank you so much,



Go Up