Go Down

Topic: www.mcufriend.com working in arduino uno and arduino mega (Read 149595 times) previous topic - next topic


After revisiting the 5408 Library, to verify that my SD reader was functional, I discovered the formating had become corrupt, on the SD card.  After formatting and uploading the bitmaps, I then retried the MCUFRIEND_kbv library is mostly functional, including the SD card reader, touchscreen, and colors.  The only problems seem to be with the overall screen size, and the scrambled nature of all the displayed items on the screen.  See pictures on post #388.   Antbody else run into this display problems with latest mcufriend.com 2.4 inch TFT LCD Display Shield Touch Panel ILI9341 240X320 sold on eBay?


You don't make any sense at all.   The readreg report has nothing believable in the usual places.

Your photos in #388 are not helpful.

If you don't get anything with graphictest_kbv there is little point in wasting any more time.   Ask for a refund and buy a replacement from somewhere else.

What is a "5408" library?    It will have a class name.   Post a link to where you got it from.
It is always wise to use libraries "approved" by the Library Manager.



Sorry; I didn't mean to annoy or confuse you.  I was attempting to correct a mistake I made, in the last sentence, of post #383. 

I uploaded a video of my screen problem, to youtube:  https://youtu.be/pzcNcTJVnig  if you care to look at it. 

If you don't get anything with graphictest_kbv there is little point in wasting any more time.   Ask for a refund and buy a replacement from somewhere else.
It is to late to return the device to the dealer, so I will throw it the junk box.  thanks


Hello, I can not read files or photos from the SD card. How do I read files?

MCUFRIEND 3.5" 480*320 RED----From Chine. :)


The Shield has the SD pins on 10, 11, 12, 13 i.e. hardware SPI pins for a Uno.

You have a Mega2560.    You must use Software SPI because your hardware SPI is on 50-53

Copy BMP files from extras/bitmaps to the root directory of your SD.

Run the showBMP_not_Uno example.   Follow the instructions.    You must install a library AND edit a library config.h

Yes,   it is fiddly.    The Shield was made for a Uno.



Hello David, it does not work.


Code: [Select]
// MCUFRIEND UNO shields have microSD on pins 10, 11, 12, 13
// The official <SD.h> library only works on the hardware SPI pins
// e.g. 11, 12, 13 on a Uno
// e.g. 50, 51, 52 on a Mega2560
// e.g. 74, 75, 76 on a Due
// if you are not using a UNO,  you must use Software SPI:
// install v1.0.1 of the <SdFat.h> library with the Arduino Library Manager.
// edit the src/SdFatConfig.h file to #define ENABLE_SOFTWARE_SPI_CLASS 1
// copy all your BMP files to the root directory on the microSD with your PC
// (or another directory)

#include <SPI.h>             // f.k. for Arduino-1.5.2
#define USE_SDFAT
#include <SdFat.h>           // Use the SdFat library
[color=pink]SdFatSoftSpi<50, 51, 52> SD; //Bit-Bang on the Shield pins[/color]

#include <Adafruit_GFX.h>    // Hardware-specific library
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

#define SD_CS     10
#define NAMEMATCH ""         // "" matches any name
//#define NAMEMATCH "tiger"    // *tiger*.bmp
#define PALETTEDEPTH   8     // support 256-colour Palette

char namebuf[32] = "/";   //BMP files in root directory
//char namebuf[32] = "/bitmaps/";  //BMP directory e.g. files in /bitmaps/*.bmp

File root;
int pathlen;

void setup()
    uint16_t ID;
    Serial.print("Show BMP files on TFT with ID:0x");
    ID = tft.readID();
    Serial.println(ID, HEX);
    if (ID == 0x0D3D3) ID = 0x9481;
    tft.setTextColor(0xFFFF, 0x0000);
    bool good = SD.begin(SD_CS);
    if (!good) {
        Serial.print(F("cannot start SD"));
        while (1);
    root = SD.open(namebuf);
    pathlen = strlen(namebuf);


Do all of the other examples work?

What have you done?

Have you installed the SdFat.h library?
Have you edited the src/SdFatConfig.h file?

Have you plugged the Shield into the Mega2560?
Have you copied BMP files onto the SD.
Is the SD inserted in the socket?

Make notes when you try something.



Hi David, I am preparing a project to read temperature and humidity with a DHT-11 sensor, and I want to see the temperature and humidity on the display, I want to use NEXTOIN software to create the images (thermometer, ... ets).
Like this  https://uploaddeimagens.com.br/imagens/20181214_194644_1_-jpg


Hello David, the disply 3.5 "Is Mcufriend compatible with Nextion Software?


I do not know much about Nextion.
I think that it responds to UART commands.   (Serial)
And the intelligent MCU writes to the TFT controller chip.

So you could implement the Nextion firmware on an STM32 or similar.

Perhaps a Nextion user can explain better.


Go Up