ESP32 SPI TFT Display will nicht

Hi Forum,

ich habe ein SPI TFT Display und komme damit nicht vorran. Ich habe folgendes Display
https://www.mouser.de/new/dfrobot/dfrobot-dfr0529-tft-lcd-display/
Am Arduio Uno läuft das auch soweit. Wenn ich auf den ESP32 wechsel, geht es nicht mehr. Ich hab zuerst gedacht, dass es an der SPI Libary von Arduino liegt und habe mir eine für den ESP runtergeladen

sobald ich aber meinen Code hochlade und tft.begin(); im Code habe, stürtzt der ESP mit folgender Fehlermeldung ab:

Kann mir da jemand weiterhelfen?
Danke schonmal.
Mfg Peter

: 0x00000000  A8      : 0x800d1461  A9      : 0x3ffb1f20
A10     : 0x3ffbfec4  A11     : 0x000000d7  A12     : 0x00000001  A13     : 0x000000ff
A14     : 0x000000ff  A15     : 0x00000004  SAR     : 0x00000006  EXCCAUSE: 0x0000001c
EXCVADDR: 0xffffffc1  LBEG    : 0x400d32a4  LEND    : 0x400d32b1  LCOUNT  : 0x00000000

ELF file SHA256: 0000000000000000

Backtrace: 0x400e9cc0:0x3ffb1f40 0x400d1013:0x3ffb1f60 0x400d0d5a:0x3ffb1f80 0x400d3cc2:0x3ffb1fb0 0x4008616d:0x3ffb1fd0

Rebooting...
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_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:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x400e9cc0  PS      : 0x00060930  A0      : 0x800d1016  A1      : 0x3ffb1f40
A2      : 0x3ffbfe80  A3      : 0x000000d7  A4      : 0x3ffbfefc  A5      : 0x00000003
A6      : 0x00000001  A7      : 0x00000000  A8      : 0x800d1461  A9      : 0x3ffb1f20
A10     : 0x3ffbfec4  A11     : 0x000000d7  A12     : 0x00000001  A13     : 0x000000ff
A14     : 0x000000ff  A15     : 0x00000004  SAR     : 0x00000006  EXCCAUSE: 0x0000001c
EXCVADDR: 0xffffffc1  LBEG    : 0x400d32a4  LEND    : 0x400d32b1  LCOUNT  : 0x00000000

ELF file SHA256: 0000000000000000

Backtrace: 0x400e9cc0:0x3ffb1f40 0x400d1013:0x3ffb1f60 0x400d0d5a:0x3ffb1f80 0x400d3cc2:0x3ffb1fb0 0x4008616d:0x3ffb1fd0

Hier nochmal mein ganzer Sketch:



/* The ESP32 has four SPi buses, however as of right now only two of
 * them are available to use, HSPI and VSPI. Simply using the SPI API 
 * as illustrated in Arduino examples will use VSPI, leaving HSPI unused.
 * 
 * However if we simply intialise two instance of the SPI class for both
 * of these buses both can be used. However when just using these the Arduino
 * way only will actually be outputting at a time.
 * 
 * Logic analyser capture is in the same folder as this example as
 * "multiple_bus_output.png"
 * 
 * created 30/04/2018 by Alistair Symonds
 */

 
#include "DFRobot_ST7687S_Latch.h"
#include "DFRobot_Display_Clock.h"
#include <SPI.h>

uint8_t pin_wr = 25, pin_cs = 26, pin_rs = 27,  pin_lck = 33;

DFRobot_ST7687S_Latch tft(pin_cs, pin_rs, pin_wr, pin_lck);
// Define ALTERNATE_PINS to use non-standard GPIO pins for SPI bus

#ifdef ALTERNATE_PINS
  #define VSPI_MISO   2
  #define VSPI_MOSI   4
  #define VSPI_SCLK   0
  #define VSPI_SS     33

  #define HSPI_MISO   26
  #define HSPI_MOSI   27
  #define HSPI_SCLK   25
  #define HSPI_SS     32
#else
  #define VSPI_MISO   MISO
  #define VSPI_MOSI   MOSI
  #define VSPI_SCLK   SCK
  #define VSPI_SS     SS

  #define HSPI_MISO   12
  #define HSPI_MOSI   13
  #define HSPI_SCLK   14
  #define HSPI_SS     15
#endif

#if CONFIG_IDF_TARGET_ESP32S2
#define VSPI FSPI
#endif

static const int spiClk = 1000000; // 1 MHz

//uninitalised pointers to SPI objects
SPIClass * vspi = NULL;
SPIClass * hspi = NULL;

void setup() {
  //initialise two instances of the SPIClass attached to VSPI and HSPI respectively
  vspi = new SPIClass(VSPI);
  hspi = new SPIClass(HSPI);
  
  //clock miso mosi ss

#ifndef ALTERNATE_PINS
  //initialise vspi with default pins
  //SCLK = 18, MISO = 19, MOSI = 23, SS = 5
  vspi->begin();
#else
  //alternatively route through GPIO pins of your choice
  vspi->begin(VSPI_SCLK, VSPI_MISO, VSPI_MOSI, VSPI_SS); //SCLK, MISO, MOSI, SS
#endif

#ifndef ALTERNATE_PINS
  //initialise hspi with default pins
  //SCLK = 14, MISO = 12, MOSI = 13, SS = 15
  hspi->begin();
#else
  //alternatively route through GPIO pins
  hspi->begin(HSPI_SCLK, HSPI_MISO, HSPI_MOSI, HSPI_SS); //SCLK, MISO, MOSI, SS
#endif

  //set up slave select pins as outputs as the Arduino API
  //doesn't handle automatically pulling SS low
  pinMode(VSPI_SS, OUTPUT); //VSPI SS
  pinMode(HSPI_SS, OUTPUT); //HSPI SS
  Serial.begin(115200);
  //tft.begin();
  //tft.fillScreen(DISPLAY_GREEN);
  //tft.drawCircle(0, 0, 59, DISPLAY_GREEN);  //draw circle at (0, 0) and radius = 20
  

}

// the loop function runs over and over again until power down or reset
void loop() {
  //use the SPI buses
  vspiCommand();
  hspiCommand();
  
  Serial.print("läuft");
  delay(100);
}

void vspiCommand() {
  byte data = 0b01010101; // junk data to illustrate usage

  //use it as you would the regular arduino SPI API
  vspi->beginTransaction(SPISettings(spiClk, MSBFIRST, SPI_MODE0));
  digitalWrite(VSPI_SS, LOW); //pull SS slow to prep other end for transfer
  vspi->transfer(data);  
  digitalWrite(VSPI_SS, HIGH); //pull ss high to signify end of data transfer
  vspi->endTransaction();
}

void hspiCommand() {
  byte stuff = 0b11001100;
  
  hspi->beginTransaction(SPISettings(spiClk, MSBFIRST, SPI_MODE0));
  digitalWrite(HSPI_SS, LOW);
  hspi->transfer(stuff);
  digitalWrite(HSPI_SS, HIGH);
  hspi->endTransaction();
}

hier sind die beiden anderen Bibliotheken:

Ah und ich habe die SPI Pins 13 und 14 am ESP genommen.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.