Difference between SRAM & SPIRAM

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
rp346@njit.edu
Posts: 18
Joined: Sun Sep 16, 2018 6:33 pm

Difference between SRAM & SPIRAM

Post by rp346@njit.edu » Sun Nov 11, 2018 3:57 pm

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
- roy

loboris
Posts: 344
Joined: Fri Oct 02, 2015 6:19 pm

Re: Difference between SRAM & SPIRAM

Post by loboris » Sun Nov 11, 2018 5:10 pm

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.

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: Difference between SRAM & SPIRAM

Post by jickster » Sun Nov 11, 2018 5:53 pm

SPIRAM is much slower. Waayyyyyyyy slower.


Sent from my iPhone using Tapatalk Pro

rp346@njit.edu
Posts: 18
Joined: Sun Sep 16, 2018 6:33 pm

Re: Difference between SRAM & SPIRAM

Post by rp346@njit.edu » Sun Nov 11, 2018 5:57 pm

Thanks
- roy

rp346@njit.edu
Posts: 18
Joined: Sun Sep 16, 2018 6:33 pm

Re: Difference between SRAM & SPIRAM

Post by rp346@njit.edu » Sun Nov 11, 2018 6:00 pm

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 ?
- roy

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: Difference between SRAM & SPIRAM

Post by jickster » Sun Nov 11, 2018 6:02 pm

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

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: Difference between SRAM & SPIRAM

Post by kevinkk525 » Sun Nov 11, 2018 6:04 pm

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..]
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

rp346@njit.edu
Posts: 18
Joined: Sun Sep 16, 2018 6:33 pm

Re: Difference between SRAM & SPIRAM

Post by rp346@njit.edu » Sun Nov 11, 2018 6:06 pm

Ok, so can still flash Firmware with SPIRAM support on ESP32, but it will be up to application to use it or not.
- roy

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: Difference between SRAM & SPIRAM

Post by kevinkk525 » Sun Nov 11, 2018 7:21 pm

no if you flash spiram-firmware it will automatically use SPIRAM
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

loboris
Posts: 344
Joined: Fri Oct 02, 2015 6:19 pm

Re: Difference between SRAM & SPIRAM

Post by loboris » Sun Nov 11, 2018 7:34 pm

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.

Post Reply