ILI9488 and touch issues

I built up a system with the Due that drives an ILI9488 display, with the ADS7843 as touch input IC. They talks with the Due over SPI. You can find the schematic for the board as attachment.

I designed the pcb to interface tft and touch driver using their own datasheets. The display works well, but the touch IC cannot be initialized if the display is connected to the zif socket. The IRQ is well recognized, but the touch results are always zeros or incoherent (random results even if I touch the same point).
Once the display is removed from the socket the touch IC initializes (to initialize I send an IDENTITY command over SPI and the touch IC reply with a 0x8000).

Since this is not dependent from the code it seems like an SPI issue, but the MISO line looks good at the oscilloscope.
Any ideas? Should I upgrade the design using three state buffers on the MISO line? Thanks!

You just put TFT_SDA, TP_DIN on the MOSI pin of the Due SPI bus.
Likewise with the SDO, DOUT on MISO lines, TFT_SCK, TP_SCK on SCK lines.

You have a separate TFT_CS and separate TP_CS pin on the Due.

As with any SPI device. Only one CS is active at any one time. All SPI devices are powered (or they do not 3-state properly)

The ILI9488 TFT_SDO pin should 3-state when TFT_CS is inactive.
You can disable the TFT_SDO pin in software if you want.
In practice, you only read the TFT when you read GRAM or check its ID registers.

I learned a good lesson with the ILI9488 SPI_READ_CMD (0xFB).
On a ILI9488 you must disable SPI_READ_EN (bit7) after the indexed read. It says so in the datasheet.

On a ILI9341 you can read indexed values of a register and leave SPI_READ_CMD (0xD9) in any state.
If you leave the ILI9488 0xFB register with bit7 set, the whole controller goes haywire.


Thank you David.

So, let's check if I have understood.

If I need to read a register I need to activate bit7 of the SPI Read Command Settings (0xFB).
Since I mostly need to send data to the display I have to disable this bit.
So in my tft.begin() routine I have to put this after the other commands:

writecommand(0xFB); // to disable SPI READ to not interfere with other SPI devices
writedata(0x00); //Don't need to read anything more

Is that right?

Yes. It is the power up default anyway. So you do not need to do anything.

The most important question: Are you ensuring only ONE Chip Select is active at a time?

You can disable SDO pin with:

writecommand(0xB0); // to disable SDO pin
writedata(0x80); // set SDA_EN bit.  (default is 0x00)


Yes, I am. In fact I tested only the touchscreen using this code:

#define CS 4
#define IRQ 2

ADS7843 touch = ADS7843(CS, IRQ);

void setup(void)
  pinMode(10, OUTPUT); //the pin connected to TFT_CS
  digitalWrite(10, HIGH);

  while(!Serial) {}
  if(!touch.begin())  Serial.println("Error on ADS7843.. Check connections!");

The touch.begin() routine calls a function called read_data16_SPI(uint8_t b) which is the following:

uint16_t ADS7843 :: read_data16_SPI(uint8_t b)
    uint16_t data = 0xAA55;
    SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0)); //also tried from 100kHz to 2MHz
    digitalWrite(_cs, LOW); //ADS7843 CS pin
   // delay(100); //used in debug
    data = SPI.transfer(0x0);
    data <<= 8;
    data |= SPI.transfer(0x00);
    digitalWrite(_cs, HIGH);
    return data;

This should return 0x8000 (or 0x4000 with higher clk speed because I loose a bit).

This sketch works well (touch got initialized) without the tft connected and don’t work at all (all readings returns zeros or random data) when the tft is connected through the zif socket.

Btw I’ll try disabling SDO pin with your commands and let you know.

Thank you!!!

In the end, after a lot of struggling I found out the problem. Probably a unique problem of my display but it seems to be a bad actor in SPI transactions.

In fact I cut out the pcb wiring on the display MISO line and everything worked like a charm. Probably a defected screen, I don't know. On the next pcb batch I'll add a three-state buffer to solve the problem.

I have been busy with other things. I will try my ILI9488 with a 25Cxxx SPI eeprom on the bus later.

I would guess the ILI9488 should 3-state the MISO line when the CS is not active.
But I can always enable the MISO pin, do any Read function and disable when finished.
I know that ADS7843 / XPT2046 behaves fine with an SPI ILI9341.