Lolin32 Lite (ESP32) 8MB PSRAM Upgrade Mod

By piggybacking a PSRAM chip on to the existing flash chip we can get a whopping additional 8MB of addressable RAM.

Pseudostatic RAM (AKA PSRAM) as described on Wikipedia is, in short,

PSRAM or PSDRAM is dynamic RAM with built-in refresh and address-control circuitry to make it behave similarly to static RAM (SRAM). It combines the high density of DRAM with the ease of use of true SRAM.

The WROOM-32 based ESP32 development boards are quite versatile but they are lacking PSRAM as standard. Whereas the newer WROVER boards ship with PSRAM as the norm and is typically 4MB (megabytes) in size, but the WROVER based development boards are unfortunately almost double the cost of the WROOM-32 based development boards.

Laboris documented a successful upgrade of a ESP-WROOM-32 @ Info Upgrade ESP32 board without psRAM with 4MB/8MB SPIRAM

Sooooo, having a bunch of Lolin32 Lites at hand and a bunch of newly acquired IPUS IPS6404L-SQ SPI/QPI PSRAM, I thereby decided to give it a go. Not willing to wait until my 16MB (megabyte) flash chips arrived – my original plan was to replace them as well, which would have given a grand total of 16MB Flash/8MB PSRAM plus the original 520KB of internal SRAM, but alas impatience got the better of me and I hastily forged ahead keeping the original 4MB of flash in place.

The IPS6404L-SQ PSRAM datasheet

specifies that the PSRAM is available as a 1.8v or a 3.3v variant.

By way of flash storage the Lolin32 Lite uses the 32Mbit (4MB) 3V Winbond W25Q32JVSSIG (datasheet, click here)

and as the plan was to piggyback the PSRAM directly on to the back of the Winbond flash chip, I would need to use the matching 3V part, namely the IPS6404L-SQ-SPN version of the PSRAM and luckily that is what I have to hand, 48 of them @ £0.60 each, which per unit is actually cheaper than a 23lc1024-i/sn 1024Kbit SPIRAM part, and yes you can use the PSRAM as box standard SPIRAM.

Piggybacking an IC does mean having access to it (the IC), and the Lolin32 Lite, by not using a WROOM-32 module and having a custom design (unlike the DevkitC), has all the ICs exposed (and hence the reason I use them). Actually if you dismantled and piggybacked a WROOM-32 module you wouldn’t be able to refit the Can.

To perform the piggyback, just place the PSRAM on top of the Flash chip, in the correct orientation (i.e. Pin 1 to Pin 1, Pin 8 to Pin 8) and solder all pins excepting –

  • Pin 1 – CE/CS
  • Pin 6 – SCK

Pins 1, 6 and the 10K pull up are specific to the PSRAM (and the flash which has its own pin 1,pin 6 and resister pullup) and allow the two devices to be controlled individually.

  • Pin 1 should be wired to GPIO16 and provides the Chip Select for the PSRAM.
  • Pin 6 should be wired to GPIO17 and provides the SCLK for the PSRAM.
  • GPIO16 should be pulled up to 3V via a 10K resistor to ensure that the PSRAM is deselected during boot up.

NOTE: GPIO16 and GPIO17 will no longer be available for normal use after fitting the the PSRAM!!! Yes you just lost two pins!

As to enabling the PSRAM in PlatformIO, all that is required is to simply add the following PSRAM related build defines to your “platformio.ini” file.

After which you should hopefully see a message saying “PSRAM enabled”

Assuming that your PSRAM is enabled and active, you will now be able to use 4MB of the 8MB PSRAM as normal addressable memory, which you can subsequently allocate and use with the “ps_malloc” function.

What about the remaining 4MB, I hear you say, well the remaining 4MB of the 8MB PSRAM is accessible using the ESP32 High mem Allocation API,
a form of bank switching, where sections of ram are mapped in and out of the same address space, all of which takes me back to the good old bank switching days of Commodore 128s and Atari 130XEs, but I digress. An example doing a simple memory test of the high memory range is available at esp-idf: system/himem

Links

ESP32-IDF: Support for external RAM

Hotchip – HT4928S Ver1.1 English PDF

The Hotchip HT4928S english datasheet

The HT4928S is a highly integrated mobile power supply Management chip with a built-in charge management module, an LED indicator Block, a boost discharge management module and is available in a small SOP8 Package. The periphery can be composed of very few components for a powerful mobile power solution.

It may or may not be the management chip that is on this module, described on Aliexpress as “5V-Step-Up-Power-Module-Lithium-Battery-Charging-Protection-Board-Boost-Converter-LED-Display-USB

With more than a little help from Google Translate, I translated the Chinese HT4928S datasheet

to English. Enjoy!

Wemos Lolin32 Pinout vs Wemos Lolin32 Lite Pinout

A complete Wemos Lolin32 Pinout Diagram showing all alternate functions in full.

Not being able to find a complete pinout diagram for the ESP32 based Wemos Lolin32, I decided to create one. I have included an existing pinout of the Wemos Lolin32 Lite too, for comparison purposes between the two boards.

Enjoy! click to view

.

Product Page

Wemos Lolin32 – https://wiki.wemos.cc/products:lolin32:lolin32

Wemos Lolin32 Lite – https://wiki.wemos.cc/products:lolin32:lolin32_lite

ESP-01S Relay Module V1.0

Overview

I picked up 10 of these modules (including the ESP-01s units) on Aliexpress for the purpose of controlling domestic AC powered equipment .e.g lights, fan heaters and such like.

It is a compact little module that directly holds the esp-01s in an 8-pin female pin header. Features of note are

  • The Relay is a Songle SRD-05VDC-SL-C rated at 240V 10A. Datasheet
  • A 7002 mosfet for switching the relay via GPIO0. Datasheet
  • The Relay is activated via GPIO0.
  • GPIO2 is free for monitoring a sensor button, switch, thermostat etc..
  • A reset button.
  • The 5v power input is converted to a ESP8266 compatible output of 3.3v via a AMS1117 3.3v linear voltage regulator. Datasheet

Problems

The relay module’s design (albeit compact and aesthetically pleasing) does present a few problems detailed below –

  1. The CH_PD pin is not pulled up to VCC and is left floating and as such the esp-01s module will never activate.
  2. The GPIO0 pin is pulled down to GND via resister R2. This means that the esp-01s module will start up in Flashing mode.
  3. The AMS1117 3.3v linear regulator. The problem with these is that when they fail they fail big and go short circuit feeding the (in this case 5v) input voltage straight through to the output pins. I managed to short one out while messing with the esp-01s CH_PD pin and now have a steady 5v-5v regulator on the Relay module and a dead esp-01s module.
    The Relay module can be rescued by replacing the AMS1117 3.3v regulator but the esp-01s has blinked it’s last LED.
    I have also fried AMS1117 5V regulators on breadboard power supplies as discussed in Breadboard power supply module destructive failure.

Fix

A helpful Youtube video can be found below.

How to fix cheap ebay ESP8266 relay module
How to fix cheap ebay ESP8266 relay module

To summarise the points raised in the video…

  • The fix for the GPIO0 problem is to simply remove the resister R2. This will stop it being pulled LOW on boot.
  • Connect the CH_PD pin to VCC pin either on the esp-01s or on the relay module. This will enable the esp-01 on boot.