External SPI RAM Usage Guidance (23LC1024 and/or ESP-PSRAM64H or equivalent) #8450
Unanswered
david-vfortified
asked this question in
Q&A
Replies: 2 comments
-
You cannot declare a global variable in SPI RAM, but you can declare a global pointer that points to memory allocated in SPI RAM. Something like this:
Also, in your 2nd example tN are stack variables, and obviously not going onto any heap at all. You need to use |
Beta Was this translation helpful? Give feedback.
0 replies
-
hello every body! For me i'm new come with arduino program, but i want make practice throught you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am seeking guidance from the community. Is anyone familiar with using the 23LC1024 or ESP-PSRAM64H SPI RAM chips, especially as related to storing locally and globally initiated variables?
I was under the impression that, while the MMU setting is set to
128K External 23LC1024
or above, by declaring local variables within theESP.setExternalHeap()
andESP.resetHeap()
methods, that I would be able to store variables in external SPI RAM. However, after some testing, and after playing with the virtualmem.ino program, it appears my logic is off. I am hoping to gain some clarity and insight.Some of my observations are as follows:
I only see external SPI RAM memory consumption when I declare a string variable between the
ESP.setExternalHeap()
andESP.resetHeap()
methods. In the example below, the first print statement containingESP.getFreeHeap()
will report a larger number of available bytes on the heap than the secondESP.getFreeHeap()
print statement.I do not see external RAM memory consumption when I declare any other data type outside of a string. For example, in the code below, both print statements will report the same number of bytes from the external heap. My understanding of how this works is likely flawed, and I am likely doing something very wrong. Hoping someone will be able to set me straight on how to properly declare local variables in external SPI RAM.
The above code examples are for locally declared variables, which leads me to my next question. Is there any way to declare global variables in external SPI RAM?
My goal is to be able to define a very large circular buffer using the CircularBuffer library. Ideally, I would like to declare a very large global circular buffer that can be stored in external SPI RAM.
Does anyone have experience with my above questions/observations? I definitely wish to understand the full power and functionality of this tool. Any and all help is greatly appreciated, and I look forward to any and all dialog and discussion. I thank you for your time and consideration!
Thank you,
David
Beta Was this translation helpful? Give feedback.
All reactions