Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
INFO Upgrade ESP32 board without psRAM with 4MB/8MB SPIRAM
#1
If you have a ESP32 board without psRAM, it can now be upgraded with SPIRAM chip.  Smile

If the board is without a shield, the upgrade is quite simple, if the board has a shielded module, you have to remove the shield, which may not be quite easy.
ESP32 used must be rev 1 one !



Recently Electrodragon started selling IPS6404L-SQ-SPN (priced only 0.8 US$ !), a SPIRAM (psRAM) chip (8MB) with characteristics similar to Espressif's ESP-PSRAM32 (Data sheet).

As this is a 3.3V device, it can be used with ESP-WROOM-32 and all boards using 3.3V Flash.

I've tested the chip on Adafruit HUZZAH32 – ESP32 Feather Board which has ESP-WROOM-32 module with rev1 ESP32.

I removed the ESP-WROOM-32 shield, replaced the Flash with Winbond's 3.3V 16 MB Flash, and connected the IPS6404L-SQ-SPN and 10K pull-up to GPIO16.

The SPIRAM was recognized (as well as 16MB Flash).
I've tested the SPIRAM functionality extensively for more than 24 hours and there were no problems.
Tested with Flash (in QIO mode) & SPIRAM running at 40MHZ and 80MHz.


[Image: ESP32_Feather_psRAM.jpg]

Code:
I (30) boot: ESP-IDF v3.1-dev-726-gbae9709a 2nd stage bootloader
I (30) boot: compile time 14:25:43
I (40) boot: Enabling RNG early entropy source...
I (41) qio_mode: Enabling QIO for flash chip WinBond
I (41) boot: SPI Speed      : 80MHz
I (45) boot: SPI Mode       : QIO
I (49) boot: SPI Flash Size : 16MB
I (54) boot: Partition Table:
I (57) boot: ## Label            Usage          Type ST Offset   Length
I (64) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (72) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (79) boot:  2 MicroPython      factory app      00 00 00010000 001e0000
I (87) boot:  3 internalfs       Unknown data     01 81 001f0000 00e10000
I (94) boot: End of partition table
I (99) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x6d674 (448116) map
I (226) esp_image: segment 1: paddr=0x0007d69c vaddr=0x3ffb0000 size=0x02974 ( 10612) load
I (229) esp_image: segment 2: paddr=0x00080018 vaddr=0x400d0018 size=0x14c178 (1360248) map
0x400d0018: _flash_cache_start at ??:?

I (592) esp_image: segment 3: paddr=0x001cc198 vaddr=0x3ffb2974 size=0x02eb0 ( 11952) load
I (596) esp_image: segment 4: paddr=0x001cf050 vaddr=0x40080000 size=0x00400 (  1024) load
0x40080000: _WindowOverflow4 at /home/LoBo2_Razno/ESP32/MicroPython/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/components/freertos/./xtensa_vectors.S:1685

I (599) esp_image: segment 5: paddr=0x001cf458 vaddr=0x40080400 size=0x1b69c (112284) load
I (645) esp_image: segment 6: paddr=0x001eaafc vaddr=0x400c0000 size=0x00714 (  1812) load
I (646) esp_image: segment 7: paddr=0x001eb218 vaddr=0x50000000 size=0x00984 (  2436) load
I (669) boot: Loaded app from partition at offset 0x10000
I (670) boot: Disabling RNG early entropy source...
I (671) spiram: SPI RAM mode: flash 80m sram 80m
I (675) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (682) cpu_start: Pro cpu up.
I (686) cpu_start: Starting app cpu, entry point is 0x4008163c
0x4008163c: call_start_cpu1 at /home/LoBo2_Razno/ESP32/MicroPython/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/components/esp32/./cpu_start.c:225

I (0) cpu_start: App cpu up.
I (1186) spiram: SPI SRAM memory test OK
I (1186) heap_init: Initializing. RAM available for dynamic allocation:
D (1187) heap_init: New heap initialised at 0x3ffae6e0
I (1192) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (1198) heap_init: New heap initialised at 0x3ffbd5c0
I (1203) heap_init: At 3FFBD5C0 len 00022A40 (138 KiB): DRAM
I (1209) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (1216) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (1222) heap_init: New heap initialised at 0x4009ba9c
I (1228) heap_init: At 4009BA9C len 00004564 (17 KiB): IRAM
I (1234) cpu_start: Pro cpu start user code
I (1239) spiram: Adding pool of 4096K of external SPI memory to heap allocator
D (1254) clk: RTC_SLOW_CLK calibration value: 3029248
I (145) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
D (146) heap_init: New heap initialised at 0x3ffe0440
D (151) heap_init: New heap initialised at 0x3ffe4350




The chip's capacity is 8MB (64Mb), but I'm not shure if ESP32 and esp-idf supports 8 MB external SPIRAM.

The ESP32 data sheet and ESP32 Technical Reference Manual asserts it is supported:
Quote:Up to 8 MB of external flash/SRAM memory are mapped onto the CPU data space, supporting 8-bit, 16-bit
and 32-bit access. Data-read is supported on the flash and SRAM. Data-write is supported on the SRAM.
Quote:The ESP32 can access external SPI flash and SPI SRAM as external memory. Table 5 provides a list of external
memories that can be accessed by either CPU at a range of addresses on the data and instruction buses. When
a CPU accesses external memory through the Cache and MMU, the cache will map the CPU’s address to an
external physical memory address (in the external memory’s address space), according to the MMU settings. Due
to this address mapping, the ESP32 can address up to 16 MB External Flash and 8 MB External SRAM.

but in the related figures and tables the external SPIRAM mapping is only to the address range 0x3F80_0000 - 0x3FBF_FFFF (4 MB)
Reply
#2
This is great news, so I bought a few of these SPRAM modules which arrived yesterday. But I can't figure out where you put these? I understand that you replaced the flash chip that is located under the shielding and put an additional pullup there. But where is the SPRAM module? on top?
Reply
#3
SPIRAM chip is soldered on top of the SPI Flash chip (you don't need to change it, I've just had a spare 16MB one, so I've changed it too).

Solder SPIRAM chip pins 2, 3, 4, 5, 7 and 8 directly to the same Flash chip pins.

Connect SPIRAM chip pin 1 to gpio 16 and add 10K pull-up resistor from pin 1 to SPIRAM/Flash pin 8 (VDD_SDIO, 3.3V).

Connect SPIRAM chip pin 6 to gpio 17.

Of course, you can also connect the SPIRAM chip to the ESP-WROOM-32 module pins without removing the shield.
Look at ESP-WROOM-32 module schematic to see to which module pins are connected Flash chip pins.
VDD_SDIO is not available on the module, so you have to connect SPIRAM pin 8 to 3.3V.


Note: It is not recommended to make this modification on board/modules with ESP32 rev 0.

Attached the picture of SPIRAM chip soldered on top of Flash chip on SparkFun ESP32 Thing.


Attached Files Thumbnail(s)
   
Reply
#4
Thanks a lot, I did understand it now so I thought it can't be too hard and started soldering... Well I tried but apparently I don't have the skills or instruments to do this correctly and ended up destroying one esp32 and 2 psram.. I soldered one "successfully" but it sometimes has errors reading the flash and sometimes it just says that SPRAM initialization failed, so I probably have some solder where it should not be or not enough solder where it should be..
Reply
#5
Quote:I probably have some solder where it should not be or not enough solder where it should be..

Ha Ha Ha.

I find solder is much like a woman, some times it cooperates and other times for no apparent reason it will only the opposite to what you want Wink
Reply
#6
Hey :)
So if I understand it correctly, I can connect SPIRAM chip from Electrodragon like this, externally (without removing shield from WROOM32 module):
1 - GPIO16
2 - SD0
3 - SD3
4 - GND
5 - SD1
6 - GPIO17
7 - SD2
8 - 3,3v
plus 10k pullup on pin 16 (1 - R10k - 8)

Will it work, when I solder ram do SOP8 to 2,54mm pin pcb, and then to ESP32 pins? Or should I solder chip directly to ESP32 pins using short wires?

Thanks :)
Jarek
Reply
#7
I have only tried this by soldering the chip directly on top of the Flash chip.
If by "2,54mm pin pcb" you mean the pins of the development board, it may or may not work depending on the development board pcb layout.
If you are connecting the SPIRAM chip externaly to the ESP32-WROOM module the wires should be as short as possible.

The ESP-WROVER modules and the boards with SPIRAM are now available at a low price, it is best to use one of them.
Reply
#8
(09-07-2018, 08:01 AM)lobo Wrote: I have only tried this by soldering the chip directly on top of the Flash chip.
If by "2,54mm pin pcb" you mean the pins of the development board, it may or may not work depending on the development board pcb layout.
If you are connecting the SPIRAM chip externaly to the ESP32-WROOM module the wires should be as short as possible.

The ESP-WROVER modules and the boards with SPIRAM are now available at a low price, it is best to use one of them.

I was thinking about this kind of adapter:
https://aws.robu.in/wp-content/uploads/2...PTER-4.jpg
Using that just to protect delicate 'legs' of ram chip, but not connecting to the breadboard, of course Smile
Just solder shortest possible wires from that, directly to the pins of WROOM-32 module - I'm not using any development boards, trying to keep things as minimal as possible, as I want to learn more on electronics and finally move everything to my custom pcbs.
WROOM-32 in my case is soldered on top of this kind of adapter only:
https://encrypted-tbn0.gstatic.com/image...UoIIvKFtoV

Anyway, I'll try this and will share results - if it works, and how reliable.

PS: Lobo - thanks for your hard work on this MP port Smile
Reply
#9
If soldered directly to the WROOM-32 module, it should work.
You can add 0.1 uF capacitor between 3.3V and GND on the SOP8 adapter.
Reply
#10
Hi Boris,

Thanks for your continued work on PSRAM support for MicroPython!

I'm trying to use your psram build to get PSRAM working on both my TinyPICO and the PICO-KIT. I'm using Lyontek SRAM:
https://lcsc.com/product-detail/RAM_Lyon...61881.html

And I keep getting the following:

E (745) psram: ESP32PICOD4  do not support psram yet
E (750) spiram: SPI RAM enabled but initialization failed. Bailing out.
I (757) cpu_start: Failed to init external RAM; continuing without it.
I (765) cpu_start: Pro cpu up.
I (768) cpu_start: Starting app cpu, entry point is 0x400816d8
I (0) cpu_start: App cpu up.
I (779) heap_init: Initializing. RAM available for dynamic allocation:
D (786) heap_init: New heap initialised at 0x3ffae6e0
I (791) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (797) heap_init: New heap initialised at 0x3ffbd248
I (802) heap_init: At 3FFBD248 len 00022DB8 (139 KiB): DRAM
I (808) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (815) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (821) heap_init: New heap initialised at 0x4009d250
I (826) heap_init: At 4009D250 len 00002DB0 (11 KiB): IRAM
I (832) cpu_start: Pro cpu start user code
D (844) clk: RTC_SLOW_CLK calibration value: 3101504
I (185) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
D (186) heap_init: New heap initialised at 0x3ffe0440
D (190) heap_init: New heap initialised at 0x3ffe4350
D (195) MicroPython: Entry
W (1198) MicroPython: SPIRAM support enabled but SPIRAM not detected

On the PICO-KIT I have tried using pin for pin (SD0->SIO0, SD1->SIO1, etc ) and I have tried using rudi's pin config which is (SD0->SIO1, SD1->SIO0, SD2->SIO3 & SD3->SIO2) but both show the same "not found" issue.

So I was wondering... should your build work with the PICO-D4? There is a clear message in the log stating:
E (745) psram: ESP32PICOD4  do not support psram yet

So maybe the PSRAM initialisation is being skipped?


I'm trying to nail down if this is a wiring issue or just a "not supported" issue so I can stop wrecking SRAM modules with bad wire wrapping Wink

Cheers,

Seon
unexpectedmaker.com

Here is the full boot log...
I (31) boot: ESP-IDF v3.1-rc1-53509c7b 2nd stage bootloader
I (31) boot: compile time 13:15:02
I (31) boot: Enabling RNG early entropy source...
I (36) boot: SPI Speed      : 40MHz
I (41) boot: SPI Mode       : DIO
I (45) boot: SPI Flash Size : 4MB
I (49) boot: Partition Table:
I (52) boot: ## Label            Usage          Type ST Offset   Length
I (60) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (67) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (74) boot:  2 MicroPython      factory app      00 00 00010000 001a0000
I (82) boot:  3 internalfs       Unknown data     01 82 001b0000 00100000
I (89) boot: End of partition table
I (94) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x60690 (394896) map
I (241) esp_image: segment 1: paddr=0x000706b8 vaddr=0x3ffb0000 size=0x0556c ( 21868) load
I (250) esp_image: segment 2: paddr=0x00075c2c vaddr=0x3ffb556c size=0x00000 (     0) load
I (250) esp_image: segment 3: paddr=0x00075c34 vaddr=0x40080000 size=0x00400 (  1024) load
I (257) esp_image: segment 4: paddr=0x0007603c vaddr=0x40080400 size=0x09fd4 ( 40916) load
I (282) esp_image: segment 5: paddr=0x00080018 vaddr=0x400d0018 size=0x118f60 (1150816) map
I (686) esp_image: segment 6: paddr=0x00198f80 vaddr=0x4008a3d4 size=0x12e7c ( 77436) load
I (718) esp_image: segment 7: paddr=0x001abe04 vaddr=0x400c0000 size=0x00714 (  1812) load
I (719) esp_image: segment 8: paddr=0x001ac520 vaddr=0x50000000 size=0x0098c (  2444) load
I (744) boot: Loaded app from partition at offset 0x10000
I (744) boot: Disabling RNG early entropy source...
E (745) psram: ESP32PICOD4  do not support psram yet
E (750) spiram: SPI RAM enabled but initialization failed. Bailing out.
I (757) cpu_start: Failed to init external RAM; continuing without it.
I (765) cpu_start: Pro cpu up.
I (768) cpu_start: Starting app cpu, entry point is 0x400816d8
I (0) cpu_start: App cpu up.
I (779) heap_init: Initializing. RAM available for dynamic allocation:
D (786) heap_init: New heap initialised at 0x3ffae6e0
I (791) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (797) heap_init: New heap initialised at 0x3ffbd248
I (802) heap_init: At 3FFBD248 len 00022DB8 (139 KiB): DRAM
I (808) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (814) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (821) heap_init: New heap initialised at 0x4009d250
I (826) heap_init: At 4009D250 len 00002DB0 (11 KiB): IRAM
I (832) cpu_start: Pro cpu start user code
D (844) clk: RTC_SLOW_CLK calibration value: 3128909
I (184) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
D (186) heap_init: New heap initialised at 0x3ffe0440
D (190) heap_init: New heap initialised at 0x3ffe4350
D (195) MicroPython: Entry
W (1198) MicroPython: SPIRAM support enabled but SPIRAM not detected
D (1198) MicroPython: SPIRAM: Disabled
D (1199) nvs: nvs_flash_init_custom partition=nvs start=9 count=6
D (1248) MicroPython: Configure stack
D (1249) nvs: nvs_open_from_partition MPY_NVM 1
D (1249) nvs: nvs_get MPY_StackSize 4
D (1250) nvs: nvs_get_str_or_blob MpyTimeZone
D (1254) MicroPython: MPy stack: 0x3ffc096c - 0x3ffc4974 (16392)
D (1260) MicroPython: Configure heap
D (1264) nvs: nvs_get MPY_HeapSize 4
D (1267) MicroPython: MPy heap: 0x3ffc4978 - 0x3ffd69b8 (73728)
D (1273) MicroPython: Main task exit, stack used: 1392
I (1275) MicroPython: [=== MicroPython FreeRTOS task started (sp=3ffc48c0) ===]


Internal FS (SPIFFS): Mounted on partition 'internalfs' [size: 1048576; Flash address: 0x1B0000]
----------------
Filesystem size: 956416 B
           Used: 512 B
           Free: 955904 B
----------------
MicroPython ESP32_LoBo_v3.2.24 - 2018-09-06 on ESP32 board with ESP32
Type "help()" for more information.
>>> 

Here are some of my attempts and adding the SPIRAM to both my TinyPICO and PICK-KIT...

Directly on board (pin for pin)
[Image: pic1.jpg]

Wire wrapped using rudi's pin config (using GPIO16 and 17)
[Image: pic2.jpg]

And both ways on the PICO-KIY with a SOP8 adapter and 0.1uF cap on VCC/GND
[Image: pic3.jpg]

Cheers,

Seon
unexpectedmaker.com
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)