Hi all,
I have an old TFT Touch Screen shield from SeeedStudio, that works well on Uno or Mega. I use the SeedStudio library TFTv2, the display drive is IL9341.
Recently I bought an UNO like card with ESP-32. Stupid me thought, that it was pin-compatible with UNO, why else should anyone build a card like UNO?
So here I am with a card with almost every pin different from UNO. But I like the ESP-32 for it's speed. I have built a few projects with it even using it's dual core.
The card doesn't have the 6pin SPI connector, but luckily there are jumpers on the TFT card, connecting the SPI (MOSI, MISO, SCK) to pins 11, 12, 13 on UNO.
Is there anyone, who solved this problem or has enough knowledge to help me do it?
The reason for this could be, that SeeedStudio sells this card for $10, while Adafruit has 2.8" TFT for $35.
Questions are:
do I have to involve level shifters up from 3.3V to 5V ?
(kind of awkward, since there are level shifters down on the TFT card)
which library do I use? Or at least to start with and adapt to my HW.
(there are a few alternatives - SeeedStudios TFTv2, Adafruit_ILI9341_AS, Bodmer's TFT_eSPI,...)
Any hint to solve this will be appreciated.
Thank you.
By the way, is there anyone who knows how do I contact Bodmer?
david_prentice:
Make the solder-bridges: P1, P2, P3
In your User_Setup:
#define TFT_MISO 19
#define TFT_MOSI 23 #define TFT_SCLK 18 #define TFT_CS 16 // Chip select control pin #define TFT_DC 27 // Data Command control pin #define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
... #define SUPPORT_TRANSACTIONS
You said your screen was old.
Are you sure your screen is V2.0 ?
I suggest that you print the schematic on paper. Then you can check the wiring.
David.
Thank you, David !
On the screen it says ver.2.1 actually, but there is no ver.2.1 on SeeedStudio site.
I did exactly what you suggested and it made the trick as out of the box
So now I do not have to worry about level shifters etc.
Next step will be to bring life in the touch screen and the SD-card.
The sketch (Spiro) runs so much faster on ESP32 than Arduino Mega so that I miss the feeling of how the curve is created
But now I know, that it is not the display, that is slow (inspite it's age - 2012).
jtbennett:
Are you using the ESP32 SPI library? And these pins?
Hi,
thank you for the info about several SPIs on ESP32. I don't know how the library TFT_eSPI selects the right SPI, but as you can see from the conversation here, it works for me now.
Sorry to be back again.
This time with the Touch screen. "Naturally", I can not get the SeeedStudio touch screen work as described in Adafruit_TouchScreen
As I can see from the schematics (and from the PCB) SeeedStudio connected the 4 touch wires to pins A0,A1,A2,A3
as I can read from the SeeedStudio touchscreendemo sketch for Arduino UNO:
#define YP A2 // must be an analog pin, use "An" notation! #define XM A1 // must be an analog pin, use "An" notation! #define YM 14 // can be a digital pin, this is A0 #define XP 17 // can be a digital pin, this is A3
It looks to me, that the 4 touch wires on Adafruit TouchScreen are connected to A2,A3,A4,A5 though I cannot get it verified since the resistive Adafruit board has a touch controller instead.
So, please, do I have to make a different rewiring on the ESP board?
How do I finally assign the pins YP,XM,YM,XP in the sketch ESP32testTouch
#define YP 36 // must be an analog pin, use "An" notation!
#define XM 4 // must be an analog pin, use "An" notation!
#define YM 2 // can be a digital pin, this is A0
#define XP 34 // can be a digital pin, this is A3
Note that some ESP32 pins are Analog-only. You will have to check the ESP32 datasheet.
From memory, GPIO36, GPIO34 are Analog-only. Which is why Bodmer suggests a hardware mod to link GPIO15, GPIO22 to GPIO36, GPIO34.
The Adafruit_Touchscreen library must be able to swap modes between Analog and Digital on two pins e.g. GPIO2, GPIO4. The other two pins must be digital.
#define YP 2 // must be an analog pin AND digital
#define XM 4 // must be an analog pin AND digital
#define YM 15 //36 // MUST be a digital pin
#define XP 22 //34 // MUST be a digital pin
ESP32 pins are not designed for heavy loads like the Resistive panel.
Untested.
The GPIO36 you are referring to is actually GPIO35 (it is hard to see the difference on the photo and the schematics do not show the actual connection, but I have tested with the multimeter).
Looking at the TouchScreen.cpp I have found the analogRead(aYP) and analogRead(aXM) instructions, which told me, that I should assign:
XP = 33
YP = 15
XM = 4
YM = 2
You sure understand, that I am not going to HW rewire the SeeedStudio shield to have the YP at pin 2 as you indirectly suggested in:
#define YP 2 // must be an analog pin AND digital #define XM 4 // must be an analog pin AND digital #define YM 15 //36 // MUST be a digital pin #define XP 22 //34 // MUST be a digital pin
The TouchScreen is integrated with the TFT so that there is only one flat contact to the board.
This is mainly for reference to people with the same or similar SeeedStudio TouchScreen.
There are a few differences in interfacing the SeeedStudio TouchScreen from Adafruit, but assigning the right pins is definitely a good start to fix the rest.