Persistent RAM disk

StridingDragon
Posts: 7
Joined: Fri Aug 02, 2019 11:59 pm

Persistent RAM disk

Postby StridingDragon » Sat Aug 03, 2019 12:17 am

Has anyone ever tried to write something like a persistent RAM disk for the ESP32?

Our device has 16MB of memory and I would like to set aside some of that as a persitent RAM disk to hold various files that need to be accessed frequently and need to be present even after a soft reset. I don't need full file access functionality—I'll handle all that myself—, just a protected SPI RAM block that is not wiped upon a soft reset and that is excluded/protected from the system memory allocator.

Does anyone have any hints how to approach this on the ESP32?

WiFive
Posts: 2624
Joined: Tue Dec 01, 2015 7:35 am

Re: Persistent RAM disk

Postby WiFive » Sat Aug 03, 2019 8:19 am

I didn't know there were 128mbit psram chips available. What are you using?

StridingDragon
Posts: 7
Joined: Fri Aug 02, 2019 11:59 pm

Re: Persistent RAM disk

Postby StridingDragon » Sat Aug 03, 2019 8:28 am

It's a WroverB with 16MB of RAM

Ritesh
Posts: 1079
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Persistent RAM disk

Postby Ritesh » Sat Aug 03, 2019 11:50 am

StridingDragon wrote:
Sat Aug 03, 2019 12:17 am
Has anyone ever tried to write something like a persistent RAM disk for the ESP32?

Our device has 16MB of memory and I would like to set aside some of that as a persitent RAM disk to hold various files that need to be accessed frequently and need to be present even after a soft reset. I don't need full file access functionality—I'll handle all that myself—, just a protected SPI RAM block that is not wiped upon a soft reset and that is excluded/protected from the system memory allocator.

Does anyone have any hints how to approach this on the ESP32?
Hello,

Good Question.

I think it is same concept we are following into Linux System in which there are almost 1 to 2 GB in which we want to access few section of RAM as permanent disk like your requirements.

So, I am not sure that it is possible into ESP32. Need to ask to Espressif Developers.

I didn't find that type of support into IDF but ur should be there.

I have one question like why you can't use 16 MB Flash supported module into your project?
Regards,
Ritesh Prajapati

User avatar
rudi ;-)
Posts: 1429
Joined: Fri Nov 13, 2015 3:25 pm

Re: Persistent RAM disk

Postby rudi ;-) » Sat Aug 03, 2019 12:27 pm

Ritesh wrote:
Sat Aug 03, 2019 11:50 am
StridingDragon wrote:
Sat Aug 03, 2019 12:17 am
Has anyone ever tried to write something like a persistent RAM disk for the ESP32?

Our device has 16MB of memory and I would like to set aside some of that as a persitent RAM disk to hold various files that need to be accessed frequently and need to be present even after a soft reset. I don't need full file access functionality—I'll handle all that myself—, just a protected SPI RAM block that is not wiped upon a soft reset and that is excluded/protected from the system memory allocator.

Does anyone have any hints how to approach this on the ESP32?
Hello,

I have one question like why you can't use 16 MB Flash supported module into your project?

Hi
@Ritesh
i think he mean persistent System but not RAM technic

StridingDragon wrote:
Sat Aug 03, 2019 12:17 am
Has anyone ever tried to write something like a persistent RAM disk for the ESP32?

Our device has 16MB of memory and I would like to set aside some of that as a persitent RAM disk to hold various files that need to be accessed frequently and need to be present even after a soft reset. I don't need full file access functionality—I'll handle all that myself—, just a protected SPI RAM block that is not wiped upon a soft reset and that is excluded/protected from the system memory allocator.

Does anyone have any hints how to approach this on the ESP32?
Hi
The 16MB are the 16 MB of SPI Flash i think.
And you want to make from this 16 MB a persistent RAM disk for the ESP32 ?

+ "to hold various files that need to be accessed frequently and need to be present even after a soft reset."

this is no problem, you could use the SPI Flash as FS System too, you can save on this files, you can use this after a soft reset and so on.
have a look to storage examples:
- fopen could usefull for you perhabs
- FAT FS on external SPI Flash could usefull for you too
- ... many other possibles

i think you need not a persistent RAM i think you mean a possible way, to save, read, write files or data to the 16MB "Flash"
that you can use after a soft reset further more and does not be deleted..

persistent RAM
is bytewise read, write over CPU Bus
( Variables, Functions, ...)

SPI Flash
is blockwise over I/O
( Files, Data, Save Variables to Flash Disk, Read Variables from Flash Disk ..)

if you want use persistent RAM on a SPI Flash for read and write you have to do many hacks in the ESP-IDF,
but it is possible. ( Let me know if you are finnish )

I remember that we can do one way, ( read or write ) from/to SPI Flash as a "RAM" expanded system
for the esp32 but this is an other theme.

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1429
Joined: Fri Nov 13, 2015 3:25 pm

Re: Persistent RAM disk

Postby rudi ;-) » Sat Aug 03, 2019 12:31 pm

StridingDragon wrote:
Sat Aug 03, 2019 8:28 am
It's a WroverB with 16MB of RAM
128mbit / 16MB of RAM - sure?
Do you not mean 128mbit / 16MB SPI Flash System ?

If you have 128mbit RAM ( PSRAM ) on Wrover soldered,
can you please say, which CHIP you used and where the manufacturer is?

i do not believe that is 128mbit/16MB [ps]RAM on the Wrover, but we are all want deeper learning :mrgreen:

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

StridingDragon
Posts: 7
Joined: Fri Aug 02, 2019 11:59 pm

Re: Persistent RAM disk

Postby StridingDragon » Sat Aug 03, 2019 5:36 pm

Just to clarify, when I say, 16MB of memory, I am referring to 16MB of SOM SPI RAM.

User avatar
rudi ;-)
Posts: 1429
Joined: Fri Nov 13, 2015 3:25 pm

Re: Persistent RAM disk

Postby rudi ;-) » Mon Aug 05, 2019 1:06 am

StridingDragon wrote:
Sat Aug 03, 2019 5:36 pm
Just to clarify, when I say, 16MB of memory, I am referring to 16MB of SOM SPI RAM.
SOM:
a-> System on Module, example
b-> SOM ... example
c-> Semantic object model
d-> Self-Organizing (Feature) Maps (Kohonen Feature Maps, Teuvo Kohonen) ( AI Theme )
z-> ...

the thing are the 16MB you mentioned, i do not know just in time there are 128mbit (16MB) SPI RAM on (MP*) Market, or on ESP32 Modules / Kit *S. i know and hold in the hand 64mbit (8MB) and 32mbit (4MB).
Can you point to the IC / Manufacturer where you have the 16MB SPI RAM please.

the second is the SPI, so SOM DDRx RAM i think you not mean.

If you mean pSRAM ( SPI PSRAM ) , and you want a resistent ram disk / drive from this
you can do this,
-> init the ramdisk code one time on boot and tag it in your spi flash custom register file
-> if you need the disk / data after reboot do not power off the PSRAM if you power off the ESP32
-> on next boot you can read the flash register tag and do not again an init on psram that would be reinit by self instead then.
-> if you want clear the RAM DISK simpy power off the 16MB SPI RAM

you could help with a picture you can upload here of your 16MB of SOM SPI RAM
txs.

hope this helps
best wishes
rudi ;-)

edit: added (MP*) mean mass production


append:
edit: added Switching PSRAM Bank Modul on PicoD4Kit
the switching pSRAM Bank Modul can use 8x XXX pSRAM example 8x 128mbit = 64MB
it is programmed as extended RAM, allocated RAM and RAM Disk, same like it is mentioned here, also as Persistent RAM "DISK"
if there are onetime 16MB on Market it goes 8x16 = 128MB
the goal is to describe PSRAM Bank via OTA
and the boot get an load pointer...
switching_bank-#1.jpg
switching_bank-#1.jpg (84.71 KiB) Viewed 356 times
switching_bank-#2.jpg
switching_bank-#2.jpg (102.17 KiB) Viewed 356 times
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

StridingDragon
Posts: 7
Joined: Fri Aug 02, 2019 11:59 pm

Re: Persistent RAM disk

Postby StridingDragon » Tue Aug 06, 2019 6:52 pm

Thanks for all the info, Rudi. It turns out, we have an 8MB RAM module with 16 MB SPI Flash. As a result, my plans have actually changed, and I will use the Flash memory for storage.

jcsbanks
Posts: 269
Joined: Tue Mar 28, 2017 8:03 pm

Re: Persistent RAM disk

Postby jcsbanks » Tue Aug 06, 2019 8:18 pm

Bear in mind that writing to flash is slow, and FATFS is slow to read and write. PSRAM is mega fast in comparison.
Last edited by jcsbanks on Tue Aug 06, 2019 8:24 pm, edited 1 time in total.

Who is online

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