Entering Bitmap on LCD from SD-Card Slot won't work

Hello Guys,

im pretty new to this topic and to the forum aswell, so feel free to correct me if I'm doing something wrong.

To get started: The main reason I'm asking for help is, i don't have the feeling to code right so that the SD-Card in the slot on the back of the LCD is working.

First of all my hardware:

  • Sainsmart or elegoo MEGA2560 R3 (got both here)
  • Sainsmart CTE TFT LCD/SD Shield
  • Sainsmart 4.3" TFT LCD Touch Panel
  • SanDisk SDHC 16 GB formatted FAT32 ( no smaller possible)

Sorry for Sainsmart, but it wasnt my idea to purchase it.

So what I'm trying is really basic, to set up a good looking home screen, from where I can start to get to use the functionality. My Idea was to insert the company logo from the SD-Card to the screen, so I learn this basic step before I get into defining input an output pins.

code looks like this:

#include <SPI.h>
#include <SD.h>
#include <UTFT.h>
#include <URTouch.h>
#include <UTFT_tinyFAT.h>


#define sd_cs  53
#define sd_in  50
#define sd_out 51
#define sd_clk 52


UTFT    myGLCD(ITDB43,25,26,27,28);
URTouch myTouch( 6, 5, 4, 3, 2);
UTFT_tinyFAT myFiles(&myGLCD);



extern uint8_t SmallFont[];
extern uint8_t BigFont[];

int x, y;
const int chipSelect = 53;



void setup() {

 
 
 myGLCD.InitLCD();
 myGLCD.fillScr(VGA_SILVER);
 myTouch.InitTouch();
 myTouch.setPrecision(PREC_MEDIUM);

 drawHomeScreen();
                                      // put your setup code here, to run once:
}

void drawHomeScreen() {
 

 
 myGLCD.setColor(VGA_LIME);
 myGLCD.fillRoundRect(320,40,380,100);
 myGLCD.setColor(255,255,255);
 myGLCD.drawRoundRect(320,40,380,100);
 myGLCD.setFont(BigFont);
 myGLCD.setBackColor(VGA_LIME);
 myGLCD.print("ON",333,63);

 myGLCD.setColor(VGA_RED);
 myGLCD.fillRoundRect(320,172,380,232);
 myGLCD.setColor(255,255,255);
 myGLCD.drawRoundRect(320,172,380,232);
 myGLCD.setFont(BigFont);
 myGLCD.setBackColor(VGA_RED);
 myGLCD.print("OFF",327,197);

 myFiles.loadBitmap(180, 120, 220, 160, "logo");
}

void loop() {

  if (myTouch.dataAvailable()) {
    
    myTouch.read();
    x=myTouch.getX();
    y=myTouch.getY();
    
    }
  
  
  
  
  }

But now I'm really getting confused with the pin-definition and the logo isnt loaded at all, and the usual test for the SD-Card won't work. I'm not really sure i got the PIN-defintion right or what I am missing. Do I have to define the PINs between LCD and Shield aswell or whats missing?

Also I'm not sure if I should use UTFT_TinyFAT, UTFT_SDRaw or SDFat or whats best for the purpose. Is Adafruit possible or does it get to complex with different pin variations?

As i said im really new to this topic, so I'm really thankful for your help, and I would appreciate some recommendations what libraries are superior at the moment, so I can get the right start with this technology. Attached your find the schematics of the shield and the lcd ( i think MEGA2560 schematics are clear).

Best Regards

Patrik

MEGA_Shield_schematic.pdf (18.5 KB)

schematic.pdf (27.7 KB)