Using the SD card and the TFT_eSPI driver, the system crashes or in other cases performs a hard reset on loading #2420
Replies: 5 comments 3 replies
-
The library creates an spi instance for the VSPI channel unless #define USE_HSPI_PORT is in the setup file. To create a different spi instance you need to use a different varaible name, for example:
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
See this example. Note that the chip selects are set high before the SD and TFT are initialised to avoid conflicts. Try that example. |
Beta Was this translation helpful? Give feedback.
-
I just realised you have the SD card on the same SPI pins, so creating a new SPI instance will cause problems. The SPI instance must be the same as is used by TFT_eSPI, so this should work:
It is also a good idea to set the chip selects high as the start of setup as shown in the ESP32_SDcard_jpeg example linked to above. |
Beta Was this translation helpful? Give feedback.
-
OH MY GOD, this solution solves my problem AT FIRST SHOT. Iam was struggling with this in few days. THANK YOU. |
Beta Was this translation helpful? Give feedback.
-
I apologize in advance, I'm a beginner with this type of product and I don't know exactly what data could be useful for you to understand this strange behavior.
If you need the whole program and a complete debug and the User_setup.h.
Everything works fine until I add the SD.h library, if I use SPIClass spi = SPIClass(VSPI); before setup().
The system does not finish compiling:
c:/users/admin/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\TFT_eSPI\TFT_eSPI.cpp.o:C:\Users\admin\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c:17: multiple definition of `spi'; sketch\Gestione_Stagionatore-ota.ino.cpp.o:C:\Users\admin\Documents\Arduino\Gestione_Stagionatore-ota/Gestione_Stagionatore-ota.ino:126: first defined here
collect2.exe: error: ld returned 1 exit status
If I don't put it, it compiles but ESP- WROOM 32 - 38 pin keeps resetting itself:
rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13836
load:0x40080400,len:3608
entry 0x400805f0
ets Jun 8 2016 00:22:57
The version of all libraries are updated to the latest version. I'm using Arduino Ide 1.8.19
These are the libraries in use
#include <Wire.h>
#include <FS.h>
#include <SD.h>
#include <SPI.h>
#include <TFT_eSPI.h>
#include <WiFi.h>
#include <WebServer.h>
//#include <ArduinoOTA.h>
#include "AiEsp32RotaryEncoder.h"
#include <BME280I2C.h>
#include <TimeLib.h>
I'm using the ST7789 external display similar to the one inserted on the TTGO D-display the dimensions are 1.14' RGB 135x240 - DRIVER IC:ST7789V 4WIRE SPI PORT
With the following ports GND-VCC-SCL-SDA-RES-DC-CS-BLK
I look forward to your response if possible.
Beta Was this translation helpful? Give feedback.
All reactions