Bodmer / TFT_eSPI

Arduino and PlatformIO IDE compatible TFT library optimised for the Raspberry Pi Pico (RP2040), STM32, ESP8266 and ESP32 that supports different driver chips
Other
3.71k stars 1.07k forks source link

tft_eSPI and Wifi don't work when compiled with Arduino 2.3.2 (but works with Arduino 1.8.19) #3263

Open markeld opened 6 months ago

markeld commented 6 months ago

I use one of the samples (Local custom font) and have slightly modified setup to be (after including WiFi.h):

void setup(void) {

  Serial.begin(115200);

  tft.begin();

  tft.setRotation(1);

  Serial.printf("Starting Wifi");
  WiFi.mode(WIFI_STA);  //Optional
  WiFi.begin("SSID", "passworddd");

}

I am using an ESP32 WROOM32E board with 3.0.0-alpha3 SDK and 2.5.43 (but I've had the same problems with 2.0.14 SDK).

When I compile this using Arduino 1.8.9, it works fine. When I compile this using Arduino 2.3.2, the display stops working as soon as WiFi is initiated (even just WiFi.mode). The screen freezes and no further updates go through.

Now, I understand the two different IDEs shouldn't play a role, yet they do.

I use an ILI9481 display:

#define ILI9481_DRIVER
#define TFT_BL   26            // LED back-light control pin
#define TFT_BACKLIGHT_ON HIGH  // Level to turn ON back-light (HIGH or LOW)
//#define USE_HSPI_PORT

// Settings for the H-SPI bus; V-SPI also shown
#define TFT_MISO 12 // V-19 // (leave TFT SDO disconnected if other SPI devices share MISO)
#define TFT_MOSI 13 // V-23
#define TFT_SCLK 33 // normally for VSPI 14 // V-18
#define TFT_CS   15 // V-27  // Chip select control pin
#define TFT_DC   14 // normally for VSP 33  // Data Command control pin
#define TFT_RST  25  // Reset pin (could connect to RST pin)

#define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
/*#define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6  // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7  // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#define LOAD_FONT8  // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.*/
#define LOAD_GFXFF  // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts

#define SMOOTH_FONT  // used by VLW fonts
#define SPI_FREQUENCY  15000000

I suspect this is an issue with how 2.3.2 compiles the code, but I can't figure it out. Maybe someone else has seen this?

In 2.3.2. I've tried setting Events and Arduino to run on all combinations of Core 0 and Core 1, with no difference.

abrar-nazib commented 5 months ago

I am facing similar issue... Whenever the flash memory consumption gets higher than 85%, screen stops working. You may want to test the screen with lightweight images with WiFi on. Mine works when the Flash memory consumption is less than 85% on arduino IDE 2.3.2

markeld commented 5 months ago

@abrar-nazib my own binary is about 1.6mb, and I use an 8MB flash (3/3/2 partition), so there's plenty of flash space left.

I get the same behavior with the sample above, which is tiny - so I doubt flash size is the problem.