Why SD library and software SPI doesn't incorporate?

I’m recently making a project that requires both UTFT library and SD library. And it seems they can’t work together. The sketch would compile and upload,but arduino would act as expected. In fact, it seem that Arduino never get to setup(). The led blinks though at about 1Hz.
After much searching, i believe it’s an incompatible issue between software SPI used by UTFT (find here: http://electronics.henningkarlsen.com ) and SD library. Don’t know why it happens,but the issue is mentioned in Arduino’s official TFT board introduction. (find here:http://arduino.cc/en/Guide/TFT) in chapter software SPI vs hardware SPI.

Is this a bug? Why does this happen? I’m currently working to modify the UTFT library to use hardware SPI. Is there a easier or standard way to do this?
Plz help, thanks in advance.

UTFT doesn't use SPI :confused:

What is your display ?

NickZhang: Why does this happen?

Because the authors do not take any care to avoid it and there are no Arduino guidelines that might help them. To be fair, the Arduino has very limited resources so it can be difficult to avoid a clash.

And, sorry, I am not familiar with the libraries you are using.

...R

guix: UTFT doesn't use SPI :confused:

What is your display ?

Thank you for replying! :D My display may be alien to you ,it's QD220A, QDtech 2.2inch SPI LCD Module,Driver IC:ILI9225 Support for this module seems not to be in official release of UTFT library,i initially used the library emailed to me by the seller and later realized it's a tiny modified library. The technicians add #define QD220A 27 in the header file and add hardware specific initializers in tft_drivers directory. However, they could not provide me with much help. :(

I'm pretty sure the library uses SPI though.UTFT has 2 kinds of class constructors,one is UTFT(Model, RS, WR, CS, RST); for 8 and 16 bit display modules, and the other is UTFT(Model, SDA, SCL, CS, RST); for serial display modules. The latter is what i am using and get stuck with. :'(

Robin2: Because the authors do not take any care to avoid it and there are no Arduino guidelines that might help them. To be fair, the Arduino has very limited resources so it can be difficult to avoid a clash.

And, sorry, I am not familiar with the libraries you are using.

...R

Thank you for replying anyway. They should have labeled the library "not hardware SPI safe" in the man page i suppose

Try this library instead: https://github.com/Nkawu/TFT_22_ILI9225

guix:
Try this library instead: GitHub - Nkawu/TFT_22_ILI9225: Arduino library for 2.2" TFT display modules with ILI9225 driver

Thank you! I’ve got the library working nicely using hardware SPI. But again, when i integrate it with the official SD library,SD.begin(SD_CS) returns false. even if i manipulate the CS pins manually.

here are part of my codes.

// Include application, user and local libraries
#include <SPI.h>
#include <TFT_22_ILI9225.h>

#include <SD.h>
File image;
#define TFT_RST A4
#define TFT_RS  A3
#define TFT_CS  A5  // SS
#define TFT_SDI A2  // MOSI
#define TFT_CLK A1  // SCK
#define TFT_LED A0   // 0 if wired to +5V directly

#define SD_CS 4
//SPI flash chip select,do not need
#define F_CS 5
// Use hardware SPI (faster - on Uno: 13-SCK, 12-MISO, 11-MOSI)
TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_LED);
// Use software SPI (slower)
//TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_SDI, TFT_CLK, TFT_LED);

// Variables and constants
uint16_t x, y;
boolean flag = false;

// Setup
void setup() {
  pinMode(SS,OUTPUT);
  pinMode(TFT_CS,OUTPUT);
  pinMode(SD_CS,OUTPUT);
  pinMode(F_CS,OUTPUT);
  //select tft
  digitalWrite(TFT_CS,LOW);
  digitalWrite(SD_CS,HIGH);
  digitalWrite(F_CS,HIGH);
  
  tft.begin();
  Serial.begin(115200);
  
}

// Loop
void loop() {
  //select SD
  digitalWrite(TFT_CS,HIGH);
  digitalWrite(SD_CS,LOW);
  
   if(!SD.begin(SD_CS)){
     //this is what i got from serial monitor
    Serial.println("SD not ready");
        //ShowMessage("SD not ready");
        return;
    }
//more ...

Any ideas?
the SD library code seem rather complicated and i wish not to investigate that if possible.