david_prentice:
Does your Adapter Shield have anything printed on the pcb? i.e. to identify the header pins.
Nothing printed, but it may be possible to identify the pins with a multimeter - will try to get one.
david_prentice:
I suspect that the SPI pins have either been routed to digital 2-7 or to 50-53.
I would be 100% confident that the TFT is wired to 22-37 for the data bus. And 38-41 for the control pins.
Seeing that " #define SDssPin 53 // SD card CS pin " has worked for SD card init at Rudi_i LEDStick project I've tested (if a touch is disabled), yes this Adapter Shield seems to be using 50-53 pins for a hardware SPI.
After I've modified SD library to properly use a MEGA_SOFT_SPI software SPI for 10,11,12,13 pins - following the instructions at MEGA_SOFT_SPI set as 1 leads to failure in compiling (SD-library, IDE 1.6.x) · Issue #3556 · arduino/Arduino · GitHub - now I could successfully use both XPT2046 touch and SD card at the same time!
However, this is possible only because now they are separated: XPT2046 touch uses a hardware SPI while SD card uses a software SPI at the totally different set of pins: 10-13.
@david_prentice, thank you very much for your kind help!
Maybe a bit later - when I'll get the necessary tools like an oscilloscope - I could investigate why there's a conflict between a touch and onboard SD. Meanwhile I'm attaching two archives: library-1.8.11-modded with a modded SD and URTouch libraries (touch mirror fix), and LEDStick_TFT_v1.2 - this example from Rudi_i was quite convenient to use as a test project and I've even improved it slightly.
Anyone could copy these modded libraries to their Arduino dir, just make sure to change your software SPI pins at your ./SD/src/utility/Sd2Card.h file, lines 97-107, like I had to do because accidentally switched MISO with SCK while soldering. The current settings:
#else // SOFTWARE_SPI
// define software SPI pins so Mega can use unmodified GPS Shield
/** SPI chip select pin /
uint8_t const SD_CHIP_SELECT_PIN = 10;
/* SPI Master Out Slave In pin /
uint8_t const SPI_MOSI_PIN = 11;
/* SPI Master In Slave Out pin /
uint8_t const SPI_MISO_PIN = 13; // 12;
/* SPI Clock pin */
uint8_t const SPI_SCK_PIN = 12; // 13;
#endif // SOFTWARE_SPI
LEDStick_TFT_v1.2.zip (4.7 KB)
libraries-1.8.11-modded.zip (486 KB)