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

Thread: Teensy 4 and ILI9341 - Touchscreen is not working

Hybrid View

  1. #1
    Junior Member
    Join Date
    Mar 2020
    Posts
    3

    Teensy 4 and ILI9341 - Touchscreen is not working

    Dear Forum,

    i tried to connect the new Teensy 4 with the ILI9341(DISPLAY_ILI9341_TOUCH). The LCD works fine and runs perfectly with the ILI9341_t3 Library from Paul Stoffregen. As soon as i connect the t_clk the screen turns completly white. I would like to use the touchscreen too.

    Teensy 4 ILI9341
    VIN VCC
    GND GND
    10 CS
    3.3V RESET
    9 DC
    11 SDI(MOSI)
    13 SCK
    VIN with 100 ohm resistor LED
    12 SDO(MISO)
    SCK T_CLK
    10 T_CS
    11 T_DIN
    12 T_DO
    2 T_IRQ

    I am new to microcontrollers and would be happy if someone could give me a tip on how to find a solution. Thank you really much.

    Kind regards,

    Jonas

  2. #2
    problems I see

    1) your chip select for the display is the same for the touch, these need to be on different pins
    2) shared SPI buss--this may cause a problem depending on the display. I use many of these displays and some can't share the SPI. If my display/touch can't be shared I move touch pins to other pins 2,3,4,5,6 and use a different lib to drive
    3) I see you have no pin to the Reset, generally this works but may have white display on startup. Reset tends needs to be driven high after display is on. If you get white screen on startup, either move reset to a pin and call that pin during object create OR add a series resistor from 3v3 to Rest and cap to ground (low pass filter). maybe a 1K and 3.3 uF, this will slow the charge into Reset pin.
    4) TIP, connect LED to a PWM pin, that way you can control the brightness via analogWrite(0-255)

  3. #3
    Junior Member
    Join Date
    Mar 2020
    Posts
    3
    Quote Originally Posted by KrisKasprzak View Post
    problems I see

    1) your chip select for the display is the same for the touch, these need to be on different pins
    2) shared SPI buss--this may cause a problem depending on the display. I use many of these displays and some can't share the SPI. If my display/touch can't be shared I move touch pins to other pins 2,3,4,5,6 and use a different lib to drive
    3) I see you have no pin to the Reset, generally this works but may have white display on startup. Reset tends needs to be driven high after display is on. If you get white screen on startup, either move reset to a pin and call that pin during object create OR add a series resistor from 3v3 to Rest and cap to ground (low pass filter). maybe a 1K and 3.3 uF, this will slow the charge into Reset pin.
    4) TIP, connect LED to a PWM pin, that way you can control the brightness via analogWrite(0-255)
    Dear KrisKasprzak,

    thanks for your help. I will try it out on the weekend and will give you a feedback. You wrote that you would use a different library for the touchscreen. Can you recommend a library just to control the touchscreen?

    Kind regards,

    Jonas

  4. #4
    If your Touch and Display SPI can get shared, I recommend this lib--always works for me
    https://github.com/PaulStoffregen/XPT2046_Touchscreen

    If your SPI can NOT be shared, this is the lib I use (requires 5 more pins)
    https://github.com/dgolda/UTouch

  5. #5
    Junior Member
    Join Date
    Mar 2020
    Posts
    3
    Quote Originally Posted by KrisKasprzak View Post
    If your Touch and Display SPI can get shared, I recommend this lib--always works for me
    https://github.com/PaulStoffregen/XPT2046_Touchscreen

    If your SPI can NOT be shared, this is the lib I use (requires 5 more pins)
    https://github.com/dgolda/UTouch
    Dear KrisKasprzak,

    i embedded the library XPT2046. The Touchscreen works fine now. Like you said i changed the pin for reset and defined the pin in my code. Unfortunately I still have the white start screen. Do you have any idea for this problem?

    Following connections changed:

    Teensy 4 ILI9341
    8 Reset
    7 T_CS

    I use the following code where i defined the pin for reset:

    Code:
    #include <ILI9341_t3.h>
    #include <font_Arial.h> // from ILI9341_t3
    #include <XPT2046_Touchscreen.h>
    #include <SPI.h>
    
    #define T_CS  7
    #define TFT_DC  9
    #define TFT_CS 10
    #define TFT_RST 8
    
    XPT2046_Touchscreen ts(T_CS);
    #define TIRQ_PIN  2
    //XPT2046_Touchscreen ts(CS_PIN);  // Param 2 - NULL - No interrupts
    //XPT2046_Touchscreen ts(CS_PIN, 255);  // Param 2 - 255 - No interrupts
    //XPT2046_Touchscreen ts(CS_PIN, TIRQ_PIN);  // Param 2 - Touch IRQ Pin - interrupt enabled polling
    
    ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST);
    Thank you for your help! I really appreciate it.

    Kind regards,

    Jonas

Posting Permissions

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