ER-TFTM050-5-4124

Hi everyone, I just purchased a TFT touch display and shield frombuydisplay and I am not having any luck trying to get the Micro SD card to work. It has two SD card slots, one on the shield and one on the display. It did come with example code that I can play with but none for the SD Card. However, they did not have any code for the SD Card NOR will they give me any when asking them. :frowning:

I am using the Mega 2560

Here are the included Examples

If anyone has any example code to get the SD code working or can help me to get it to work, I would be very thankful.

Hi Denny,

I have worked with same shield + TFT about 2 month.

If you use the microSD slot on TFT, you should wire header on Board.

Then, you connect with your arduino. ( Hardware SPI or software SPI )

If you use the microSD slot on your shield, just modify on your SD library and create "void load" to load

image through microSD card or you can use SdFat and UTFT_SdRaw library.

same problem ?!

Thanks for the reply PrSaban.

I am really new to programming and the way that I have been learning is taking example code and making changes to get things the way that I want them. I have not made any changes to Libraries yet but have no trouble with the basics.

I have been able to read the card from the sample readers in SDFat through the Micro SD in the shield but haven't been able to figure out how to load them into the TFT screen as of yet.

One of the things that have me confused is the Software SPI because it shares pins with the touch screen and when I read the SD Card, it turns off the touch screen, which wont turn on again unless I reset the Mega and/or shield.

If you have any example code to show us, we would appreciate it tremendously. BuyDisplay is not very helpful in the SD code department. :frowning: If not any help will still be appreciated!

Hi Denny,

Yes, as you say , the Software SPI of this shield uses pins with the touch screen.

So I suggest you should buy a SD or microSD card shield, then using SPI hardware on your arduino.

Trying example on SdFat library to test reading your card.

Here is my code :

#include <SdFat.h>
#include <UTFT_SdRaw.h>
#include <UTFT.h>
#include <SPI.h>


UTFT myGLCD(SSD1963_800480, 38,39,40,41);
UTFT_SdRaw myFiles(&myGLCD);

ArduinoOutStream cout(Serial);

// SD chip select pin
const uint8_t chipSelect = 10;

// file system
SdFat sd;
bool mysd = 0;


void setup()
{
  myGLCD.InitLCD();
  myGLCD.clrScr();


  pinMode(8,OUTPUT);
  digitalWrite(8,HIGH);

  Serial.begin(115200);

}

void Menu()
{   

long mytime = millis();    
 myFiles.load( 0, 0, 480, 272, "green.RAW", 1 , 0); 
long mytime1 = millis() - mytime; 
 cout << F("Time to draw Geen 480x272 raw  ") << mytime1 << F(" ms") << endl;


/////////////////////////////////////////////////////
 mytime = millis();    
 myFiles.load(0, 0, 800, 480, "back_ground1.RAW", 1, 0); 
 mytime1 = millis() - mytime; 
  cout << F("Time to draw 800x480 raw  ") << mytime1 << F(" ms") << endl;  


  }

void loop()
{  
       while (!mysd)
  {
    if (!sd.begin(10,SPI_FULL_SPEED)) {
      sd.initErrorHalt();
      myGLCD.setColor(0, 0, 255);
      myGLCD.fillRect(0,0,800,480);
      myGLCD.setFont(BigFont);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.print("SD CARD IS NOT READY", CENTER, 235);
 
    }
    else
    {
      mysd = 1;
      Serial.println(F("Card initialised."));
       Menu();
    }      
  }
}

You can convert your image .RAW by using tool of UTFT library.

Are you saying that the on board SD slot will not work or that it would just be easier to buy another and have a dedicated pin for it? That seems like a complete waste to me because this thing has two (2) SD Card Slots already!

Hi Denny,

You can use microSD card on your LCD onboard. Using Config JP4/CON2 of ER-TFTM050-5-4124 .

And wiring these pin with HardwareSPI and testing card.

Thanks PrSaban,

I got it to load pictures using the Micro SD on the shield. I will try to include my code but it is my first time doing so, so try to bear with me. :slight_smile:

// I am using Arduino IDE 1.6.11 and the Libraries Below
// The Date is 9/16/2016

// This is an Example of how I managed, with help from the Arduino forum, to use the Micro SD card on the ER-TFTM050-5-4124 SHIELD from BuyDisplay. 
// However, in order to make this sketch work a library !!!MUST BE MODIFIED!!!
// In the SdFat Library, go to the "src" folder and open up the SdFatConfig file.
// Add the definitions below to get the SD Card to work. 

/////////// Add definitions below to SdFatConfig file //////////////////////////////////////////////////
/*
#define SD_SPI_CONFIGURATION 2
uint8_t const SOFT_SPI_MOSI_PIN = 44;
uint8_t const SOFT_SPI_MISO_PIN = 45;
uint8_t const SOFT_SPI_SCK_PIN = 43;
*/
/////////// Add definitions above to SdFatConfig file //////////////////////////////////////////////////


#include <SdFat.h>
#include <UTFT_SdRaw.h>
#include <UTFT.h>
#include <SPI.h>


UTFT myGLCD(SSD1963_800480, 38, 39, 40, 41);
UTFT_SdRaw myFiles(&myGLCD);

const uint8_t SD_CS = 47;   // SD chip select pin

extern uint8_t BigFont[];

SdFat sd;

////////// Below is a list of VGA Colors they can be used for Fill Screen and Fonts in UTFT ///////////
// VGA_BLACK
// VGA_SILVER
// VGA_GRAY
// VGA_WHITE
// VGA_MAROON
// VGA_RED
// VGA_PURPLE
// VGA_FUCHSIA
// VGA_GREEN
// VGA_LIME
// VGA_OLIVE
// VGA_YELLOW
// VGA_NAVY
// VGA_BLUE
// VGA_TEAL
// VGA_AQUA

void setup()
{
  myGLCD.InitLCD();           //Initialize Screen
  myGLCD.clrScr();            //Clear Screen

  /////////////////////////////////////////////////////////////////////////////////////
  pinMode(8, OUTPUT);               // These two lines turn on the backlight      /////
  digitalWrite(8, HIGH);            // Without them, the screen will look BLANK   /////
  /////////////////////////////////////////////////////////////////////////////////////
  myGLCD.fillScr(VGA_LIME);         // Fill Screen              ///////////////////////
  /////////////////////////////////////////////////////////////////////////////////////
  myGLCD.setFont(BigFont);          // Set Font                 ///////////////////////
  myGLCD.setColor(VGA_BLACK);       // Set font color here       //////////////////////
  myGLCD.setBackColor(VGA_LIME);    // Set font backcolor here   //////////////////////
  /////////////////////////////////////////////////////////////////////////////////////
  sd.begin(SD_CS, SPI_FULL_SPEED);    // Have to begin SD or it wont work!  ///////////
  /////////////////////////////////////////////////////////////////////////////////////
  myFiles.load( 0, 0, 257, 320, "tryit.raw", 1 , 0);    // Load A PICTURE!  ///////////
  /////////////////////////////////////////////////////////////////////////////////////
}


void loop()
{
  myGLCD.print("SD Werkz", CENTER, 395);
}

I forgot to mention that I had to convert my .bmp's to .raw to get them to work on the Shield. An Image converter can be found on the Rinky Dink Website.

In addition, I have my Micro SD Card formatted in FAT32 and I have tested it with Two (2), 32GB Micro SD Cards, one class 6 and one class 10.

Hi Denny,

You are welcome!

There is another hurdle with this Shield! After being able to load an Image from the SD Card, the touch stops working. The only way That I can get the touchscreen to work again is by Unplugging the power to the Arduino and plugging it back in. I hope this is something simple and someone on the forums can help me to make this work as intended.

What you need to do is buy a couple of my GHL Super TFT Shields! :wink: :stuck_out_tongue:

Lol,

G

LOL... I have already!

In the meantime while waiting for them to come in the mail, I am bored and have nothing to do but look at my buydisplay shield and hoping I can get the stupid thing to work as intended!

I'll bet its something simple that I am missing in the Software SPI library but I cant find any tutorials for that...yet.

So if anyone wants to help me to alleviate my boredom, by all means chime in?

Problem Solved !!!

I got a couple DUE's in the mail today, plugged the screen and shield into one, and wallah...It works fine.

Using the buydisplay shield?

Still software SPI??

G

Yes, same shield, and screen. Just works great now...Go figure.

Now I got this Display working well with the SD Card and the touch screen, I would like to go further and begin using the FONT and FLASH Chips. However, I am not sure where to start, although I have soldered them onto the Shield and did a good job for a novice at soldering SMD's :slight_smile:

I would appreciate any help getting these chips working so I can play around with this Display.

Hi Dennis,

What do you want to know?

G

PS, if it were me, I would concentrate on getting it to work using hardware SPI :wink: :stuck_out_tongue:

LOL, I would Graham, if it were set up for that.

I would like to know what libraries that I should use for the font chip and the flash chip. They are on the software SPI bus as well. While waiting for my other stuff, it will give me an opportunity to learn more about the Arduino DUE, which by the way loads a picture a lot faster than when using the MEGA 2560! Thanks for your suggestion of getting a DUE, I am very happy with it. :slight_smile:

So set it up for hardware SPI!!!!............... it is only a matter of jumpers?............ And THEN, you will see what the DUE is REALLY capable of!! :wink:

G