Go Down

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

david_prentice

Read the Adafruit_GFX docs for setFont().
There are FreeFonts versions of the UTFT DefaultFonts if you happen to enjoy those particular fonts.

If there is some unusual font that you want to use,  just ask.    Make sure that you provide a link to this special font.    I will possibly convert it to FreeFont for you.

David.

Klaudiusz_W


Barry_S

Thanks for all your hard work David. If it wasn't for your MCUFriend library I would have never gotten my display to do anything. I'm fairly new to programming and It's probably obvious to most, but after searching for several weeks I'm still trying to figure out the significance of the # that precedes many of the keyword2's in the Mcufriend_kbv keywords.txt file. 


My sketch begins with:

#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

and the examples show that one preceeds the keywords without an # with tft. but how does one use the keywords with an #. In particular I've been trying to make use of printNumF, but all I ever get is errors, such as 'class MCUFRIEND_kbv' has no member named 'printNumF'.  (I'm guesing some other library is also needed.)

jyclop

Just wanted to write real quick about a problem I was having and how I fixed it.

I have a mcuFriend 3.5" display, with the HX8357-D (0x8357) controller.
When I fired up example projects, there were 2 problems: the colors were inverted, and everything was mirrored.

Solution:
1. Go to the MCUFRIEND_KBV.cpp file
2. Locate the line with "case 0x8357:" (this was line 1620 for me)
3. Replace the line right below that with this text:
        "_lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | INVERT_GS | READ_24BITS;"
4. The screen should now have correct colors and display correctly!


Hope this will help someone!

Also just want to say thanks to David for all his hard work on this library! It's rare to find a library that is so constantly well-maintained! :)

david_prentice

I have a mcuFriend 3.5" display, with the HX8357-D (0x8357) controller.
Update your Library via the Library Manager.   (currently v2.9.7)
HX8357-B has ID = 0x8357
HX8357-D has ID = 0x9090

I have never seen a HX8357-B.   I rely on feedback from owners.
Please can you confirm whether v2.9.7 is correct for your display.

David.

david_prentice

Thanks for all your hard work David. If it wasn't for your MCUFriend library I would have never gotten my display to do anything. I'm fairly new to programming and It's probably obvious to most, but after searching for several weeks I'm still trying to figure out the significance of the # that precedes many of the keyword2's in the Mcufriend_kbv keywords.txt file.


My sketch begins with:

#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

and the examples show that one preceeds the keywords without an # with tft. but how does one use the keywords with an #. In particular I've been trying to make use of printNumF, but all I ever get is errors, such as 'class MCUFRIEND_kbv' has no member named 'printNumF'.  (I'm guesing some other library is also needed.)

MCUFRIEND_kbv uses regular "Print.h" methods e.g.
tft.print(0.1234567) and tft.print(9.87654, precision)
You have to use tft.setTextCursor() to position where to start printing.
Obviously there is also println() which positions the cursor to the next line afterwards.

UTFTGLUE has a method called printNumF() with a description in the UTFT docs.

I suggest that you stick to the regular Adafruit_GFX.h and Print.h methods in new projects.

Only use UTFTGLUE if you have a legacy UTFT program.

If you want help,   post a link to the original working UTFT sketch.
Or explain what you want to do for a new project.

David.

Bfortbattle

Greetings David,

I tried to run your graphicstest om my arduino Uno but it keeps on failing to build, could you help me please as i'm quite new to this.

This is the Error i get while building:

Code: [Select]
C:\Users\User\AppData\Local\Temp\Temp1_MCUFRIEND_kbv-2.9.3.zip\MCUFRIEND_kbv-2.9.3\examples\graphictest_kbv\graphictest_kbv.ino: In function 'void loop()':

C:\Users\User\AppData\Local\Temp\Temp1_MCUFRIEND_kbv-2.9.3.zip\MCUFRIEND_kbv-2.9.3\examples\graphictest_kbv\graphictest_kbv.ino:141:5: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     };

     ^

C:\Users\User\AppData\Local\Temp\Temp1_MCUFRIEND_kbv-2.9.3.zip\MCUFRIEND_kbv-2.9.3\examples\graphictest_kbv\graphictest_kbv.ino:141:5: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\User\AppData\Local\Temp\Temp1_MCUFRIEND_kbv-2.9.3.zip\MCUFRIEND_kbv-2.9.3\examples\graphictest_kbv\graphictest_kbv.ino:141:5: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\User\AppData\Local\Temp\Temp1_MCUFRIEND_kbv-2.9.3.zip\MCUFRIEND_kbv-2.9.3\examples\graphictest_kbv\graphictest_kbv.ino:141:5: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\User\AppData\Local\Temp\Temp1_MCUFRIEND_kbv-2.9.3.zip\MCUFRIEND_kbv-2.9.3\examples\graphictest_kbv\graphictest_kbv.ino:142:58: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     char *colorname[] = { "BLUE", "GREEN", "RED", "GRAY" };

                                                          ^

C:\Users\User\AppData\Local\Temp\Temp1_MCUFRIEND_kbv-2.9.3.zip\MCUFRIEND_kbv-2.9.3\examples\graphictest_kbv\graphictest_kbv.ino:142:58: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\User\AppData\Local\Temp\Temp1_MCUFRIEND_kbv-2.9.3.zip\MCUFRIEND_kbv-2.9.3\examples\graphictest_kbv\graphictest_kbv.ino:142:58: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\User\AppData\Local\Temp\Temp1_MCUFRIEND_kbv-2.9.3.zip\MCUFRIEND_kbv-2.9.3\examples\graphictest_kbv\graphictest_kbv.ino:142:58: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\User\AppData\Local\Temp\cceWWwOn.ltrans0.ltrans.o: In function `pushColors':

C:\Users\User\Documents\Arduino\libraries\MCUFRIEND_kbv/MCUFRIEND_kbv.cpp:664: undefined reference to `penguin'

C:\Users\User\Documents\Arduino\libraries\MCUFRIEND_kbv/MCUFRIEND_kbv.cpp:664: undefined reference to `penguin'

C:\Users\User\Documents\Arduino\libraries\MCUFRIEND_kbv/MCUFRIEND_kbv.cpp:665: undefined reference to `penguin'

C:\Users\User\Documents\Arduino\libraries\MCUFRIEND_kbv/MCUFRIEND_kbv.cpp:665: undefined reference to `penguin'

collect2.exe: error: ld returned 1 exit status


And this is what the LCD_ID_readreg gives:
Attached picture of it.

Edit: Finally got it loaded onto my arduino by moving the files. Still problem remains that my screen stays full white.

Thanks in advance.

JMe87

Hello David,
i am back to you with my problems.
I wish to write programs for 2 differents displays in the same time and i have a libraries problem.
First : i use 2,4" TFT LCD Shield from mcufriend (Ili9325 and ST7789V) with the the latest versions of Adafruit_GFX.h and MCUFRIEND_kbv.h without any problems. Fine.


Second : i want to use OPEN-SMART shield with larger display

Dealextreme link
not running. Screen is white and "flash" from time to time.
I found their libraries and example here :

Google Drive link
They use the same libraries as you but not the same size ???
Their MCUFRIEND_kbv.cpp is 93560 and your is 114219
Their MCUFRIEND_kbv.h   is 2227 and your is 2550
Same for Adafruit_GFX
Their Adafruit_GFX.cpp is 16213 and the latest official revision is 43410
Their Adafruit_GFX.h is 3944 and the latest official revision is 7554
Their cards use "ILI9327 Special" and "HX8352B" chips (i have one of each).
Open-Smart shields used a different wiring as Mcufriend but are directly plugable on Aduino Uno board.

My request :
Where is the "link" between the library and the electrical wiring ?
Did you have any idea how to solve my problem ?

Many thanks in advance
Jacques

Apologies for my bad English, i am french (belgian) user

david_prentice

Greetings David,

I tried to run your graphicstest om my arduino Uno but it keeps on failing to build, could you help me please as i'm quite new to this.

This is the Error i get while building:

Code: [Select]
C:\Users\User\AppData\Local\Temp\Temp1_MCUFRIEND_kbv-2.9.3.zip\MCUFRIEND_kbv-2.9.3\examples\graphictest_kbv\graphictest_kbv.ino: In function 'void loop()':
...

Please Install/Upgrade your library with the Library Manager.   The current version is v2.9.7

I do not recognise your controller from the LCD_ID_readreg sketch.
Perhaps the current library can find the ID.
Please copy-paste from the Serial Terminal instead of posting a screenshot.

David.

david_prentice

Hello David,
i am back to you with my problems.
I wish to write programs for 2 differents displays in the same time and i have a libraries problem.
First : i use 2,4" TFT LCD Shield from mcufriend (Ili9325 and ST7789V) with the the latest versions of Adafruit_GFX.h and MCUFRIEND_kbv.h without any problems. Fine.


Second : i want to use OPEN-SMART shield with larger display
You can use OPEN-SMART with a Uno or Mega by editing these files:
MCUFRIEND_kbv.cpp: #define SUPPORT_8352A
mcufriend_shield.h: #define USE_SPECIAL
mcufriend_special.h: #define USE_OPENSMART_SHIELD_PINOUT

The "editing" involves removing the two slash characters on those lines.

When you are building for the OPEN_SMART boards,   define USE_SPECIAL
When you are building for the regular Shields,  comment the USE_SPECIAL define

You can leave the other edits unchanged.

The ILI9327 should work by default.    I am not sure whether the HX8352-B will work with my HX8352-A code.   Please let me know.

David.

Bfortbattle

I updated my library from V2.9.5 to V2.9.6 which is the latest one for me (I can't find V2.9.7)
Still no succes, display stays white.

I ran the LCD_ID_readreg once again, results below:
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 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 04 04 04 04 Manufacturer ID
reg(0x0009) 09 09 09 09 09 Status Register
reg(0x000A) 0A 0A Get Powsr Mode
reg(0x000C) 0C 0C Get Pixel Format
reg(0x0061) 61 61 RDID1 HX8347-G
reg(0x0062) 62 62 RDID2 HX8347-G
reg(0x0063) 63 63 RDID3 HX8347-G
reg(0x0064) 64 64 RDID1 HX8347-A
reg(0x0065) 65 65 RDID2 HX8347-A
reg(0x0066) 66 66 RDID3 HX8347-A
reg(0x0067) 67 67 RDID Himax HX8347-A
reg(0x0070) 70 70 Panel Himax HX8347-A
reg(0x00A1) A1 A1 A1 A1 A1 RD_DDB SSD1963
reg(0x00B0) B0 B0 RGB Interface Signal Control
reg(0x00B4) B4 B4 Inversion Control
reg(0x00B6) B6 B6 B6 B6 B6 Display Control
reg(0x00B7) B7 B7 Entry Mode Set
reg(0x00BF) BF BF BF BF BF BF ILI9481, HX8357-B
reg(0x00C0) C0 C0 C0 C0 C0 C0 C0 C0 C0 Panel Control
reg(0x00C8) C8 C8 C8 C8 C8 C8 C8 C8 C8 C8 C8 C8 C8 GAMMA
reg(0x00CC) CC CC Panel Control
reg(0x00D0) D0 D0 D0 Power Control
reg(0x00D2) D2 D2 D2 D2 D2 NVM Read
reg(0x00D3) D3 D3 D3 D3 ILI9341, ILI9488
reg(0x00DA) DA DA RDID1
reg(0x00DB) DB DB RDID2
reg(0x00DC) DC DC RDID3
reg(0x00E0) E0 E0 E0 E0 E0 E0 E0 E0 E0 C0 C0 C0 C0 C0 C0 C0 GAMMA-P
reg(0x00E1) E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 C1 C1 GAMMA-N
reg(0x00EF) EF EF EF EF EF EF ILI9327
reg(0x00F2) F2 F2 F2 F2 F2 F2 F2 F2 F2 F0 F0 F0 Adjust Control 2
reg(0x00F6) F6 F6 F6 F6 Interface Control


It is a 2.8 inch TFT touch display from MCUfriend.com

Thanks in advance.

paulofeju

Hi David, how are you?

My chinese 3.5 tft blue shield (pict attached) just arrived. I runned "LCD_ID_readreg" and received this:

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) 08 08 Get Power 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) 00 00 Inversion Control
reg(0x00B6) 00 00 00 00 00 Display Control
reg(0x00B7) 00 00 Entry Mode Set
reg(0x00BF) 00 02 04 94 81 FF ILI9481, HX8357-B
reg(0x00C0) 00 10 3B 00 02 11 00 00 00 Panel Control
reg(0x00C8) 00 00 44 06 11 44 55 0A 08 17 33 77 11 GAMMA
reg(0x00CC) 00 00 Panel Control
reg(0x00D0) 00 00 43 Power Control
reg(0x00D2) 00 01 22 00 00 NVM Read
reg(0x00D3) 00 01 22 00 ILI9341, ILI9488
reg(0x00D4) 00 01 22 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


Could you please help me to correctly identify the Controller (ID)? Is it compatible with your library? Hope it is...

Many thanks my friend!!!

david_prentice

It is an Ilitek ILI9481.
Code: [Select]
reg(0x00BF) 00 02 04 94 81 FF ILI9481, HX8357-B

It should work with the library.   Note that that particular screen is prone to overheat.

David.

paulofeju

Thank you very much for the help and for the warning!!!

"tft.begin(0x8357)" and it seemed to work. Is it OK?

david_prentice

No.   It is an Ilitek ILI9481.  The ID is 0x9481.    That is why there is a tft.readID() method.

The HX8357-B is a different make and model.    (but very similar)

David.

Go Up