mcuFriend touch library for SPI controller

I am using mcufriend display library with Arduino Due and 3.95" (link below) and have manged to run graphics however now I am trying configure resistive touch and SD card on the display and am a bit lost. The display module I am using as following pins for touch and SD card :

Display Pin -> Arduino Due Pin number
TP_IRQ (touch interrupt) -> D44
SD_CS -> D48
MISO -> D50
MOSI ->D51
EX_CLK (SPI Bus clock signal) -> D52
TP_CS -> D53

Looking at all mcuFriend examples for touchscreen (Touch_shield_new.ino etc), it seems that they are all written for 4 analog inputs (Xp, Xm, Yp, Ym) however in my case I need touch driver for SPI based controller. Has anyone managed to resolve this issue and has successfully tested touch controller + SD card for this (or similar) display?


Aliexpress - Display Module

BTW, I downloaded LCDwiki library from LCDwiki and the touch_pen example seems to be what I need however I'm not sure if something like this is available in mcuFriend ?

MCUFRIEND_kbv was written for "Mcufriend-style Uno Shields" which have bare Resistive Touch Panels.

Your particular display is intended as a MEGA2560 Shield.
i.e. TFT data bus on 22-37 and control pins on 38-41
i.e. with SPI bus on 50-53
e.g. XPT2046_Touchscreen.h library and regular SD.h library
There is a serious design error that makes LCD_RD inoperable. i.e. the TFT is write-only

Yes, you can use the TFT on DUE or MEGA2560 with USE_SPECIAL, USE_MEGA_8BIT_PORTC_SHIELD

However the DUE does not have SPI on 50-53. Which means you can't use HW SPI for SD or Touch.

If you want to use Touch you have to bit-bang on 50-53 e.g. URTouch.h
If you want to use SD you have to bit-bang on 48, 50-52

Since you have a 3.3V DUE, it would have been wiser to use an SPI display. i.e. TFT, SD, Touch all on the same SPI bus.


Agreed. I think I'll just switch to a SPI display to keep things simple. Thanks.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.