How to interface TFT ILI9225 display with arduino MEGA using Hardware SPI

I am using a TFT ILI9225 display i tried most of the websites i am unable to make tha hardware SPI work using ARDUINO MEGA, And how to load and display images from SD card please give me the interface clearly the pins on the display are

VCC
GND
GND
NC
NC
CLK
SDA
RS
RST
CS

SD_CS
SD_MOSI
SD_SCK
SD_MISO

FD42M2BIAJHVIA8.ino (769 Bytes)

Read this message and associated thread.

I suggest that you plug the board into the Analog header as described. Verify that the display is working.

Then use hardware pins for SPI. TFT_SDA=51, TFT_SCK=52 on a Mega.
Choose any pins for the other signals.
Verify the display is working with Software Constructor and Hardware Constructor.

For the SD, you need to connect to SD_CS=53, SD_MOSI=51, SD_SCK=52, SD_MISO=50
Make sure that you use the Hardware constructor for the TFT. And use SPI Transactions.

David.

Can you please give me Arduino code which can load a bitmap image form root of SD card and display on screen i have given connections as
ARDUINO MEGA - TFT ILI9225
VCC - 5V
GND - GND
GND - GND
LED A0
CLK - A1
SDA - A2
RS - A3
RST - A4
CS - A5

SD_CS - 53
SD_MOSI - 51
SD_SCK - 52
SD_MISO - 50

And Hardware Spi ( Working well ) connections i am using are
ARDUINO MEGA - TFT ILI9225
VCC - 3.3V
GND - GND
GND - GND
LED - 3
CLK - 52
SDA - 51
RS - 9
RST - 8
CS - 53

Which pins should i connect SD Card
SD_CS - ?
SD_MOSI - ?
SD_SCK - ?
SD_MISO - ?

please give me a sample code which can load and diaplay BMP images from SD card

Go on. If you have chosen 53 for TFT_CS, you need to choose a different pin for SD_CS.

For the SD, you need to connect to SD_CS=53, SD_MOSI=51, SD_SCK=52, SD_MISO=50

Look at examples from Adafruit_ST7735 library e.g. spitftbitmap.ino

You will need an equivalent for tft.width(), tft.setAddrWindow(), tft.pushColor()

David.

SD_CS - can i use 50
SD_MOSI - 49
SD_SCK - 48
SD_MISO - 47

Arduino: 1.6.10 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\S\Documents\Arduino\libraries\Adafruit-GFX-Library-master\glcdfont.c:9:23: error: variable 'font' must be const in order to be put into read-only section by means of 'attribute((progmem))'

static unsigned char font[] PROGMEM = {

^
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Update Adafruit_GFX via the Library Manager.

It is always wise to keep your libraries up to date.
Modern compilers are fussy about const. You may need to edit legacy sketches.

David.

// TFT display and SD card will share the hardware SPI interface.
// Hardware SPI pins are specific to the Arduino board type and
// cannot be remapped to alternate pins. For Arduino Uno,
// Duemilanove, etc., pin 11 = MOSI, pin 12 = MISO, pin 13 = SCK.
#define TFT_CS 10 // Chip select line for TFT display
#define TFT_RST 9 // Reset line for TFT (or see below...)
//Use this reset pin for the shield!
//#define TFT_RST -1 // you can also connect this to the Arduino reset!
#define TFT_DC 8 // Data/command line for TFT

#define SD_CS 4 // Chip select line for SD card

// For 0.96", 1.44" and 1.8" TFT with ST7735 use
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

// For 1.54" TFT with ST7789
//Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);

void setup(void) {
Serial.begin(9600);

while (!Serial) {
delay(10); // wait for serial console
}

pinMode(TFT_CS, OUTPUT);
digitalWrite(TFT_CS, HIGH);
pinMode(SD_CS, OUTPUT);
digitalWrite(SD_CS, HIGH);

// Use this initializer if you're using a 1.8" TFT
tft.initR(INITR_BLACKTAB);

// Use this initializer (uncomment) if you're using a 1.44" TFT
//tft.initR(INITR_144GREENTAB);

// Use this initializer (uncomment) if you're using a 0.96" 180x60 TFT
//tft.initR(INITR_MINI160x80); // initialize a ST7735S chip, mini display

// Use this initializer (uncomment) if you're using a 1.54" 240x240 TFT
//tft.init(240, 240); // initialize a ST7789 chip, 240x240 pixels

but i dont have a DC pin on the TFT ,
the pins i have are
VCC - 3.3V
GND - GND
GND - GND
LED - 3
CLK - 52
SDA - 51
RS - 9
RST - 8
CS - 53

Which pins should i connect SD Card
SD_CS - ?
SD_MOSI - ?
SD_SCK - ?
SD_MISO - ?

can you please give me the 4 pins connections of tft to arduino mega, and what else i need to change in the code i posted above and i am using a 176*220 pixel 2.2''
display

Have you soldered header pins to the SD_xx header ?
Have you tried the regular "SD.h" examples? i.e. reporting to Serial

Then you can try reporting to the TFT.

I suggested that you studied the spitftbmp.ino example
This is not a trivial task. The TFT_22_ILI9225 library has not got direct equivalent public methods.
What experience do you have?

DC, RS, CD are just different names for RegisterSelect.

David.

EVERYTHING is ok i have connected the spi of SD card to ICSP pins on mega i am able to draw shapes using hardware serial ... now, form the above example
i am using a TFT ILI9225 2.2'' i..e.., 176*220 pixel display how initialize it in the code it is mentioned for only till 1.8'' display

VCC - 3.3V
GND - GND
GND - GND
LED - 3
CLK - 52
SDA - 51
RS - 9
RST - 8
CS - 53

SD_CS - 40
SD_MOSI - ICSP(4)
SD_SCK - ICSP(3)
SD_MISO - ICSP(1)

I Have given these connections now please give me an arduino code which can load and display a image from SD card