MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields

Dear David,

Please find the attached file.

Majid

Your photo shows a current Mcufriend 2.4 inch Uno shield pcb.

Please plug the shield into your Uno.

Please run the LCD_ID_readreg example.
Copy-Paste the Serial Terminal to your message.

David.

Dear David,

Here is the message:

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(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 Panel Control
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(0x00EF) EF EF EF EF EF EF ILI9327
reg(0x00F2) F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 Adjust Control 2
reg(0x00F6) F6 F6 F6 F6 Interface Control

Majid

Your readreg report shows a Shield that is NOT plugged in.

Please post a clear photo of your shield mating with the Arduino.
Every male pin should mate with a corresponding female socket.

David.

Dear David,

Actually I am using arduino nano instead of uno. I connected all pins including SD card pins and received the following message:

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 30 Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D2) 00 00 00 02 02 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

Is it now plugged?

Majid

Yes, you have plugged it into all the correct Nano pins. But it was a lot of hard work.

I have a "Nano Adapter". It has regular Arduino headers and a socket for the Nano.
This turns the Nano into a regular Uno.

Anyway, this shows that you have an ILI9340

reg(0x00D3) 00 00 93 40 ILI9341, ILI9488

All the MCUFRIEND_kbv examples should find ID = 0x9340. All examples should work 100%.

Why would anyone use a Nano with a "Uno shield" ?
You will have dozens of wires. And everything will be "unreliable"

Please let us know if your display is ok.
Note that your Mcufriend pcb design is "crap" because there is no regulator chip. The old Mcufriend pcb had an AMS1117 regulator.
The 2.4 inch screens will probably work ok with Nano, Uno, Mega.
3.5 inch screens will draw too much current from the Arduino 3.3V pin.

David.

Dear David,

Here is the image of pins connection from arduino nano to mcufriend 2.4 inch TFT.
What should I do to display a simple text on TFT screen?

Best Regards,
Majid

IMG.jpg

Dear David,

Thank you very much for your help and consideration. When I use this code the screen of mcufriend module is blinking and it does not show any text. What is the problem?


#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

//#define BLUE 0x001F
#define RED 0xF800
#define WHITE 0xFFFF

void setup(void) {
Serial.begin(9600);
// tft.reset();
uint16_t ID = 0x9340;
tft.begin(ID);
tft.setRotation(2);
}

void loop(void) {
testText();
delay(50);
}

unsigned long testText() {
tft.fillScreen(RED);
tft.setCursor(tft.width()/2, tft.height()/2);
tft.setTextColor(WHITE);
tft.setTextSize(2);
tft.println("HELLO");
}


Best Regards,
Majid

Please run the LCD_ID_readreg example.
Check that it is giving the correct output i.e. as in #2769

Then run all the other MCUFRIEND_kbv examples.

If an example does not work, quote the example sketch name.
Describe the problem.

I have no intention of even looking at your "code" until you have run the library examples.
And you have edited your message "code" to use Code Tags i.e. </> icon

David.

Dear David,

I omitted the delay and it is working perfectly with arduino nano :slight_smile:

Thank you very much again

Best Wishes
Majid

Seriously. Buy a cheap Chinese Uno clone. Shields are 100% reliable.

Run every example that comes with a library. It is the best way to learn. And it shows that your hardware is working ok.

David.

Hi, I have a 3.5" ili9486 tft shield (8-bit) which was designed for Uno. I'm currently using it on a mega (not as a shield, but with Dupont extensions). The problem is it takes about 6 seconds to display a bmp image from SD card, while the Uno take about 4 seconds. I believe it's because the port mapping on mega splits the data bus into 3 PORTS.

I'd like to have the pin assignments changed so that all lcd data pins are on either PORT A or PORT C, both of which have 8 pins available.

Below is the wiki for the lcd I have:
http://www.lcdwiki.com/3.5inch_Arduino_Display-UNO

Regards,
Iyaadh.

Go on. There is current thread about displaying RAW images.

There are often threads about wiring a Shield to PortA on a Mega2560.
e.g. USE_SPECIAL, USE_MEGA_8BIT_PROTOSHIELD

My showBMP example is designed for multiple formats. It will run on Uno
If you strip it down to 24-bit .BMP files and increase buffer sizes, it will run faster on a Mega.

Any "display from SD" will depend on SD hardware, access of FAT filesystem, decode of image format, blitting of pixels to TFT.

A Uno shield suffers from all these Mega features.
Hardware SPI is faster than bit-bang SPI. Smaller files mean less SPI traffic. .BMP images are big but simple to decode. .RAW files are smaller and simpler. .JPG files can be very SMALL but require CPU power and SRAM.

David.

Thanks, what are the pin assignments in PORTA for data0 to data7? I didn't find any info about data pins in mcufriend_special file.

I assume that anyone prepared to use a SPECIAL will be able to work it out for herself.

LCD_D0 - LCD_D7 go to digital #22 - 29
The LCD control signals remain on Analog #0 - 4

My Protoshield Adapter routes the SD pins to the Mega SPI header.
Which means that I can use hardware SPI.

David.

Hello to all, I'm new here and need some help. I've decided to build the graphing thermometer as described in the #2 2019 issue of nuts and volts. I have a 2650 board and a 3.5 lcd and almost all of the remaining hardware. I have downloaded the files from here GitHub - Ed-EE-Eng/Graphics_Thermometer: Arduino MEGA Graphing Thermomoter Project Using 480x320 LCD I have downloaded and installed the Arduino editor and loaded the ino files along with the required libraries which includes the MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields. and a file named droid_mono_40pt7b.h . I have selected the 2560 mega board in the drop down and I've also loaded the program into the online web editor.

Now when I do a verify and save I get an error that states that "FreeSevenSegNumFontPlusPlus.h:No such file or directory, compilation terminated".

In the MCUFRIEND library that I downloaded I see the FreeSevenSegNumFontPlusPlus.h file that is readable by notepad but I don't know how to correct the error.

The author states that he compiled using IDE 1.8.5, I used 1.8.9 and he says that compiling using a different ide may cause problems.

I should also add that I did not use the lcd that the author used. I used a MCUFriend TFT Touch LCD for Arduino. bought here 8IN1 RC Lipo Battery Charging Multi Charger Plug Connector Adapter Convert Cable 645312081349 | eBay

I'm now concerned that even when I get this error corrected there may be other errors as the compile progresses. I don't want to become a arduino programing expert, I would just like to have this nice graphing thermometer, can you guys help me out?
Thanks

I suggest that you always install the v2.9.8 Release via IDE Library Manager.

"FreeSevenSegNumFontPlusPlus.h" is in the current Beta on GitHub.
Your project should not care whether it is present or not.

I will try the GitHub - Ed-EE-Eng/Graphics_Thermometer: Arduino MEGA Graphing Thermomoter Project Using 480x320 LCD project later.

David.

2.9.8 is the version that I have installed.

Thank you sir.

I just built the project for a Mega2560 in IDE v1.8.9.

Using library RTClib at version 1.2.0 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\RTClib 
Using library Adafruit_GFX_Library at version 1.5.6 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_GFX_Library 
Using library Mcufriend_kbv at version 2.9.8 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Mcufriend_kbv 
Using library Bounce2 at version 2.52 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Bounce2 
Using library DHT_sensor_library at version 1.3.2 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\DHT_sensor_library 
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.9\hardware\arduino\avr\libraries\Wire 
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.9\hardware\arduino\avr\libraries\SPI 
Using library Adafruit_Unified_Sensor at version 1.0.3 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_Unified_Sensor 
"C:\\Program Files (x86)\\Arduino-1.8.9\\hardware\\tools\\avr/bin/avr-size" -A "C:\\Users\\DAVIDP~1\\AppData\\Local\\Temp\\arduino_build_228763/Graphing_Thermometer_V3_10.ino.elf"
Sketch uses 65514 bytes (25%) of program storage space. Maximum is 253952 bytes.
Global variables use 4957 bytes (60%) of dynamic memory, leaving 3235 bytes for local variables. Maximum is 8192 bytes.

It was a successful build. I have not got the necessary hardware to implement the whole project.

I have never used the "Online Compiler".

As far as I know it has copies of every library supported by the Library Manager.
It always uses "up to date" library versions.

But it will have problems with libraries that have several RTClib variants.

Personally, I am happier with libraries installed on my local PC.
I enable File->Preferences: Verbose Compile.
This shows me version and location of the libraries used in the build.

David.

Is there a way to increase spi clock speed in the library? (For better SD card performance). Currently my 3.5" Uno shield on the mega takes 4704ms to display a 24-bit 320*480 bitmap. Pixel buffer is set to 80.