Problems porting Reliance Edge File System to ESP32 - No Persistence

User avatar
gunar.kroeger
Posts: 143
Joined: Fri Jul 27, 2018 6:48 pm

Problems porting Reliance Edge File System to ESP32 - No Persistence

Postby gunar.kroeger » Fri Aug 16, 2019 6:06 pm

I'm trying use the Reliance Edge library to a project I'm developing with ESP32, which is a fail-safe file system for SD cards.

I have found a GitHub project that ports the library to ESP32, but I'm having some issues trying to persist a written file.

My application is just initializing the port library, which initializes the file system. After that, I'm writing a .txt file and reading it right afterwards. The problem is that when I reprogram the board to just read those test files, I find out that they doesn't persist in the SD card when I try to just read the file written last time.

A section of my code is presented below:
  1.     test_setup(OPENFILES);
  2.     char *text = "Hello World!\r\n";
  3.     write_test(MOUNT_POINT "/hello.txt",text);
  4.     char *resp = read_test(MOUNT_POINT "/hello.txt");
Some more information about the code above:
  • "OPENFILES" is the max files I can open, defined as 4
  • "MOUNT_POINT" is another define ("/redflash")
  • "test_setup()" doesn't format the SD card at any moment
  • "write_test()" and "read_test()" are basically just "fwrite()" and "fread()" with appropriate "fclose()"
  • When I reprogram ESP, I comment lines 2 and 3 leaving just the reading section
The error occurs right after it tries to "fread()" a FILE pointer that is NULL by "fopen()".

I can provide more code and documentation if someone has any idea of what might be happening.

Thanks in advance!
"Running was invented in 1612 by Thomas Running when he tried to walk twice at the same time."

Who is online

Users browsing this forum: Baidu [Spider] and 142 guests