Is it possible to use the 3.5" 480x320 TFT FeatherWing with the ESP32-S3 TFT Feather? I have an application where I would like to have the tiny TFT on the CPU feather itself to display troubleshooting info while the main UI shows on the big touchscreen.
I have tried running my existing code that works on the ESP32 feather and it just crashes on ts.begin()
Anyone have any idea what needs to be done special here?
Thanks,
Jon
ESP32-S3 TFT Feather with 3.5" 480x320 TFT FeatherWing
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- JMellen
- Posts: 18
- Joined: Thu Oct 07, 2021 5:58 pm
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: ESP32-S3 TFT Feather with 3.5" 480x320 TFT FeatherWing
You give no context as to what ts is. Can you post your code?
Dave
Dave
- JMellen
- Posts: 18
- Joined: Thu Oct 07, 2021 5:58 pm
Re: ESP32-S3 TFT Feather with 3.5" 480x320 TFT FeatherWing
Sorry for the confusion, this is the "standard" code to start the communications with the touchscreen. It is featured in the example file "touchpaint_featherwing.ino"
pasted below:
pasted below:
Code: Select all
/***************************************************
This is our library for the Adafruit HX8357D Featherwing
----> http://www.adafruit.com/products/2050
Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to
interface (RST is optional)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#include <SPI.h>
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_HX8357.h>
#include <Adafruit_STMPE610.h>
#ifdef ESP8266
#define STMPE_CS 16
#define TFT_CS 0
#define TFT_DC 15
#define SD_CS 2
#endif
#ifdef ESP32
#define STMPE_CS 32
#define TFT_CS 15
#define TFT_DC 33
#define SD_CS 14
#endif
#ifdef TEENSYDUINO
#define TFT_DC 10
#define TFT_CS 4
#define STMPE_CS 3
#define SD_CS 8
#endif
#ifdef ARDUINO_STM32_FEATHER
#define TFT_DC PB4
#define TFT_CS PA15
#define STMPE_CS PC7
#define SD_CS PC5
#endif
#ifdef ARDUINO_NRF52832_FEATHER
#define STMPE_CS 30
#define TFT_CS 31
#define TFT_DC 11
#define SD_CS 27
#endif
#if defined(ARDUINO_MAX32620FTHR) || defined(ARDUINO_MAX32630FTHR)
#define TFT_DC P5_4
#define TFT_CS P5_3
#define STMPE_CS P3_3
#define SD_CS P3_2
#endif
// Anything else!
#if defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) || \
defined(ARDUINO_SAMD_ZERO) || defined(__SAMD51__) || defined(__SAM3X8E__) || defined(ARDUINO_NRF52840_FEATHER)
#define STMPE_CS 6
#define TFT_CS 9
#define TFT_DC 10
#define SD_CS 5
#endif
#define TFT_RST -1
// Init screen on hardware SPI, HX8357D type:
Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);
Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS);
// This is calibration data for the raw touch data to the screen coordinates
#define TS_MINX 3800
#define TS_MAXX 100
#define TS_MINY 100
#define TS_MAXY 3750
// Size of the color selection boxes and the paintbrush size
#define BOXSIZE 40
#define BANNED 3
int oldcolor, currentcolor;
void setup() {
Serial.begin(115200);
//while (!Serial) delay(10);
Serial.println("HX8357D Featherwing touch test!");
if (!ts.begin()) {
Serial.println("Couldn't start touchscreen controller");
while (1);
}
Serial.println("Touchscreen started");
tft.begin();
tft.fillScreen(HX8357_BLACK);
// make the color selection boxes
tft.fillRect(0, 0, BOXSIZE, BOXSIZE, HX8357_RED);
tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, HX8357_YELLOW);
tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, HX8357_GREEN);
tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, HX8357_CYAN);
tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, HX8357_BLUE);
tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, HX8357_MAGENTA);
tft.fillRect(BOXSIZE*6, 0, BOXSIZE, BOXSIZE, HX8357_BLACK);
tft.fillRect(BOXSIZE*6, 0, BOXSIZE, BOXSIZE, HX8357_WHITE);
// select the current color 'red'
tft.drawRect(0, 0, BOXSIZE, BOXSIZE, HX8357_WHITE);
currentcolor = HX8357_RED;
}
void loop(void) {
// Retrieve a point
TS_Point p = ts.getPoint();
// Serial.print("X = "); Serial.print(p.x); Serial.print("\tY = "); Serial.print(p.y); Serial.print("\tPressure = "); Serial.println(p.z);
// Scale from ~0->4000 to tft.width using the calibration #'s
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.height());
if (p.y < BOXSIZE) {
oldcolor = currentcolor;
if (p.x < BOXSIZE) {
currentcolor = HX8357_RED;
tft.drawRect(0, 0, BOXSIZE, BOXSIZE, HX8357_WHITE);
} else if (p.x < BOXSIZE*2) {
currentcolor = HX8357_YELLOW;
tft.drawRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, HX8357_WHITE);
} else if (p.x < BOXSIZE*3) {
currentcolor = HX8357_GREEN;
tft.drawRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, HX8357_WHITE);
} else if (p.x < BOXSIZE*4) {
currentcolor = HX8357_CYAN;
tft.drawRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, HX8357_WHITE);
} else if (p.x < BOXSIZE*5) {
currentcolor = HX8357_BLUE;
tft.drawRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, HX8357_WHITE);
} else if (p.x < BOXSIZE*6) {
currentcolor = HX8357_MAGENTA;
tft.drawRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, HX8357_WHITE);
} else if (p.x < BOXSIZE*7) {
currentcolor = HX8357_WHITE;
tft.drawRect(BOXSIZE*6, 0, BOXSIZE, BOXSIZE, HX8357_RED);
} else if (p.x < BOXSIZE*8) {
currentcolor = HX8357_BLACK;
tft.drawRect(BOXSIZE*7, 0, BOXSIZE, BOXSIZE, HX8357_WHITE);
}
if (oldcolor != currentcolor) {
if (oldcolor == HX8357_RED)
tft.fillRect(0, 0, BOXSIZE, BOXSIZE, HX8357_RED);
if (oldcolor == HX8357_YELLOW)
tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, HX8357_YELLOW);
if (oldcolor == HX8357_GREEN)
tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, HX8357_GREEN);
if (oldcolor == HX8357_CYAN)
tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, HX8357_CYAN);
if (oldcolor == HX8357_BLUE)
tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, HX8357_BLUE);
if (oldcolor == HX8357_MAGENTA)
tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, HX8357_MAGENTA);
if (oldcolor == HX8357_WHITE)
tft.fillRect(BOXSIZE*6, 0, BOXSIZE, BOXSIZE, HX8357_WHITE);
if (oldcolor == HX8357_BLACK)
tft.fillRect(BOXSIZE*7, 0, BOXSIZE, BOXSIZE, HX8357_BLACK);
}
}
if (((p.y-BANNED) > 0) && ((p.y+BANNED) < tft.height())) {
tft.fillCircle(p.x, p.y, BANNED, currentcolor);
}
}
Last edited by dastels on Wed Sep 07, 2022 1:50 pm, edited 1 time in total.
Reason: Add code tags
Reason: Add code tags
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: ESP32-S3 TFT Feather with 3.5" 480x320 TFT FeatherWing
Is this the code that's crashing? And what do you mean by crashing?
Dave
Dave
- JMellen
- Posts: 18
- Joined: Thu Oct 07, 2021 5:58 pm
Re: ESP32-S3 TFT Feather with 3.5" 480x320 TFT FeatherWing
This code essentially locks up before initializing the touchscreen (never prints any thing to the serial monitor) and just sits there with the touchscreen all white. My personal code, which is similar to this, but more complex works up until the ts.begin() and then the entire thing crashes and starts again. All of this works on a standard ESP32 feather, so I am assuming it either has some type of interference between the small TFT on the back of the board or maybe an issue with the ESP32-S3 itself, but honestly I am not sure where to even start since most of this is handled by libraries...
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: ESP32-S3 TFT Feather with 3.5" 480x320 TFT FeatherWing
Please post your code. At least up to the ts.begin() call.
Dave
Dave
- JMellen
- Posts: 18
- Joined: Thu Oct 07, 2021 5:58 pm
Re: ESP32-S3 TFT Feather with 3.5" 480x320 TFT FeatherWing
Unfortunately I don’t think I can slim down my code without a significant amount of work. I was hoping someone from Adafruit would respond since these are their products and they should be able to test this or at least let me know if it is even possible...
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: ESP32-S3 TFT Feather with 3.5" 480x320 TFT FeatherWing
I am working with Adafruit here. I didn't ask for you to slim it down, just post it. I want to see what the code is doing.
Dave
Dave
- JMellen
- Posts: 18
- Joined: Thu Oct 07, 2021 5:58 pm
Re: ESP32-S3 TFT Feather with 3.5" 480x320 TFT FeatherWing
I really appreciate the effort, but the code is over 10,000 lines, requires multiple pieces of hardware and is extremely proprietary.
Are you able to get the Adafruit "touchpoint_featherwing.ino" code functioning? because if you can get that running and show me what you did I am sure I will be able to adapt that solution to my code.
Thanks,
Jon
Are you able to get the Adafruit "touchpoint_featherwing.ino" code functioning? because if you can get that running and show me what you did I am sure I will be able to adapt that solution to my code.
Thanks,
Jon
- dastels
- Posts: 15608
- Joined: Tue Oct 20, 2015 3:22 pm
Re: ESP32-S3 TFT Feather with 3.5" 480x320 TFT FeatherWing
Alas, I don't have an S3-TFT.
Hmm. There is a control on the power to the onboard sensor and display system. Is it being enabled first? See https://learn.adafruit.com/adafruit-esp ... ay-3123714
Understood about the code.
Dave
Hmm. There is a control on the power to the onboard sensor and display system. Is it being enabled first? See https://learn.adafruit.com/adafruit-esp ... ay-3123714
Understood about the code.
Dave
- XRAD
- Posts: 753
- Joined: Sat Nov 19, 2016 3:28 pm
Re: ESP32-S3 TFT Feather with 3.5" 480x320 TFT FeatherWing
OP: are you asking if you can use two different TFTs with one code? the answer is yes. But I don't think you can piggyback the ESP on to the larger tft and have it work because of shared pins...
I have two different displays in a project and works fine, but I am using a separate multipin output processor:
for example...
I have two different displays in a project and works fine, but I am using a separate multipin output processor:
for example...
Code: Select all
#include<Wire.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#include <Adafruit_INA260.h>
#include <FTOLED.h>
#include <Adafruit_NeoPixel.h>
#include <wavTrigger.h>
#define N_LEDS 16
#define PIN 16 //neopixel rotary ring
Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_LEDS, PIN, NEO_GRB + NEO_KHZ800);
wavTrigger wTrig; // Our WAV Trigger object
//master/slave
int s ;// servos
int p = 7 ;// pixies
//display stuff
#include <fonts/Droid_Sans_12.h>
#include <fonts/Droid_Sans_64.h>
#include <fonts/Droid_Sans_24.h>
#define TFT_DC 10
#define TFT_CS 4
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
Adafruit_INA260 ina260 = Adafruit_INA260();
//OLED
#define pin_reset 24//not used but defined
#define pin_dc 8
#define pin_cs 9
OLED oled(pin_cs, pin_dc, pin_reset);
- JMellen
- Posts: 18
- Joined: Thu Oct 07, 2021 5:58 pm
Re: ESP32-S3 TFT Feather with 3.5" 480x320 TFT FeatherWing
Hi XRAD,
Yes, I am trying to use the TFT that comes on the back of the ESP32-S3 TFT along with the TFT Featherwing.... I will have to look into the documentation further to see if they share the same chip select pin.
Thanks,
Jon
Yes, I am trying to use the TFT that comes on the back of the ESP32-S3 TFT along with the TFT Featherwing.... I will have to look into the documentation further to see if they share the same chip select pin.
Thanks,
Jon
- XRAD
- Posts: 753
- Joined: Sat Nov 19, 2016 3:28 pm
Re: ESP32-S3 TFT Feather with 3.5" 480x320 TFT FeatherWing
Hi Jon, Yw! typically, you just adjust the pin defines in code as needed so no overlap. Basically, just changing CS should work. You might have to adjust touch pin(s) as well....Use hardware SPI for faster display. You can cut/bypass traces on either of the feathers so no physical conflicts if you plan to stack everything.....I often use the empty feather protoboards to make TFT adapters so everything plugs in nicely....
if display speed and extra pins are a requirement, check out feather M4 express....
if display speed and extra pins are a requirement, check out feather M4 express....
Please be positive and constructive with your questions and comments.