logo elektroda
logo elektroda
X
logo elektroda

[Solved] Problem with switching on the PSRAM on the ESP32 WEMOS LOLIN LIGHT board

speedy9 771 4
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20770448
    speedy9
    Helpful for users
    Hi. I have added myself a PSRAM (8MB, APS6404L) to the WEMOS LOLIN 32 Light board. I just need to enable the support. I'm using Arduino IDE 2. There is an option in the menu to enable/disable PSRAM support, but it only appears on boards that have PSRAM as standard.
    I don't know how to do it in Arduino for a board that doesn't have PSRM as standard. Theoretically in sdkconfig the entries are:
    
    #
    # SPI RAM config
    #
    CONFIG_SPIRAM_TYPE_AUTO=y
    # CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set
    # CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
    # CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
    CONFIG_SPIRAM_SIZE=-1
    # CONFIG_SPIRAM_SPEED_40M is not set
    CONFIG_SPIRAM_SPEED_80M=y
    CONFIG_SPIRAM=y
    # CONFIG_SPIRAM_BOOT_INIT is not set
    # CONFIG_SPIRAM_USE_MEMMAP is not set
    # CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
    CONFIG_SPIRAM_USE_MALLOC=y
    CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
    # CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is not set
    CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0
    # CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set
    # CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set
    CONFIG_SPIRAM_CACHE_WORKAROUND=y


    However, the SPI RAM is not initialised for my board. I think this is due to the way the board itself is defined in Arduino.
    I did the SPI RAM addition according to this description: https://blog.pagefault-limited.co.uk/lolin32-lite-esp32-8mb-psram-upgrade-mod
    According to the description here: https://arduinojson.org/v6/how-to/use-external-ram-on-esp32/ for Arduino you don't need to configure anything and the SPI RAM should supposedly be detected by itself. But it seems to me that it depends on the board definition.
    I even set in sdkconfig:
    CONFIG_SPIRAM_BOOT_INIT =y
    CONFIG_SPIRAM_USE_MEMMAP =y

    After reset I see only these entries:
    PSRAM found: 0
    PSRAM not found, inputBufferSize: 6399 bytes

    Any ideas?
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • ADVERTISEMENT
  • #2 20770486
    khoam
    Level 42  
    speedy9 wrote:
    However, the SPI RAM is not initialised for my board. It seems to me that this is due to the way the board itself is defined in Arduino.

    That seems to be the case, unless there are electrical issues. Have you tried with "twin" board definitions of e.g. LOLIN D32 PRO?
  • ADVERTISEMENT
  • #3 20770530
    speedy9
    Helpful for users
    I haven't tried. And it's not like even if it "fixes" PSRAM for me it messes up other things?
    Maybe rather to the compiler pass -DBOARD_HAS_PSRAM
  • ADVERTISEMENT
  • #4 20770539
    khoam
    Level 42  
    speedy9 wrote:
    And it's not like even if it "fixes" the PSRAM for me it will mess up other things?
    I don't think so. The differences between the ESP32 board variants are minor, e.g. the built-in LED plugged into a different pin. Or you can always use the generic "ESP32 Dev" variant. There will be more options to set up in the Arduino IDE.
  • #5 20778332
    speedy9
    Helpful for users
    Successful. I edited the file C:³³³[user]³³³³AppData³³³ocalArduino15.0.11.11.txt adding in the LOLIN32 LIGHT board part such an entry:

    lolin32-lite.build.defines=-DBOARD_HAS_PSRAM

    It compiled, uploaded to the board and:
    20:28:04.276 -> [ 459][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled
    20:28:04.318 -> [ 495][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
    20:28:04.351 -> [ 527][I][esp32-hal-i2c.c:75] i2cInit(): Initialising I2C Master: PSRAM INIT: 1
    20:28:04.351 -> PSRAM found: 1

    20:28:06.590 -> PSRAM found, inputBufferSize: 283615 bytes
ADVERTISEMENT