Esp32 showing File System init failed error

The project is a Google photo clock and is supposed to be a slightlymodified version of this. for now ive disabled wdt and ntp protocol to diagnose the issue. using a esp32devkit v1 board and ili9341 display and isnt initializing file system. tried different programs to check if there was a fault with esp32 but no errors with read or write. This is the code

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>/*******************************************************************************
* Google Photo Clock
* This is a simple IoT photo frame sample
******************************************************************************/
/* WiFi settings */
#define SSID_NAME "______"
#define SSID_PASSWORD "___________"
/* Google Photo settings */
#define PHOTO_LIMIT 20 // read first 10 photos to the list, ESP32 can add more
#define PHOTO_ID_SIZE 159 // the photo ID should be 158 charaters long and then add a zero-tail
/* NTP settings */
#if defined(ESP32)
#define GMT_OFFSET_SEC 19800L // Timezone +5.5 India
#define DAYLIGHT_OFFSET_SEC 0L // no daylight saving
#endif
/*******************************************************************************
* Start of Arduino_GFX setting
******************************************************************************/
#include <Arduino_GFX_Library.h>
#define TFT_RST 33
#define TFT_BL 22
/* More dev device declaration: https://github.com/moononournation/Arduino_GFX/wiki/Dev-Device-Declaration */
#if defined(DISPLAY_DEV_KIT)
Arduino_GFX *gfx = create_default_Arduino_GFX();
#else /* !defined(DISPLAY_DEV_KIT) */
/* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */
Arduino_DataBus *bus = create_default_Arduino_DataBus();
/* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
Arduino_GFX *gfx = new Arduino_ILI9341(bus, TFT_RST, 0 /* rotation */, false /* IPS */);
#endif /* !defined(DISPLAY_DEV_KIT) */
/*******************************************************************************
* End of Arduino_GFX setting
******************************************************************************/
/* file system */
#if defined(ESP32)
#include <FFat.h>
// #include <LittleFS.h>
#elif defined(ESP32)
#include <LittleFS.h>
#endif
/* time library */
#include <time.h>
static time_t now;
/* variables */
static int w, h, timeX, timeY, photoCount;
static uint8_t textSize;
static unsigned long next_show_millis = 0;
static bool shownPhoto = false;
void ntpGetTime()
{
// Initialize NTP settings
#if defined(ESP32)
configTime(GMT_OFFSET_SEC, DAYLIGHT_OFFSET_SEC, NTP_SERVER);
#endif
gfx->setTextColor(GREEN);
gfx->print(F("Waiting for NTP time sync: "));
Serial.print(F("Waiting for NTP time sync: "));
time_t nowSecs = time(nullptr);
while (nowSecs < 8 * 3600 * 2)
{
delay(500);
Serial.print('.');
gfx->print('.');
yield();
nowSecs = time(nullptr);
}
gfx->println(F(" done."));
Serial.println(F(" done."));
gfx->setTextColor(BLUE);
gfx->println(asctime(localtime(&nowSecs)));
Serial.println(asctime(localtime(&nowSecs)));
}
void printTime()
{
now = time(nullptr);
const tm *tm = localtime(&now);
int hour = tm->tm_hour;
int min = tm->tm_min;
// set text size with pixel margin
gfx->setTextSize(textSize, textSize, 2);
if (!shownPhoto)
{
// print time with black background
gfx->setCursor(timeX, timeY);
gfx->setTextColor(WHITE, BLACK);
gfx->printf("%02d:%02d", hour, min);
}
else
{
// print time with border
gfx->setCursor(timeX - 1, timeY - 1);
gfx->setTextColor(DARKGREY);
gfx->printf("%02d:%02d", hour, min);
gfx->setCursor(timeX + 2, timeY + 2);
gfx->setTextColor(BLACK);
gfx->printf("%02d:%02d", hour, min);
gfx->setCursor(timeX, timeY);
gfx->setTextColor(WHITE);
gfx->printf("%02d:%02d", hour, min);
}
}
void setup()
{
Serial.begin(115200);
// init display
gfx->begin();
gfx->fillScreen(BLACK);
#ifdef TFT_BL
// turn on display backlight
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
#endif
w = gfx->width();
h = gfx->height();
textSize = w / 6 / 5;
timeX = (w - (textSize * 5 * 6)) / 2;
timeY = h - (textSize * 8) - 10;
gfx->setTextSize(1);
gfx->setCursor(0, 0);
gfx->setTextColor(RED);
gfx->println(F("Google Photo Clock"));
Serial.println(F("Google Photo Clock"));
gfx->setTextColor(ORANGE);
gfx->print(F("Screen: "));
Serial.print(F("Screen: "));
gfx->print(w);
Serial.print(w);
gfx->print('x');
Serial.print('x');
gfx->println(h);
Serial.println(h);
gfx->setTextColor(YELLOW);
gfx->print(F("Clock text size: "));
Serial.print(F("Clock text size: "));
gfx->println(textSize);
Serial.println(textSize);
// init file system
#if defined(ESP32)
if (!FFat.begin(true))
// if (!LittleFS.begin())
#elif defined(ESP32)
if (!LittleFS.begin())
#endif
{
gfx->print(F("File system init failed!"));
Serial.print(F("File system init failed!"));
}
else
{
gfx->print(F("File system init success."));
Serial.print(F("File system init success."));
}
// init time
ntpGetTime();
// print time on black screen before down load image
printTime();
}
void loop()
{
delay(1000);
// overlay current time on the photo
printTime();
}
</code>
<code>/******************************************************************************* * Google Photo Clock * This is a simple IoT photo frame sample ******************************************************************************/ /* WiFi settings */ #define SSID_NAME "______" #define SSID_PASSWORD "___________" /* Google Photo settings */ #define PHOTO_LIMIT 20 // read first 10 photos to the list, ESP32 can add more #define PHOTO_ID_SIZE 159 // the photo ID should be 158 charaters long and then add a zero-tail /* NTP settings */ #if defined(ESP32) #define GMT_OFFSET_SEC 19800L // Timezone +5.5 India #define DAYLIGHT_OFFSET_SEC 0L // no daylight saving #endif /******************************************************************************* * Start of Arduino_GFX setting ******************************************************************************/ #include <Arduino_GFX_Library.h> #define TFT_RST 33 #define TFT_BL 22 /* More dev device declaration: https://github.com/moononournation/Arduino_GFX/wiki/Dev-Device-Declaration */ #if defined(DISPLAY_DEV_KIT) Arduino_GFX *gfx = create_default_Arduino_GFX(); #else /* !defined(DISPLAY_DEV_KIT) */ /* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */ Arduino_DataBus *bus = create_default_Arduino_DataBus(); /* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */ Arduino_GFX *gfx = new Arduino_ILI9341(bus, TFT_RST, 0 /* rotation */, false /* IPS */); #endif /* !defined(DISPLAY_DEV_KIT) */ /******************************************************************************* * End of Arduino_GFX setting ******************************************************************************/ /* file system */ #if defined(ESP32) #include <FFat.h> // #include <LittleFS.h> #elif defined(ESP32) #include <LittleFS.h> #endif /* time library */ #include <time.h> static time_t now; /* variables */ static int w, h, timeX, timeY, photoCount; static uint8_t textSize; static unsigned long next_show_millis = 0; static bool shownPhoto = false; void ntpGetTime() { // Initialize NTP settings #if defined(ESP32) configTime(GMT_OFFSET_SEC, DAYLIGHT_OFFSET_SEC, NTP_SERVER); #endif gfx->setTextColor(GREEN); gfx->print(F("Waiting for NTP time sync: ")); Serial.print(F("Waiting for NTP time sync: ")); time_t nowSecs = time(nullptr); while (nowSecs < 8 * 3600 * 2) { delay(500); Serial.print('.'); gfx->print('.'); yield(); nowSecs = time(nullptr); } gfx->println(F(" done.")); Serial.println(F(" done.")); gfx->setTextColor(BLUE); gfx->println(asctime(localtime(&nowSecs))); Serial.println(asctime(localtime(&nowSecs))); } void printTime() { now = time(nullptr); const tm *tm = localtime(&now); int hour = tm->tm_hour; int min = tm->tm_min; // set text size with pixel margin gfx->setTextSize(textSize, textSize, 2); if (!shownPhoto) { // print time with black background gfx->setCursor(timeX, timeY); gfx->setTextColor(WHITE, BLACK); gfx->printf("%02d:%02d", hour, min); } else { // print time with border gfx->setCursor(timeX - 1, timeY - 1); gfx->setTextColor(DARKGREY); gfx->printf("%02d:%02d", hour, min); gfx->setCursor(timeX + 2, timeY + 2); gfx->setTextColor(BLACK); gfx->printf("%02d:%02d", hour, min); gfx->setCursor(timeX, timeY); gfx->setTextColor(WHITE); gfx->printf("%02d:%02d", hour, min); } } void setup() { Serial.begin(115200); // init display gfx->begin(); gfx->fillScreen(BLACK); #ifdef TFT_BL // turn on display backlight pinMode(TFT_BL, OUTPUT); digitalWrite(TFT_BL, HIGH); #endif w = gfx->width(); h = gfx->height(); textSize = w / 6 / 5; timeX = (w - (textSize * 5 * 6)) / 2; timeY = h - (textSize * 8) - 10; gfx->setTextSize(1); gfx->setCursor(0, 0); gfx->setTextColor(RED); gfx->println(F("Google Photo Clock")); Serial.println(F("Google Photo Clock")); gfx->setTextColor(ORANGE); gfx->print(F("Screen: ")); Serial.print(F("Screen: ")); gfx->print(w); Serial.print(w); gfx->print('x'); Serial.print('x'); gfx->println(h); Serial.println(h); gfx->setTextColor(YELLOW); gfx->print(F("Clock text size: ")); Serial.print(F("Clock text size: ")); gfx->println(textSize); Serial.println(textSize); // init file system #if defined(ESP32) if (!FFat.begin(true)) // if (!LittleFS.begin()) #elif defined(ESP32) if (!LittleFS.begin()) #endif { gfx->print(F("File system init failed!")); Serial.print(F("File system init failed!")); } else { gfx->print(F("File system init success.")); Serial.print(F("File system init success.")); } // init time ntpGetTime(); // print time on black screen before down load image printTime(); } void loop() { delay(1000); // overlay current time on the photo printTime(); } </code>
/*******************************************************************************
 * Google Photo Clock
 * This is a simple IoT photo frame sample
 ******************************************************************************/

/* WiFi settings */
#define SSID_NAME "______"
#define SSID_PASSWORD "___________"
/* Google Photo settings */
#define PHOTO_LIMIT 20                                     // read first 10 photos to the list, ESP32 can add more
#define PHOTO_ID_SIZE 159                                  // the photo ID should be 158 charaters long and then add a zero-tail
/* NTP settings */
#if defined(ESP32)
#define GMT_OFFSET_SEC 19800L  // Timezone +5.5 India
#define DAYLIGHT_OFFSET_SEC 0L // no daylight saving
#endif

/*******************************************************************************
 * Start of Arduino_GFX setting
 ******************************************************************************/
#include <Arduino_GFX_Library.h>
#define TFT_RST 33
#define TFT_BL 22
/* More dev device declaration: https://github.com/moononournation/Arduino_GFX/wiki/Dev-Device-Declaration */
#if defined(DISPLAY_DEV_KIT)
Arduino_GFX *gfx = create_default_Arduino_GFX();
#else /* !defined(DISPLAY_DEV_KIT) */

/* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */
Arduino_DataBus *bus = create_default_Arduino_DataBus();

/* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
Arduino_GFX *gfx = new Arduino_ILI9341(bus, TFT_RST, 0 /* rotation */, false /* IPS */);

#endif /* !defined(DISPLAY_DEV_KIT) */
/*******************************************************************************
 * End of Arduino_GFX setting
 ******************************************************************************/

/* file system */
#if defined(ESP32)
#include <FFat.h>
// #include <LittleFS.h>
#elif defined(ESP32)
#include <LittleFS.h>
#endif

/* time library */
#include <time.h>
static time_t now;

/* variables */
static int w, h, timeX, timeY, photoCount;
static uint8_t textSize;
static unsigned long next_show_millis = 0;
static bool shownPhoto = false;

void ntpGetTime()
{
  // Initialize NTP settings
#if defined(ESP32)
  configTime(GMT_OFFSET_SEC, DAYLIGHT_OFFSET_SEC, NTP_SERVER);
#endif

  gfx->setTextColor(GREEN);
  gfx->print(F("Waiting for NTP time sync: "));
  Serial.print(F("Waiting for NTP time sync: "));
  time_t nowSecs = time(nullptr);
  while (nowSecs < 8 * 3600 * 2)
  {
    delay(500);
    Serial.print('.');
    gfx->print('.');
    yield();
    nowSecs = time(nullptr);
  }
  gfx->println(F(" done."));
  Serial.println(F(" done."));
  gfx->setTextColor(BLUE);
  gfx->println(asctime(localtime(&nowSecs)));
  Serial.println(asctime(localtime(&nowSecs)));
}

void printTime()
{
  now = time(nullptr);
  const tm *tm = localtime(&now);
  int hour = tm->tm_hour;
  int min = tm->tm_min;
  // set text size with pixel margin
  gfx->setTextSize(textSize, textSize, 2);
  if (!shownPhoto)
  {
    // print time with black background
    gfx->setCursor(timeX, timeY);
    gfx->setTextColor(WHITE, BLACK);
    gfx->printf("%02d:%02d", hour, min);
  }
  else
  {
    // print time with border
    gfx->setCursor(timeX - 1, timeY - 1);
    gfx->setTextColor(DARKGREY);
    gfx->printf("%02d:%02d", hour, min);
    gfx->setCursor(timeX + 2, timeY + 2);
    gfx->setTextColor(BLACK);
    gfx->printf("%02d:%02d", hour, min);
    gfx->setCursor(timeX, timeY);
    gfx->setTextColor(WHITE);
    gfx->printf("%02d:%02d", hour, min);
  }
}

void setup()
{
  Serial.begin(115200);

  // init display
  gfx->begin();
  gfx->fillScreen(BLACK);
#ifdef TFT_BL
  // turn on display backlight
  pinMode(TFT_BL, OUTPUT);
  digitalWrite(TFT_BL, HIGH);
#endif

  w = gfx->width();
  h = gfx->height();
  textSize = w / 6 / 5;
  timeX = (w - (textSize * 5 * 6)) / 2;
  timeY = h - (textSize * 8) - 10;

  gfx->setTextSize(1);
  gfx->setCursor(0, 0);
  gfx->setTextColor(RED);
  gfx->println(F("Google Photo Clock"));
  Serial.println(F("Google Photo Clock"));
  gfx->setTextColor(ORANGE);
  gfx->print(F("Screen: "));
  Serial.print(F("Screen: "));
  gfx->print(w);
  Serial.print(w);
  gfx->print('x');
  Serial.print('x');
  gfx->println(h);
  Serial.println(h);
  gfx->setTextColor(YELLOW);
  gfx->print(F("Clock text size: "));
  Serial.print(F("Clock text size: "));
  gfx->println(textSize);
  Serial.println(textSize);

  // init file system
#if defined(ESP32)
  if (!FFat.begin(true))
  // if (!LittleFS.begin())
#elif defined(ESP32)
  if (!LittleFS.begin())
#endif
  {
    gfx->print(F("File system init failed!"));
    Serial.print(F("File system init failed!"));
  }
  else
  {
    gfx->print(F("File system init success."));
    Serial.print(F("File system init success."));
  }

  // init time
  ntpGetTime();

  // print time on black screen before down load image
  printTime();
}

void loop()
{
  delay(1000);

  // overlay current time on the photo
  printTime();
}

this is what i got on the serial monitor

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_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:13864
load:0x40080400,len:3608
entry 0x400805f0
Google Photo Clock
Screen: 240x320
Clock text size: 8
Connecting to WiFi: done.
File system init failed!
</code>
<code>ets Jul 29 2019 12:21:46 rst:0x1 (POWERON_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:13864 load:0x40080400,len:3608 entry 0x400805f0 Google Photo Clock Screen: 240x320 Clock text size: 8 Connecting to WiFi: done. File system init failed! </code>
ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_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:13864
load:0x40080400,len:3608
entry 0x400805f0
Google Photo Clock
Screen: 240x320
Clock text size: 8
Connecting to WiFi:  done.
File system init failed!

New contributor

Cheetohzzz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật