🐏 💾 RamDisk for ESP32-Arduino using PsRam and fs::FS

Overview

ESP32-PsRamFS

Coding Horror

This is a very early version of ESP32-PsRamFS: a wannabee RamDisk library for Arduino-ESP32 with vfs compliance.

It provides a fs::FS style filesystem using the psram of a ESP32-Wrover or any ESP32 equipped with PSRam.

Some unit tests are available in the example folder, consider setting the debug output level to DEBUG to see what's happening.

Directory support is still partial but the API is now vfs compliant.

Usage

#include <PSRamFS.h>


void setup()
{

  Serial.begin(115200);

  if(!PSRamFS.begin()){
    Serial.println("PSRamFS Mount Failed");
    return;
  }

}

Hardware Requirements:

  • ESP32 with PSRam

Actually PSRam is optional, but strongly recommended.

For very low memory situations that still require some abstraction to access file data, consider dropping the filesystem and use Streams instead with the excellent arduino-BufferStream library.

Tested on:

  • ESP32-Wroom
  • ESP32-Wrover
  • ESP32-S2
  • ESP32-C3

Known issues:

  • Broken support for file::position()
  • Unimplemented fs::open(dirname); (fake support)
  • Partial support for file::isDirectory();
  • No support for dir::openNextFile()

Credits:

You might also like...
A test using a TTGO module (ESP32 + screen) which renders a 3d scene using pingo library

A simple 3D renderer tested and developed for the TTGO T-Display ESP32 board. The 3d renderer is: https://github.com/fededevi/pingo The 3D renderer is

ESP32 and ESP8266 Arduino wifi template

ESP wifi template ESP32 and ESP8266 Arduino wifi template Features Popular WiFI AP mode WiFI STA mode ETH mode DNS server for AP mode Async DDNS clien

ESP32 drum computer / sample player / midi sequencer (Arduino audio project)

esp32_drum_computer ESP32 drum computer / sample player / midi sequencer (Arduino audio project) The project can be seen in my video https://youtu.be/

ESP32 S2 C++ host library compatible with arduino, esp-idf.

Info I would like to announce USB host library for esp32 S2 compatible with arduino, esp-idf and PIO (when pio will be updated to most recent esp-idf)

Arduino/ESP32 firmware for DIY haptic gloves. Officially compatible with LucidVR gloves.
Arduino/ESP32 firmware for DIY haptic gloves. Officially compatible with LucidVR gloves.

Arduino/ESP32 firmware for DIY haptic gloves. Officially compatible with LucidVR gloves.

A utility library to use/bootstrap Soracom Arc easily on ESP32 Arduino boards

soracom-arc-esp32-arduino A utility library to use/bootstrap Soracom Arc easily on ESP32 Arduino boards. Synopsis #include SoracomArcESP32.h #includ

Bluetooth LE Keyboard library for the ESP32 (Arduino IDE compatible)

ESP32 BLE Keyboard library This library allows you to make the ESP32 act as a Bluetooth Keyboard and control what it does. You might also be intereste

Sensirion Mass Flow Sensor Arduino library, modified from MyElectrons and Nabilphysics Arduino repositories for SFM3300 Digital Mass Flow Sensor
Sensirion Mass Flow Sensor Arduino library, modified from MyElectrons and Nabilphysics Arduino repositories for SFM3300 Digital Mass Flow Sensor

Sensirion Mass Flow Sensor Arduino library, modified from MyElectrons and Nabilphysics Arduino repositories for SFM3300 Digital Mass Flow Sensor. When the sensor data gets stuck, the library has a hard reset function to ensure that it is read continuously.

And ESP32 powered VU matrix using the INMP441 I2S microphone
And ESP32 powered VU matrix using the INMP441 I2S microphone

ESP32-INMP441-Matrix-VU This is the repository for a 3D-printed, (optionally) battery-powered, WS2812B LED matrix that produces pretty patterns using

Comments
  • Handle FS using VFS POSIX API

    Handle FS using VFS POSIX API

    Is POSIX style VFS API supported? I want to use this library in conjunction with SQLite 3 database for ESP32, all running in PSRAM (allocations for SQLite and the database files itself).

    By the way, awesome project 😎

    opened by ianwillianb 2
  • Whether RAM is enabled by default for empty projects?

    Whether RAM is enabled by default for empty projects?

    Hello, I have seen your routine, my test is successful, but I have a question, if my board is welded with a 4Mbyte RAM, if I burn an empty project into it, will the RAM be turned on by default?

    opened by LEDZB 1
  • readBytes problem

    readBytes problem

    Hello thanks for ESP32-PsRamFS ramdisk program. Im using this useful program. When I used readBytes(char *,sizs_t) function ,l could not read last char of this file. followin is test program

    
    #include "./PSRamFS.h"
    #include "./pfs.h"
    void setup() {
      Serial.begin(115200);
      esp32Info();
      if (!PSRamFS.begin()) {
        log_e("PSRamFS Mount Failed");
        return;
      }
      if (PSRamFS.exists("/test.txt")) {
        PSRamFS.remove("/test.txt");;
      }
      File t = PSRamFS.open("/test.txt", FILE_WRITE);
      if (t) {
        t.print("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
        Serial.print("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
        Serial.printf("\n/test.txt size= %d \n", t.size());
        t.close();
      }
      File r = PSRamFS.open("/test.txt", FILE_READ);
      int rsize = r.size();
      if (r) {
        int c = 0;
        char rbuf[32];
        int len = 0;
        int total = 0;
        do {
          len = r.readBytes(rbuf, sizeof(rbuf));
          for (int i = 0; i < len; i++) {
            Serial.print(rbuf[i]);
          }
          Serial.printf("\nlen=%d", len);
          total += len;
        } while (len);
        t.close();
        Serial.printf("\ntotal=%d", total);
        if (total != rsize) {
          Serial.printf("\nwe can read all data except file end..Z");
        }
      }
      Serial.println("\nEND");
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
    
    }
    void esp32Info(void) {
      Serial.println("---------------------------- -");
      uint64_t chipid;
      chipid = ESP.getEfuseMac(); //The chip ID is essentially its MAC address(length: 6 bytes).
      Serial.printf("ESP32 Chip ID = % 04X\r\n", (uint16_t)(chipid >> 32)); //print High 2 bytes
      Serial.printf("Chip Revision % d\r\n", ESP.getChipRevision());
      esp_chip_info_t chip_info;
      esp_chip_info(&chip_info);
      Serial.printf("Number of Core: % d\r\n", chip_info.cores);
      Serial.printf("CPU Frequency: % d MHz\r\n", ESP.getCpuFreqMHz());
      Serial.printf("Flash Chip Size = % d byte\r\n", ESP.getFlashChipSize());
      Serial.printf("Flash Frequency = % d Hz\r\n", ESP.getFlashChipSpeed());
      Serial.printf("Free Heap Size = % d\r\n", esp_get_free_heap_size());
      Serial.printf("Total PSRAM: %d\r\n", ESP.getPsramSize());
      Serial.printf("Free PSRAM: %d\r\n", ESP.getFreePsram());
      Serial.printf("ESP - IDF version = % s\r\n", esp_get_idf_version());
      Serial.println();
    }
    
    
    opened by HideakiAbe 2
Releases(v1.0.3-beta)
Owner
tobozo
I'm the Bozo ෴ bit in your Bogon. DIY IoT/WoT tinkerer, JS/PHP freestack dev, C/C++ novice and tech lover
tobozo
null 313 Dec 31, 2022
ESP32 + GitHub Actions + Husarnet. A boilerplate project for ESP32 allowing in-field firmware update using GitHub Actions workflow.

esp32-internet-ota ESP32 + GitHub Actions + Husarnet. A boilerplate project for ESP32 allowing in-field firmware update using GitHub Actions workflow.

Husarnet 31 Sep 22, 2022
Adafruit GFX compatible arduino library for using cat thermal printers with the ESP32

CatGFX This library offers a Adafruit GFX "driver" for ESP32 and the cheap cat (or rabbit?) BLE thermal printers like this one: For usage information

Claus Näveke 5 Sep 23, 2022
ESP32, ESP8266 based MIDI Organ using the ML_SynthTools library (little example arduino project)

esp32_esp8266_organ ESP32, ESP8266 based MIDI Organ using the ML_SynthTools library (little example arduino project) link to the video The required li

Marcel 20 Dec 12, 2022
ESP32, ESP8266 based MIDI Organ using the ML_SynthTools library (little example arduino project)

ml_synth_organ_example MIDI Organ using the ML_SynthTools library (little example arduino project) link to the video This project is an example suppor

Marcel 20 Dec 12, 2022
Allows for multiple SwitchBot buttons and curtains to be controlled via MQTT sent to ESP32. ESP32 will send BLE commands to switchbots and return MQTT responses to the broker. Also supports Meter/Temp Sensor

SwitchBot-MQTT-BLE-ESP32 Switchbot local control using ESP32. no switchbot hub used/required. works with any smarthub that supports MQTT https://githu

null 343 Dec 27, 2022
AnalogWrite for ESP32 and ESP32-S2 with LEDC PWM. Includes PWM Phase Control, DAC and Smart GPIO resource management.

analogWrite() ESP32 Installation Instructions This library was tested using using the ESP32 Arduino IDE Boards Manager installation method. Stable rel

null 36 Jan 5, 2023
A Fingerprint Door Lock using a microprocessor named Arduino UNO and programming through Arduino IDE

INSTRUCTIONS - The codes for the Fingerprint Door lock are present in the Code For Fingerprint Door Lock folder The instructions of how to operate the

Akhil Sahukaru 15 Mar 3, 2022
Internet of things created using arduino IoT cloud, consisting of esp and arduino boards

Internet of things created using arduino IoT cloud, consisting of esp and arduino boards. Goal of the project is to create a 3D printed RFID protected (with PIN) lock, including surveillance.

null 2 Sep 1, 2022
Library of useful C++ snippets and reusable classes I've created as I build out Arduino Uno and ESP32 projects.

Arduino Snippets Library of useful C++ snippets and reusable classes I've created as I build out Arduino Uno and ESP32 projects. Button A simple butto

Max Lynch 7 Feb 5, 2022