Page 1 of 2

Difference between SRAM & SPIRAM

Posted: Sun Nov 11, 2018 3:57 pm
by rp346@njit.edu
I am wondering what is difference between SRAM & SPIRAM. I am asking this because I am trying to flash micropython to ESP32-CAM and I notices there is Firmware with SPIRAM support on https://micropython.org/download/#esp32. But ESP32-CAM specification has mentioned 520 KB of on-chip SRAM

is there any difference ? or I can use Firmware with SPIRAM support on ESP32-CAM ?

Thanks

Re: Difference between SRAM & SPIRAM

Posted: Sun Nov 11, 2018 5:10 pm
by loboris
ESP-IDF Programming Guide:
The ESP32 has a few hundred KiB of internal RAM, residing on the same die as the rest of the ESP32. For some purposes, this is insufficient, and therefore the ESP32 incorporates the ability to also use up to 4MiB of external SPI RAM memory as memory. The external memory is incorporated in the memory map and is, within certain restrictions, usable in the same way internal data RAM is.

The ESP32 supports SPI (P)SRAM connected in parallel with the SPI flash chip.
ESP32-CAM has 4MB external SPI-RAM chip.

Re: Difference between SRAM & SPIRAM

Posted: Sun Nov 11, 2018 5:53 pm
by jickster
SPIRAM is much slower. Waayyyyyyyy slower.


Sent from my iPhone using Tapatalk Pro

Re: Difference between SRAM & SPIRAM

Posted: Sun Nov 11, 2018 5:57 pm
by rp346@njit.edu
Thanks

Re: Difference between SRAM & SPIRAM

Posted: Sun Nov 11, 2018 6:00 pm
by rp346@njit.edu
jickster wrote:
Sun Nov 11, 2018 5:53 pm
SPIRAM is much slower. Waayyyyyyyy slower.


Sent from my iPhone using Tapatalk Pro
So its not recommended to use Firmware with SPIRAM support ?

Re: Difference between SRAM & SPIRAM

Posted: Sun Nov 11, 2018 6:02 pm
by jickster
rp346@njit.edu wrote:
jickster wrote:
Sun Nov 11, 2018 5:53 pm
SPIRAM is much slower. Waayyyyyyyy slower.


Sent from my iPhone using Tapatalk Pro
So its not recommended to use Firmware with SPIRAM support ?

If you don’t need more ram than the SRAM, it’s unnecessary.

If you need more ram then on this hw platform that’s your best option.


Sent from my iPhone using Tapatalk Pro

Re: Difference between SRAM & SPIRAM

Posted: Sun Nov 11, 2018 6:04 pm
by kevinkk525
it is definitely recommended as you will get 4MB of RAM whereas you otherwise just have 190kB. But if you are concerned about speed and 190kB is enough for you, then you could use a non-psram firmware.

[edit: looks like we wrote at the same time..]

Re: Difference between SRAM & SPIRAM

Posted: Sun Nov 11, 2018 6:06 pm
by rp346@njit.edu
Ok, so can still flash Firmware with SPIRAM support on ESP32, but it will be up to application to use it or not.

Re: Difference between SRAM & SPIRAM

Posted: Sun Nov 11, 2018 7:21 pm
by kevinkk525
no if you flash spiram-firmware it will automatically use SPIRAM

Re: Difference between SRAM & SPIRAM

Posted: Sun Nov 11, 2018 7:34 pm
by loboris
jickster wrote:
Sun Nov 11, 2018 5:53 pm
SPIRAM is much slower. Waayyyyyyyy slower.
It is slower, but...
Theoretical SPI-RAM access speed is ~40MB/s.
In final application, for example in MicroPython firmware, SPI-RAM access speed is is ~14 MB/sec.
The access is cached in internal RAM buffer (same as Flash access) and practical results shows it is quite usable if it is used in a way it is suposed to be used.
In the typical MicroPython application there is often no difference if the heap is on internal RAM or external SPI-RAM.