WROVER Dev Kit 4.1 LCD and SD Not Working

czuvich
Posts: 36
Joined: Tue Sep 04, 2018 1:58 am

WROVER Dev Kit 4.1 LCD and SD Not Working

Postby czuvich » Thu Jan 17, 2019 1:59 am

I am trying to get the WROVER Dev Kit LCD and SD to work together. I removed R167, and I can now show results in the LCD even if an SD Card is inserted; however, when I try to initialize the SD card it fails to mount (see error below). If I initialize ONLY the SD, then the SD works fine. Is there any way to use the SD Card and LCD?

I basically the LCD code on github (https://github.com/espressif/WROVER_KIT_LCD), and I added SPI and SD initialization after.

Error
19:49:03.595 -> [W][sd_diskio.cpp:471] ff_sd_initialize(): GO_IDLE_STATE failed
19:49:03.595 -> [E][sd_diskio.cpp:739] sdcard_mount(): f_mount failed 0x(3)

Code
// init code for LCD
SPI.begin(14, 2, 15, 13);
if (!SD.begin(13)) {
ESP_LOGE(LOG_TAG, "<< Failed. LocalStorage is not available.");
}

ESPuser
Posts: 1
Joined: Mon Feb 04, 2019 3:38 am

Re: WROVER Dev Kit 4.1 LCD and SD Not Working

Postby ESPuser » Mon Feb 04, 2019 3:48 am

I have been trying for weeks to get just the SD card to work on my V4.1 DEV KIT. I haven't removed the resistor that prevents the LCD from working with the SD card inserted. I Don't care about that right now. I just want the SD card to work. The presence of the SD card seems to be detected because I get a different error when the card is missing.

I am trying to run the use the SDcardtest example and am using the Arduino IDE with the board selected as "ESP WROVER Module".

Here are my test results:

ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x1e (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:1100
load:0x40078000,len:10088
load:0x40080400,len:6380
entry 0x400806a4
[D][esp32-hal-psram.c:47] psramInit(): PSRAM enabled
[SDcardTestMMC.ino:59] setup(): Initializing SD card
[SDcardTestMMC.ino:61] setup(): Using SDMMC peripheral

Results with card NOT inserted:
E (1442) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107
[E][SDcardTestMMC.ino:105] setup():
Failed to initialize the card (ESP_ERR_TIMEOUT).
Make sure SD card lines have pull-up resistors in place.

Results with card inserted:
E (1570) sdmmc_sd: sdmmc_init_sd_scr: send_scr (1) returned 0x109
[E][SDcardTestMMC.ino:105] setup():
Failed to initialize the card (ESP_ERR_INVALID_CRC).
Make sure SD card lines have pull-up resistors in place.


This is very frustrating..

User avatar
Segmentation Fault
Posts: 22
Joined: Sat Apr 04, 2020 1:49 am

Re: WROVER Dev Kit 4.1 LCD and SD Not Working

Postby Segmentation Fault » Sun Apr 19, 2020 11:42 pm

czuvich wrote:
Thu Jan 17, 2019 1:59 am
I am trying to get the WROVER Dev Kit LCD and SD to work together. I removed R167, and I can now show results in the LCD even if an SD Card is inserted; however, when I try to initialize the SD card it fails to mount (see error below). If I initialize ONLY the SD, then the SD works fine. Is there any way to use the SD Card and LCD?

I basically the LCD code on github (https://github.com/espressif/WROVER_KIT_LCD), and I added SPI and SD initialization after.

Error
19:49:03.595 -> [W][sd_diskio.cpp:471] ff_sd_initialize(): GO_IDLE_STATE failed
19:49:03.595 -> [E][sd_diskio.cpp:739] sdcard_mount(): f_mount failed 0x(3)

Code
// init code for LCD
SPI.begin(14, 2, 15, 13);
if (!SD.begin(13)) {
ESP_LOGE(LOG_TAG, "<< Failed. LocalStorage is not available.");
}


I have the same problem. Did you find a solution for it?

Where did u see thatR167 should be removed?

User avatar
ESP_Roland
Posts: 261
Joined: Tue Oct 09, 2018 10:28 am

Re: WROVER Dev Kit 4.1 LCD and SD Not Working

Postby ESP_Roland » Mon Apr 20, 2020 5:29 am

I have the same board but I cannot reproduce the issue. Can you please try the following example if it is not the "SDcardtest" example you are mentioning?

https://github.com/espressif/esp-idf/tr ... ge/sd_card

What IDF version are you using?

User avatar
Segmentation Fault
Posts: 22
Joined: Sat Apr 04, 2020 1:49 am

Re: WROVER Dev Kit 4.1 LCD and SD Not Working

Postby Segmentation Fault » Mon Apr 20, 2020 7:48 am

I am using Arduino IDE.

I could make a sample, would that be of help?

User avatar
ESP_Roland
Posts: 261
Joined: Tue Oct 09, 2018 10:28 am

Re: WROVER Dev Kit 4.1 LCD and SD Not Working

Postby ESP_Roland » Mon Apr 20, 2020 7:59 am

Thanks Segmentation Fault. Yes, any code could help reproduce the issue.

But firstly, if you just could try the given example with pure IDF then we could eliminate the possibility that the board with SD is not working and have the Arduino people look at it.

User avatar
Segmentation Fault
Posts: 22
Joined: Sat Apr 04, 2020 1:49 am

Re: WROVER Dev Kit 4.1 LCD and SD Not Working

Postby Segmentation Fault » Tue Apr 21, 2020 12:05 am

IDE: Arduino IDE 1.8.12
Hardware: ESP Wrover Kit v4.1.
Code: Developed from pieces from my main application for exhibition of the issue I am facing.

This code has been tested and confirms the issue on my board:

Code: Select all

#include <esp_task_wdt.h>
#include <WiFiClient.h>
#include <WiFi.h>
#include <esp_wifi.h>
#include <ESP32Ping.h>
#include <HTTPClient.h>
#include <WebServer.h>
#include <ESPmDNS.h>
#define FS_NO_GLOBALS
#include <SdFat.h>
#include <sdios.h>
#include <WROVER_KIT_LCD.h>
#include <FreeStack.h>
#include <SPI.h>
#include <SD.h>


int SERIAL_BAUD_RATE = 1500000;
#define SD_CS 13
#define RGB_LED_RED   0
#define RGB_LED_GREEN 2
#define RGB_LED_BLUE  4


#define USE_SDIO 0
#if USE_SDIO
  // Use faster SdioCardEX
  SdFatSdioEX sd;
#else // USE_SDIO
  SdFat sd;
#endif  // USE_SDIO


// global for card size
uint32_t cardSize;
// global for card erase size
uint32_t eraseSize;
// store error strings in flash
#define sdErrorMsg(msg) sd.errorPrint(F(msg));


TaskHandle_t Task1;
SemaphoreHandle_t baton;
WROVER_KIT_LCD tft; //object responsible for display control

void setup()
{
  // SET LEDs
  pinMode(RGB_LED_BLUE, OUTPUT);
  digitalWrite(RGB_LED_BLUE, LOW);
  pinMode(RGB_LED_RED, OUTPUT);
  digitalWrite(RGB_LED_RED, LOW);

  // SET Serial
  Serial.begin(SERIAL_BAUD_RATE);

  // Set SD
  SPI.begin(14, 2, 15, SD_CS); // The bultin SD card SPI for WROVER
  
  // Initialize SD
  Serial.print("Initializing the SD card... ");
  if (SD.begin(SD_CS))
  {
    Serial.println("OK!");
    // check for index.htm file
    Serial.print("Checking for index.htm... ");
    if (SD.exists("/index.htm"))
    {
    Serial.println("OK!");
    }
    else
    {
    Serial.println("Failed!");
    }
  }
  else
  {
    Serial.println("Failed!");
  }
  // CHeck sd fat
  Serial.println("Initialising sd FAT:");
  uint32_t t = millis();
  #if USE_SDIO
    if (!sd.cardBegin(SD_CS, SD_SCK_MHZ(10)))
    {
      Serial.print("cardBegin failed in #if USE_SDIO");
      sdErrorMsg("\ncardBegin failed");
    }
  #else  // USE_SDIO
    if (!sd.cardBegin(SD_CS, SD_SCK_MHZ(10)))
    {
      Serial.print("cardBegin failed in #else (of #if USE_SDIO)");
      sdErrorMsg("cardBegin failed");
    }
    else
    {
      if (!sd.fsBegin())
      {
        sdErrorMsg("\nFile System initialization failed.\n");
      }
    }
  #endif  // USE_SDIO 
  t = millis() - t;
  Serial.print("init time: ");
  Serial.print(t); Serial.println("ms");


  // Set LCD
  tft.begin();   
  tft.setRotation(1); // rotate to landscape
  // Write on LCD
  tft.fillScreen(WROVER_BLACK); // paints the entire canvas
  tft.setCursor(0, 0); // position the cursor at the origin
  tft.setTextColor(WROVER_WHITE);
  tft.setTextSize(1); // font size - 1
  tft.println("Chip: ESP32");
  tft.println("Board: ESP-WROVER-KIT V4.1");
  uint64_t chipid = ESP.getEfuseMac();
  tft.printf("Chip ID = %04X", (uint16_t)(chipid>>32));//print High 2 bytes
  tft.printf("%08X",(uint32_t)chipid);//print Low 4bytes.
  tft.println();  
  tft.print("Chip Size: "); tft.println(ESP.getFlashChipSize());
  tft.print("Chip Speed: "); tft.println(ESP.getFlashChipSpeed());
  tft.print("Chip Mode: "); tft.println(ESP.getFlashChipMode());
  tft.print("Running setup and loop on core: "); tft.println(xPortGetCoreID());

  // Core 0
  baton = xSemaphoreCreateMutex();
  xTaskCreatePinnedToCore( _blink, "Task1", 10000,  NULL,  0,  &Task1, 0);
  
}

void loop ()
{
  
}

int ledState = HIGH;
unsigned long previousMillis = 0;
const unsigned long interval_HIGH = 200;
const unsigned long interval_LOW = 1000;
byte ON = HIGH;
byte OFF = LOW;
bool blink_bool = true;
void _blink(void * parameter)
{
  Serial.println("Disabling watchdog on core: 0");
  disableCore0WDT();
  Serial.println("Starting loop on core: 0");
  while(true)
  {
    if (xSemaphoreTake( baton, portMAX_DELAY ) == pdTRUE)
    {
      // get blink_bool somehow
      xSemaphoreGive( baton );
    }
    
    if (blink_bool)
    {
      unsigned long currentMillis = millis();
      
      
      if ((ledState == ON) && (currentMillis - previousMillis >= interval_HIGH))
      {
        ledState = OFF;
        digitalWrite(RGB_LED_BLUE, ledState);
        previousMillis = millis();
      }
      else if ((ledState == OFF) && (currentMillis - previousMillis >= interval_LOW))
      {
        ledState = ON;
        digitalWrite(RGB_LED_BLUE, ledState);
        previousMillis = millis();
      }
    }
  }
}
The SD card works fine with this code, the LCD outputs white color.
To make the LCD work must a) remove lines 59-109 along with b) removing the SD card.

Unfortunately, I am not that experienced with esp-idf yet, but I will try the "sd_card" example and give you an update on that as well :)

User avatar
ESP_Roland
Posts: 261
Joined: Tue Oct 09, 2018 10:28 am

Re: WROVER Dev Kit 4.1 LCD and SD Not Working

Postby ESP_Roland » Tue Apr 21, 2020 5:44 am

Thanks Segmentation Fault.

In the meantime, I moved the topic to the Arduino sub-forum because I think this will be an Arduino issue.

ilioss
Posts: 17
Joined: Tue Sep 05, 2017 1:43 pm

Re: WROVER Dev Kit 4.1 LCD and SD Not Working

Postby ilioss » Wed Apr 22, 2020 12:50 pm

Hello ESP_Roland,

I read your topic concerning the SD and display issue on a Wrover board.
I also have this kind of problems using a ESP-wroom-32 board from doit dev.kit v1.

Same conditions arduino ide when testing the SD apart its ok. testing the TFT apart also ok.
Using both in one script display will stay blank and the SD gives no responce.

See my topic from Search
Advanced search
1 post • Page 1 of 1

ilioss
Posts: 12
Joined: Tue Sep 05, 2017 3:43 pm
Contact: Contact ilioss
1.8TFT SPI 128x160 module SD-card and Display will not work together

Postby ilioss » Sun Apr 19, 2020 11:08 am

Will you be please so kind to send the arduino forum link?

Many thanks in advance.
Regards,
ilioSS

User avatar
Segmentation Fault
Posts: 22
Joined: Sat Apr 04, 2020 1:49 am

Re: WROVER Dev Kit 4.1 LCD and SD Not Working

Postby Segmentation Fault » Sat Apr 25, 2020 10:35 pm

Everything fine with the sd example

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x1e (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:2
load:0x3fff0018,len:4
load:0x3fff001c,len:6860
load:0x40078000,len:14076
ho 0 tail 12 room 4
load:0x40080400,len:4304
entry 0x400806e8
I (71) boot: Chip Revision: 1
I (72) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (41) boot: ESP-IDF v4.0-dirty 2nd stage bootloader
I (41) boot: compile time 00:21:57
I (41) boot: Enabling RNG early entropy source...
I (46) boot: SPI Speed      : 40MHz
I (50) boot: SPI Mode       : DIO
I (54) boot: SPI Flash Size : 2MB
I (58) boot: Partition Table:
I (62) boot: ## Label            Usage          Type ST Offset   Length
I (69) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (77) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (84) boot:  2 factory          factory app      00 00 00010000 00100000
I (92) boot: End of partition table
I (96) boot_comm: chip revision: 1, min. application chip revision: 0
I (103) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x09404 ( 37892) map
I (126) esp_image: segment 1: paddr=0x0001942c vaddr=0x3ffb0000 size=0x02114 (  8468) load
I (129) esp_image: segment 2: paddr=0x0001b548 vaddr=0x40080000 size=0x00400 (  1024) load
I (133) esp_image: segment 3: paddr=0x0001b950 vaddr=0x40080400 size=0x046c0 ( 18112) load
I (149) esp_image: segment 4: paddr=0x00020018 vaddr=0x400d0018 size=0x1c58c (116108) map
I (192) esp_image: segment 5: paddr=0x0003c5ac vaddr=0x40084ac0 size=0x05be4 ( 23524) load
I (209) boot: Loaded app from partition at offset 0x10000
I (209) boot: Disabling RNG early entropy source...
I (209) cpu_start: Pro cpu up.
I (213) cpu_start: Application information:
I (218) cpu_start: Project name:     sd_card
I (222) cpu_start: App version:      1
I (227) cpu_start: Compile time:     Apr 26 2020 00:21:32
I (233) cpu_start: ELF file SHA256:  528eb3aafec05ca9...
I (239) cpu_start: ESP-IDF:          v4.0-dirty
I (244) cpu_start: Starting app cpu, entry point is 0x40081038
I (0) cpu_start: App cpu up.
I (255) heap_init: Initializing. RAM available for dynamic allocation:
I (262) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (268) heap_init: At 3FFB3210 len 0002CDF0 (179 KiB): DRAM
I (274) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (280) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (287) heap_init: At 4008A6A4 len 0001595C (86 KiB): IRAM
I (293) cpu_start: Pro cpu start user code
I (311) spi_flash: detected chip: generic
I (311) spi_flash: flash io: dio
W (312) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (322) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (333) example: Initializing SD card
I (333) example: Using SDMMC peripheral
I (343) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
Name: SC16G
Type: SDHC/SDXC
Speed: 20 MHz
Size: 15193MB
I (413) example: Opening file
I (423) example: File written
I (423) example: Renaming file
I (423) example: Reading file
I (423) example: Read from file: 'Hello SC16G!'
I (423) example: Card unmounted



Is someone looking into this?

Who is online

Users browsing this forum: No registered users and 95 guests