Teensy 4 and ILI9341 - Touchscreen is not working

Resix

New member
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 4ILI9341
VINVCC
GNDGND
10CS
3.3VRESET
9DC
11SDI(MOSI)
13SCK
VIN with 100 ohm resistorLED
12SDO(MISO)
SCKT_CLK
10T_CS
11T_DIN
12T_DO
2T_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
 
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)
 
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
 
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 4ILI9341
8Reset
7T_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
 
Back
Top