ESP32_C3: TFT_eSPI init() is crashing

Slonni
Posts: 5
Joined: Sat Dec 30, 2023 10:13 pm

ESP32_C3: TFT_eSPI init() is crashing

Postby Slonni » Mon Jan 01, 2024 8:42 pm

On my custom ESP32_C3 Super Mini board I am trying to connect a TFT display ST7789 with SPI interface.
As soon I am calling tft.init() the ESP32_C3 seem to crash and starting again. The following is the output shown in the TERMINAL from Platformio-development environment:
* Executing task in folder ESP32C3 Super Mini: C:\Users\Bernd\.platformio\penv\Scripts\platformio.exe device monitor

--- Terminal on COM4 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
Entering setup()
.....................................................
setup(): Led set to Output
.....................................................
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x8 (TG1WDT_SYS_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x40380082
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
SHA-256 comparison failed:
Calculated: 080c5cb68a075ced55f248b97bca965e3e5bd5da80a64e34e6a1638f89d6f64e
Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Attempting to boot anyway...
entry 0x403ce000
Entering setup()
.....................................................
setup(): Led set to Output
.....................................................
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
I simplified the code down to just a few lines where the problem clearly shows tft.init() is crashing. For reference I am adding the code here:

Code: Select all

#include "debug.h" 	// Define PRINT_LN() for debug output, you can also use Serial.println() 
#include "SPI.h"
#include "TFT_eSPI.h"
TFT_eSPI tft  = TFT_eSPI();         

#define LED 8 		// LED_BUILTIN for ESP32C Super Mini

void setup() {
  DEBUG_INIT
  PRINT_LN("Entering setup()");
  PRINT_LN(".....................................................");

  // Set pin mode
  pinMode(LED,OUTPUT);
  PRINT_LN("setup(): Led set to Output");
  PRINT_LN(".....................................................");
  delay(3000);  // wait a bit before going to crash :(
    
  tft.init(); 
  PRINT_LN("came back after tft-init()");
  PRINT_LN(".....................................................");  
}
I spent hours to search I-Net for getting a solution - w/o result.
I am also using standard ESP32 (WEMOS D1 Mini) with the same display ST7789 - here tft.init() and all the functionality I am using from the TFT_eSPI library is working as expected.
Has anyone an idea what the problem is - I am lost and have no clue anymore what I could do to fix this problem.
Thanks much for all ideas how to identify the root for this issue.
Best, Bernd

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32_C3: TFT_eSPI init() is crashing

Postby lbernstone » Tue Jan 02, 2024 6:52 pm

You need to provide a link to that library.
That library either needs to let you assign pins for the SPI, or else you will need to initialize the SPI with the correct pins before you initialize the TFT object.

Slonni
Posts: 5
Joined: Sat Dec 30, 2023 10:13 pm

Re: ESP32_C3: TFT_eSPI init() is crashing

Postby Slonni » Tue Jan 02, 2024 10:39 pm

Thanks again ...
The tft.init() problem is solved. TFT_eSPI needs to be configured for ESP32_C3 different than for ESP32. After plenty of additional research I found that. (after you know it, it's written at plenty locations ;))
I am using a display 240*240 wth ST7796 chipset:
In User_Setup.h you must uncomment #include <User_Setups/Setup70c_ESP32_C3_ILI9341.h>
In User_Setups/Setup70c_ESP32_C3_ILI9341.h you must choose which display type
In TFT_Drivers/ST7796_Defines.h you need to change resolution to correct values
That means now - my old application running on an ESP32 is now also running on ESP32_C3. (I can see from logging my application is running, but I don't see yet anything on the display :()
I guess display is not connected correctly - or maybe I have still a configuration problem. But that's a different problem - maybe worth another post in this forum.

Who is online

Users browsing this forum: No registered users and 36 guests