Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: 3.5" display using ILI9488 will not work with XPT2048_Touchscreen

  1. #1

    3.5" display using ILI9488 will not work with XPT2048_Touchscreen

    All,

    I just bought a large 3.5" display that works fine with the ILI9488_t3 library (using my Teensy 3.2). I'm trying to get it working with the XPT2048_Touchscreen library, the display works but not touch capability. I'm using shared SPI pins. Here's what works and doesn't work

    Display
    https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1

    I realize the display drive listed on the web page says ILI9486--but trying that driver did not work with shared pins with the XPT2048

    2.8" TFT with ILI9488 + XPT2048_Touchscreen using shared SPI bus works fine
    3.5" TFT with ILI9488 + XPT2048_Touchscreen using shared SPI bus does not work
    3.5" TFT with ILI9488 + UTourch using separate SPI pins for the UTouch library works fine

    I really want to get this 3.5" TFT with ILI9488 + XPT2048_Touchscreen using shared SPI bus working as I need to minimize pin usage.

    Anyone have experience with this setup? Here's my code

    Thanks in advance

    Code:
    #include <SPI.h>
    #include "ILI9488_t3.h"
    #include <XPT2046_Touchscreen.h>
    
    #define CS_PIN  5
    #define TIRQ_PIN  8
    #define TFT_DC  2
    #define TFT_CS  9
    
    XPT2046_Touchscreen ts(CS_PIN, TIRQ_PIN);
    ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, 7);
    
    void setup() {
    
      Serial.begin(38400);
    
      SPI.begin();
    
      pinMode(TIRQ_PIN, INPUT);
      pinMode(CS_PIN, OUTPUT);
      pinMode(TFT_DC, INPUT);
      pinMode(TFT_CS, INPUT);
    
      ts.begin();
      ts.setRotation(1);
      
      tft.begin();
      tft.setRotation( 1 );
      tft.fillScreen(ILI9488_BLACK);
    
      while (!Serial);
    
      tft.setTextColor(ILI9488_YELLOW);
    
      tft.setCursor(10, 100);
      tft.print("waiting for Serial Monitor");
      delay(1000);
    
    
    
    }
    
    void loop() {
    
      if (ts.tirqTouched()) {
        if (ts.touched()) {
          TS_Point p = ts.getPoint();
    
          Serial.print(p.x);
          Serial.print(", ");
          Serial.println(p.y);
        
          delay(30);
        }
      }
    }

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,359
    Problem might miso on display not tristated, can that be disconnected?

    I got one like that and LCD midi active during touch makes it fall

  3. #3
    I tried disconnecting my miso wire from the teensy to the display, still no touch capability on the 3.5". I tried adding pullups to MISO and MOSI for the touch no help.

    Any further assistance greatly appreciated.

    I have a cheap USB oscilloscope, but not sure what to even look at. If you can think of what I can measure, i'll let you know what my scope reads

    Thanks in advance

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,359
    Paul's 'better SPI design' blog entry has more details. Pullups on CS and SCK (?) not data lines IIRC.

  5. #5
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,629
    Question are you sure of what the touch controller chip?

  6. #6
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,586
    While I can not be 100% sure that the display is the same as the one I have the odds are the same. Unfortunately I was never able to get the touch working with the display on the same SPI bus until I added a tri-state buffer chip on the MISO line with the 3.5inch display. Its one or the other if you don't use a buffer chip.

    As @defragster pointed out PRJC's BETTER SPI DESIGN blog explains this as:
    Most SPI chips will tri-state (effectively disconnect) their MISO pin when their chip select signal is high (inactive).
    However, some chips do not have proper MISO tri-state behavior. Fortunately, checking MISO tri-state is easy, especially when prototyping on a breadboard. Just connect two 10K resistors to the MISO line, like this:
    Information is available in the blog on how to check for this.

  7. #7
    rats.....

    My 2.8" TFT that works with the XPT2048_Touchscreen library has HR2046 written on the controller chip
    My 3.5" TFT that does not work with the XPT2048_Touchscreen library has XPT2046 written on the controller chip

    I tried pullups on both chip selects and resistors connected to MISO like in the blog

    Still no luck.

    Oddly the 3.5" TFT works with the UTouch libs (with its own SPI bus)

  8. #8
    Member
    Join Date
    Apr 2020
    Location
    Guelph Ontario Canada
    Posts
    66
    Quote Originally Posted by KrisKasprzak View Post
    rats.....

    My 2.8" TFT that works with the XPT2048_Touchscreen library has HR2046 written on the controller chip
    My 3.5" TFT that does not work with the XPT2048_Touchscreen library has XPT2046 written on the controller chip

    I tried pullups on both chip selects and resistors connected to MISO like in the blog

    Still no luck.

    Oddly the 3.5" TFT works with the UTouch libs (with its own SPI bus)
    I had the same problem .. took me a day to figure out what was going on .was wondering if you got it resolved ... I fixed mine by removing the MISO connection that connects to the TFT ..
    its all working now ... Something . to do with the miso line and tri-state...anyhow if you don't plan to download images off the display then this is a good solution ..

  9. #9
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,586
    its all working now ... Something . to do with the miso line and tri-state...anyhow if you don't plan to download images off the display then this is a good solution ..
    That's exactly it.

    The ILI9488 needs a tri-state buffer on the MISO line to get touch working with the display. I tested it with a buffer chip installed and it worked without a problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •