By Giovanni Carrera, 21/02/2018
The aim of this project is to interface a 3.2"TFT display designed for Raspberry with
Arduino .
Introduction
Some time ago I bought a 3.2 "TFT touch
screen for my Raspberry. This display is connected to the Raspberry GPIO via a
26-pin connector and appropriate drivers are required. It worked well but it
was too small and not very suitable for my eyesight, so I subsequently
purchased a 7"display with an HDMI interface. I did not want to leave it
unused and I thought about using it with Arduino. I also noticed that the same
manufacturer Waveshare sold an Arduino shield with the same display, equipped
with the same graphics controller ILI9340 and the touch screen controller
XPT2046. The respective libraries are also available for this shield.
Studying
the wiring diagram of the board I got what were the signals and the pins used. The
following table shows the names of the Raspberry signals and those used by the
TFT display.
pin
|
Raspberry name
|
TFT
|
pin
|
Raspberry name
|
TFT
|
1
|
3.3 V
|
3.3V
|
2
|
5V
|
|
3
|
4
|
5V
|
|||
5
|
6
|
Gnd
|
|||
7
|
P7
|
8
|
|||
9
|
Gnd
|
10
|
|||
11
|
P0 - TP IRQ
|
12
|
P1 – Key0
|
||
13
|
P2 - RST
|
14
|
Gnd
|
||
15
|
P3 - DC
|
16
|
P4 – Key1
|
||
17
|
3.3V
|
18
|
P5 – Key2
|
||
19
|
P MOSI
|
20
|
Gnd
|
||
21
|
P MISO
|
22
|
P6
|
||
23
|
P SCK
|
24
|
P CE0
|
||
25
|
Gnd
|
26
|
P CE1
|
Since I had already built a system with an
ATMega328P chip powered at 3.3 V [3], I did the test with that board (see my
post “How to use the TFT display 2.2" QVGA with Arduino”).
I also realized that the display only worked if
I used pin 25 or 14 as a mass. I powered the 5V display on pin 2 and the ground
on pin 25. I powered my system with its battery and everything worked good. The
program was that of the oscilloscope.
Some signals are different from those in the
following table because those were used in my project, while pin 8 turned on
the backlight led of the other display.
Since I have not found on the datasheets if the
chip inputs are 5 volt tolerant, I would recommend using Arduino boards with
3.3V I/O, even if the Arduino Waveshare shield is connected to boards like
Arduino Uno without level adapters.
TFT
pin
|
name
|
Arduino
pin
|
Description
|
2
|
5V
|
5V
|
5V power input
|
25
|
GND
|
GND
|
Ground
|
23
|
P SCK
|
D13
|
SPI clock
|
21
|
P MISO
|
D12
|
SPI data input
|
19
|
P MOSI
|
D11
|
SPI data output
|
24
|
P CE0
|
D10
|
LCD chip select
|
13
|
P2 - RST
|
D8
|
LCD reset
|
15
|
P3 - DC
|
D7
|
LCD data/command selection
|
??
|
TP_BUSY
|
D6
|
Touch panel busy
|
26
|
P CE1
|
D4
|
Touch panel chip select
|
11
|
TP IRQ
|
D3
|
Touch panel interrupt
|
12
|
Key0
|
button 0
|
|
16
|
Key1
|
button 1
|
|
18
|
Key2
|
button 2
|
With a new project based on Teensy, I could also test the touch screen and everything worked very well. I used the Adafruit libraries that also allow you to rotate the text.
References