• The SD card module works on ESP32. Great!

    Does Espruino support SPIFFS file system now on ESP8266/ESP32 ?

  • No, that has not been implemented.

  • Please can you post your wiring and script you used, as @jumjum was trying to get that to work and did not have success.

  • Wilberforce
    Hi, do you mean codes using SD card on ESP32? or SPIFFS file system?

  • @user73896
    I mean the javascript you used to get the spi SD card working, and the wiring and pins you used - perhaps even a photo!

  • @Wilberforce @jumjum
    ESP32 Board: widora v5.0https://world.taobao.com/item/538209801368.htm
    SD Card Adapter: Catalex Micro SD Card Adapterhttps://detail.tmall.com/item.htm?id=41690559539&spm=a1z09.2.0.0.816EuT&_u=61fd91teef0
    Wiring:

    | Orange |  Black |  Blue  | White  | Yellow | Green | 
    | 3V3    |  GND   |  IO5   | IO18   | IO23   | IO19  | ESP32 Board      |
    | VCC    |  GND   |   CS   |  SCK   | MOSI   | MISO  | SD Card Adaptern |
    

    Esrupino: master branch
    env vars: export USE_FILESYSTEM=1
    IDE: ESPRUINO WEB IDE
    Javascript:

    /*
    | SPI  | MOSI | MISO | CLK | SS/CS | PLATFORM      |
    | SPI1 | 13   | 12   | 14  | 15    | ESP8266/ESP32 |
    | SPI2 | 23   | 19   | 18  | 5     | ESP32 only    |
    */
    var opts = {sck:18, miso:19, mosi:23};
    SPI2.setup(opts);
    
    E.connectSDCard(SPI2, 5 /*CS*/);
    var fs = require("fs");
    
    // list files on SD card
    console.log("\nFiles on SD Card -->\n");
    console.log(fs.readdirSync());
    // read a exitsting file on SD card
    console.log("\nContent of example.txt : -->\n");
    console.log(fs.readFileSync("example.txt"));
    // creat a file
    fs.writeFile("test.txt", "Hello world!");
    fs.appendFileSync("test.txt", " I'm Esrpusino.");
    // list files on SD card
    console.log("\nFiles on SD Card -->\n");
    console.log(fs.readdirSync());
    // read text.txt created before on SD card
    console.log("\nContent of test.txt : -->\n");
    console.log(fs.readFileSync("test.txt"));
    // list files on SD card
    console.log("\nFiles on SD Card -->\n");
    console.log(fs.readdirSync("mydir"));
    // read text2.txt in /mydir on SD card
    console.log("\nContent of test2.txt : -->\n");
    console.log(fs.readFileSync("mydir/test2.txt"));
    

    Content of SD Card before running the codes:
    /EXAMPLE.txt
    /mydir/test2.txt

    output in left hand side of WEB IDE:

    >WARNING: jshReset(): To implement - reset of i2c
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v91.2721 Copyright 2016 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    >
    Files on SD Card -->
    [
      "System Volume Information",
      "EXAMPLE.TXT",
      "._.Trashes",
      ".Trashes",
      ".Spotlight-V100",
      "mydir"
     ]
    Content of example.txt : -->
    A1234567890abcdefghigklmnopqrstuvwxyz
    Files on SD Card -->
    [
      "System Volume Information",
      "EXAMPLE.TXT",
      "._.Trashes",
      "test.txt",
      ".Trashes",
      ".Spotlight-V100",
      "mydir"
     ]
    Content of test.txt : -->
    Hello world! I'm Esrpusino.
    Files on SD Card -->
    [
      ".",
      "..",
      "test2.txt"
     ]
    Content of test2.txt : -->
    Hello, I'm in directory /mydir.
    =undefined
    

    2 Attachments

    • IMG_1805.jpg
    • IMG_1806.jpg
  • Thanks for posting. It is good news that this works!

    You should update your username in your profile!

  • Version ESP32-2.01 says:

    >SPI2.setup({sck:18, miso:19, mosi:23});
    =undefined
    Uncaught Error: Unimplemented on Linux
     at line 1 col 24
    E.connectSDCard(SPI2, 5);
                           ^
    

    Were there any code updates to allow larger data sets to be saved to flash also?

    Thank you.

  • The esp32 build has a flash file system using 1mb of the 4mb inbuilt flash.

    Support for external sd card has not be implemented. It could be supported however the flashfs implementation would need to be disabled.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Does Espruino support SPIFFS file system now on ESP8266/ESP32 ?

Posted by Avatar for Aifer @Aifer

Actions