Getting PSRAM64H connected and working with ESP32 WROOM 38 pin, Arduino IDE 2.3.3

Glen104TMR
Posts: 6
Joined: Wed Oct 09, 2024 11:53 am

Getting PSRAM64H connected and working with ESP32 WROOM 38 pin, Arduino IDE 2.3.3

Postby Glen104TMR » Wed Oct 09, 2024 12:31 pm

I have connected an ESP PSRAM64H chip to an ESP32 WROOM board (38 pin, with SPI1 pins exposed (GPIO6, 7, 8, 9, 10)) following the same pin connections as for ESP32 WROVER B, as shown in the schematic below:
PSRAM64HCOnnectedToESP32WROOM.jpg
PSRAM64HCOnnectedToESP32WROOM.jpg (21.75 KiB) Viewed 2097 times
I have setup the board parameters to ensure PSRAM is selected as enabled:
ArduinoToolsDropDown.jpg
ArduinoToolsDropDown.jpg (38.46 KiB) Viewed 2097 times
Compiled and uploaded the following code, to see if PSRAMInit works:

Code: Select all

#include <Arduino.h>

byte PSRAMFlag=0;

void setup() {
  Serial.begin(115200);
  
  // Initialize PSRAM
  if (!psramInit()) {
    Serial.println("PSRAM initialization failed!");
    PSRAMFlag=0;
  }
  else {
    PSRAMFlag=1;
  }
  
  if (PSRAMFlag){
    // Check PSRAM size
    size_t psramSize = ESP.getPsramSize();
    Serial.print("Total PSRAM: ");
    Serial.print(psramSize);
    Serial.println(" bytes");
    
    size_t freePsram = ESP.getFreePsram();
    Serial.print("Free PSRAM: ");
    Serial.print(freePsram);
    Serial.println(" bytes");
  }
}

void loop() {
  
}
But when I run the code it comes back saying "PSRAM initialization failed!".

I'm not sure where to go from here.
Should there be some other code to setup the PSRAM for use with the ESP32 WROOM?
Should the CS and SCK pins be explicitly assigned/initialised somewhere?
Any advice appreciated...

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: Getting PSRAM64H connected and working with ESP32 WROOM 38 pin, Arduino IDE 2.3.3

Postby ESP_Sprite » Sat Oct 12, 2024 3:36 am

I'd suggest you check the datasheet of your exact module... some of the newer ones don't have those pins connected anymore.

Glen104TMR
Posts: 6
Joined: Wed Oct 09, 2024 11:53 am

Re: Getting PSRAM64H connected and working with ESP32 WROOM 38 pin, Arduino IDE 2.3.3

Postby Glen104TMR » Sun Oct 13, 2024 1:08 pm

Its a 38 pin ESP32 WROOM board.
The pinouts (shown below) expose GPIO6-11, which are the SPI pins for SPI1, and which I've connected the PSRAM64H chip to.
ESP32WROOM-38Pin-Pinout.jpg
ESP32WROOM-38Pin-Pinout.jpg (122.04 KiB) Viewed 1879 times
Any further thoughts/advice appreciated.

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: Getting PSRAM64H connected and working with ESP32 WROOM 38 pin, Arduino IDE 2.3.3

Postby ESP_Sprite » Mon Oct 14, 2024 3:17 am

Just to make sure, can you use an oscilloscope or logic analyzer to see if there's actually any activity on those pins? If they are attached, you should see all kinds of signals when the ESP32 is booting up.

Glen104TMR
Posts: 6
Joined: Wed Oct 09, 2024 11:53 am

Re: Getting PSRAM64H connected and working with ESP32 WROOM 38 pin, Arduino IDE 2.3.3

Postby Glen104TMR » Mon Oct 14, 2024 12:47 pm

Yes, there seems to be activity (oscilloscope) on the pins, and I have used a multimeter to check the connections between the pads on the ESP32 WROOM module that correspond to the pins on the dev board, and they are all continuous and connected to the correct pads/pins.
I'm wondering if just assuming that GPIO16 and GPIO17 are the correct pins for CS and SCK, respectively, is correct? These seem to be the pins used by ESP32 WROVER, but maybe these pins need to explicitly setup somewhere when used on an ESP32 WROOM board?
I note that GPIO6 is labeled "SCK" (presumably for SPIO1) in some pinout diagrams, and I wonder why this clock line is not used with external PSRAM, instead of GPIO17?

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: Getting PSRAM64H connected and working with ESP32 WROOM 38 pin, Arduino IDE 2.3.3

Postby ESP_Sprite » Tue Oct 15, 2024 3:49 am

Glen104TMR wrote:
Mon Oct 14, 2024 12:47 pm
Yes, there seems to be activity (oscilloscope) on the pins, and I have used a multimeter to check the connections between the pads on the ESP32 WROOM module that correspond to the pins on the dev board, and they are all continuous and connected to the correct pads/pins.
Hm, weird then... how did you connect the psram btw? It gets ran at pretty high speeds, so if you use e.g. a breadboard setup, that may not work because of signal integrity issues. (Although I'd imagine that may also affect the flash in that case.)
I'm wondering if just assuming that GPIO16 and GPIO17 are the correct pins for CS and SCK, respectively, is correct? These seem to be the pins used by ESP32 WROVER, but maybe these pins need to explicitly setup somewhere when used on an ESP32 WROOM board?
I note that GPIO6 is labeled "SCK" (presumably for SPIO1) in some pinout diagrams, and I wonder why this clock line is not used with external PSRAM, instead of GPIO17?
It's correct. SCK is a separate IO pin because PSRAM has a slightly different clock requirement than the flash, and the ESP32 hardware wasn't designed to incorporate that yet, so we use a different peripheral to generate the clock.

Glen104TMR
Posts: 6
Joined: Wed Oct 09, 2024 11:53 am

Re: Getting PSRAM64H connected and working with ESP32 WROOM 38 pin, Arduino IDE 2.3.3

Postby Glen104TMR » Tue Oct 15, 2024 9:45 am

Thanks for the clarification abt SCK.
I've connected the PSRAM64H to the ESP32 using a small PCB I made (pic attached), and DuPont wires.
Perhaps the wires may be affecting the signal integrities.
What would be the correct command to adjust the SPI0/1 clock frequency?
Also, I'm taking it that you agree that pins 16 and 17 do not any explicit 'setup' for them to be correctly identified as the CS and SCK pins for the PSRAM chip?
Thanks for your help.
Attachments
PSRAM64HAdapterBoard.jpg
PSRAM64HAdapterBoard.jpg (750.74 KiB) Viewed 1636 times

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: Getting PSRAM64H connected and working with ESP32 WROOM 38 pin, Arduino IDE 2.3.3

Postby ESP_Sprite » Tue Oct 15, 2024 10:01 am

Glen104TMR wrote:
Tue Oct 15, 2024 9:45 am
I've connected the PSRAM64H to the ESP32 using a small PCB I made (pic attached), and DuPont wires.
Perhaps the wires may be affecting the signal integrities.
That sounds likely, tbh.
What would be the correct command to adjust the SPI0/1 clock frequency?
ESP-IDF has a menuconfig option for this, but I'm not sure if you can change it in Arduino.
Also, I'm taking it that you agree that pins 16 and 17 do not any explicit 'setup' for them to be correctly identified as the CS and SCK pins for the PSRAM chip?
That is correct.

Glen104TMR
Posts: 6
Joined: Wed Oct 09, 2024 11:53 am

Re: Getting PSRAM64H connected and working with ESP32 WROOM 38 pin, Arduino IDE 2.3.3

Postby Glen104TMR » Wed Oct 16, 2024 12:26 pm

OK, so, problem eventually solved:
1. In the circuit diagram, I've got SD2(ESP32) -> SD2(PSRAM), and SD3(ESP32) -> SD3(PSRAM), because I incorrectly aligned SIO2(PSRAM) and SIO3(PSRAM) with SD2 and SD3 on the ESP32.
2. However, at one stage I did swap these two connections around (so the PSRAM should have worked with the ESP32), but still found the PRSAM chip wouldn't work with the ESP32.
So, I made a PCB that mounts the PSRAM with the ESP32 (no flying wires!), and correctly connects SIO2(PSRAM) and SIO3(PSRAM) with SD3 and SD2 on the ESP32, respectively.
And now I have 4Mb of PSRAM working perfectly.
Many thanks for your suggestions of things to try along the way...

Who is online

Users browsing this forum: No registered users and 138 guests