tobozo / esp32-psramfs Goto Github PK
View Code? Open in Web Editor NEWπ πΎ RamDisk for ESP32-Arduino using PsRam and fs::FS
License: MIT License
π πΎ RamDisk for ESP32-Arduino using PsRam and fs::FS
License: MIT License
Hi,
this looks like a very interesting project.
I have a performance issue with a web server using ESPAsyncWebServer serving from a small LittleFS root (maybe 1MB) - which is so slow that reading large files triggers the watchdog no matter how long I set it
so I was thinking about caching the LittleFS content in a PSRAM-based filesystem
Do you think this project is a viable base for such an effort?
what I would do is:
another option would be to cook up something like a PSRAM-based LittleFS subclass which would just suck up the whole partition into PSRAM and serve from there, but I have no grasp how complex this would pan out.
Does this sound reasonable? which option would you choose?
I would be grateful for a frank opinion.
best regards
Michael
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 π
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?
#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();
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.