loboris / ESP32_TFT_library

Full featured TFT library for ESP32 with demo application
564 stars 219 forks source link

Running SD and TFT on different SPI bus simultaneously. #44

Closed haarislabs closed 6 years ago

haarislabs commented 6 years ago

I'm trying to use ST7735 TFT and the on board SD card of the ST7735 simultaneously. TFT uses the HSPI and SD uses the VSPI . My application is such that the Esp32 gets the data through BLE. I'm using freertos such that it stores the data in SD card in one task and displays it on TFT in the other task, both have the same task priority . But when I execute this I get the following error : https://ibb.co/b1mbMy It keeps on resseting it self. When I change the SPI bus , i mean change TFT bus to VSPI and SD card bus to HSPI, then only the SD card works and tft doesn't display anything though it intialises without any error.

My pin cofigurations are :

SD CARD :

define sdPIN_NUM_MISO 27

define sdPIN_NUM_MOSI 12

define sdPIN_NUM_CLK 14

define sdPIN_NUM_CS 13

TFT ST7735 :

define PIN_NUM_MISO 19 // SPI MISO

define PIN_NUM_MOSI 23 // SPI MOSI

define PIN_NUM_CLK 18 // SPI CLOCK pin

define PIN_NUM_CS 15 // Display CS pin

define PIN_NUM_DC 2 // Display command/data pin

define PIN_NUM_RST 4 // GPIO used for RESET control

AsyncAwayt commented 6 years ago

I am experiencing the same issue with an ILI9341 and a SD card. Any progress on this resolution?

AsyncAwayt commented 6 years ago

I managed to solve this issue by adding the following lines to the SD initialization:

host.max_freq_khz = 16000;
host.slot = VSPI_HOST;
slot_config.dma_channel = 2;