Small ESP32 Modul ( all include in new ESP32-PICO )

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: Small ESP32 Modul ( all include in new ESP32-PICO )

Postby rudi ;-) » Tue Oct 30, 2018 10:07 am

seonroz wrote:Hey Rudi.. I'd like to revive this thread!
Firstly, thanks for all of your work on getting PSRAM working on the PICO-D4!
What are the final pin mappings you used for rev1 silicon?
Hi
https://esp32.com/viewtopic.php?f=2&p=18439#p17627
https://esp32.com/viewtopic.php?f=2&p=18439#p18431
seonroz wrote: I have a board that I have designed (TinyPICO - http://tinypico.com ) that I am trying to get PSRAM working with.
How i can order this board?

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
seonroz
Posts: 57
Joined: Thu Oct 25, 2018 3:51 am
Location: Melbourne, Australia
Contact:

Re: Small ESP32 Modul ( all include in new ESP32-PICO )

Postby seonroz » Tue Oct 30, 2018 10:08 am

loboris wrote:
seonroz wrote:NOTE: I've NOT tried re-mapping pins in spiram_psram.c as that's just a bad idea... I want TinyPICO to be compatible with PICO boards.
I think you must remap the pins, otherwise the psRAM driver will try to use the wrong pins for psRAM and it will not work...
Conditional defines should probably be used in final spiram_psram.c for psSRAM with PICO.
For example, on ESP32-PICO-D4 GPIO17 is used for Flash/psRAM IO1, on other ESP32 chips for Flash CLK. Other pins are connected differently too.
Hopefully this will be supported officially soon...
Thanks Boris!

So has anyone already re-mapped the pins and got it working on a PICO?

Is there a "good set" that's proven to be the ideal right now?

I don't even know which pins these 4 are "supposed" to be:

Code: Select all

#define PSRAM_SPIQ_IO
#define PSRAM_SPID_IO
#define PSRAM_SPIWP_IO
#define PSRAM_SPIHD_IO
Do you know which are SIO[0], SIO[1] etc? I can't find any reference to any of these names in any SPIRAM datasheet :(

BTW, in case you hadn't realised, I am pretty new to all of this.. so just trying to keep my head above water, and I appreciate your help Boris!

Thanks,
Seon
unexpectedmaker.com
Seon
unexpectedmaker.com

User avatar
seonroz
Posts: 57
Joined: Thu Oct 25, 2018 3:51 am
Location: Melbourne, Australia
Contact:

Re: Small ESP32 Modul ( all include in new ESP32-PICO )

Postby seonroz » Tue Oct 30, 2018 10:11 am

rudi ;-) wrote:
seonroz wrote:Hey Rudi.. I'd like to revive this thread!
Firstly, thanks for all of your work on getting PSRAM working on the PICO-D4!
What are the final pin mappings you used for rev1 silicon?
Hi
https://esp32.com/viewtopic.php?f=2&p=18439#p17627
https://esp32.com/viewtopic.php?f=2&p=18439#p18431
seonroz wrote: I have a board that I have designed (TinyPICO - http://tinypico.com ) that I am trying to get PSRAM working with.
How i can order this board?

best wishes
rudi ;-)
Thanks rudi! I'll go over those links tomorrow (almost bed time here in Australia).

TinyPICO is not available yet.. all it's waiting on is getting PSRAM working and it's done. I'm off to Shenzhen in a few weeks to talk to some small run PCBA people... but at this stage I might be hand assembling them ;)

Cheers,
Seon
unexpectedmaker.com
Seon
unexpectedmaker.com

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: Small ESP32 Modul ( all include in new ESP32-PICO )

Postby rudi ;-) » Tue Oct 30, 2018 10:19 am

seonroz wrote:
rudi ;-) wrote:
seonroz wrote:Hey Rudi.. I'd like to revive this thread!
Firstly, thanks for all of your work on getting PSRAM working on the PICO-D4!
What are the final pin mappings you used for rev1 silicon?
Hi
https://esp32.com/viewtopic.php?f=2&p=18439#p17627
https://esp32.com/viewtopic.php?f=2&p=18439#p18431
seonroz wrote: I have a board that I have designed (TinyPICO - http://tinypico.com ) that I am trying to get PSRAM working with.
How i can order this board?

best wishes
rudi ;-)
Thanks rudi! I'll go over those links tomorrow (almost bed time here in Australia).

TinyPICO is not available yet.. all it's waiting on is getting PSRAM working and it's done. I'm off to Shenzhen in a few weeks to talk to some small run PCBA people... but at this stage I might be hand assembling them ;)

Cheers,
Seon
unexpectedmaker.com
btw
there was a psram switch bank work on Pico D4 too
perhabs this helps you to configure it out.

best wishes
rudi ;-)
Attachments
3.jpg
3.jpg (102.17 KiB) Viewed 13270 times
2.jpg
2.jpg (125.73 KiB) Viewed 13270 times
1.jpg
1.jpg (96.43 KiB) Viewed 13270 times
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Small ESP32 Modul ( all include in new ESP32-PICO )

Postby loboris » Tue Oct 30, 2018 10:22 am

Code: Select all

typedef struct {
    int mosi_io_num;                ///< GPIO pin for Master Out Slave In (=spi_d) signal, or -1 if not used.
    int miso_io_num;                ///< GPIO pin for Master In Slave Out (=spi_q) signal, or -1 if not used.
    int sclk_io_num;                ///< GPIO pin for Spi CLocK signal, or -1 if not used.
    int quadwp_io_num;              ///< GPIO pin for WP (Write Protect) signal which is used as D2 in 4-bit communication modes, or -1 if not used.
    int quadhd_io_num;              ///< GPIO pin for HD (HolD) signal which is used as D3 in 4-bit communication modes, or -1 if not used.
    int max_transfer_sz;            ///< Maximum transfer size, in bytes. Defaults to 4094 if 0.
    uint32_t flags;                 ///< Abilities of bus to be checked by the driver. Or-ed value of ``SPICOMMON_BUSFLAG_*`` flags.
} spi_bus_config_t;
SPID -> IO0
SPIQ -> IO1
SPIWP -> IO2
SPIHD -> IO3

User avatar
seonroz
Posts: 57
Joined: Thu Oct 25, 2018 3:51 am
Location: Melbourne, Australia
Contact:

Re: Small ESP32 Modul ( all include in new ESP32-PICO )

Postby seonroz » Tue Oct 30, 2018 10:24 am

loboris wrote:

Code: Select all

typedef struct {
    int mosi_io_num;                ///< GPIO pin for Master Out Slave In (=spi_d) signal, or -1 if not used.
    int miso_io_num;                ///< GPIO pin for Master In Slave Out (=spi_q) signal, or -1 if not used.
    int sclk_io_num;                ///< GPIO pin for Spi CLocK signal, or -1 if not used.
    int quadwp_io_num;              ///< GPIO pin for WP (Write Protect) signal which is used as D2 in 4-bit communication modes, or -1 if not used.
    int quadhd_io_num;              ///< GPIO pin for HD (HolD) signal which is used as D3 in 4-bit communication modes, or -1 if not used.
    int max_transfer_sz;            ///< Maximum transfer size, in bytes. Defaults to 4094 if 0.
    uint32_t flags;                 ///< Abilities of bus to be checked by the driver. Or-ed value of ``SPICOMMON_BUSFLAG_*`` flags.
} spi_bus_config_t;
SPID -> IO0
SPIQ -> IO1
SPIWP -> IO2
SPIHD -> IO3
Thanks Boris!

Seon
unexpectedmaker.com
Seon
unexpectedmaker.com

User avatar
seonroz
Posts: 57
Joined: Thu Oct 25, 2018 3:51 am
Location: Melbourne, Australia
Contact:

Re: Small ESP32 Modul ( all include in new ESP32-PICO )

Postby seonroz » Wed Oct 31, 2018 12:39 am

So I am getting that hard crash no matter what I set the pins to, even with no PSRAM connected... even using up all of my GPIO that I know is good (no conflicts) like...

Code: Select all

#define FLASH_CLK_IO      6  //Psram clock is a delayed version of this in 40MHz mode
#define FLASH_CS_IO       11
#define PSRAM_CLK_IO      21 // 17
#define PSRAM_CS_IO       22 // 16
#define PSRAM_SPIQ_IO     23 // 7
#define PSRAM_SPID_IO     18 // 8
#define PSRAM_SPIWP_IO    19 // 10
#define PSRAM_SPIHD_IO    25 // 9
And I have tried the suggested pins from here
viewtopic.php?f=12&t=6866&p=32874#p32874

Code: Select all

#define PSRAM_CLK_IO      6 // 17
#define PSRAM_CS_IO       9 // 16
#define PSRAM_SPIQ_IO     8 // 7
#define PSRAM_SPID_IO     17 // 8
#define PSRAM_SPIWP_IO    7 // 10
#define PSRAM_SPIHD_IO    11 // 9
I get the same hard crash if I enable PSRAM in menuconfig, with or without the "ignore if no PSRAM found".

D (1133) boot: start: 0x400816e4
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x400835bf PS : 0x00060b30 A0 : 0x80084430 A1 : 0x3ffe3bb0
A2 : 0xc0100000 A3 : 0x00000000 A4 : 0x00013ffc A5 : 0x00000000
A6 : 0x000008ff A7 : 0x3ffe3b19 A8 : 0x80083548 A9 : 0x3ffe3b90
A10 : 0x00000000 A11 : 0x3ff42000 A12 : 0x00000034 A13 : 0x00000000
A14 : 0x00000000 A15 : 0x00000004 SAR : 0x00000007 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x4009bc2c LEND : 0x4009bc37 LCOUNT : 0x00000000

Backtrace: 0x400835bf:0x3ffe3bb0 0x4008442d:0x3ffe3bd0 0x400d3fc5:0x3ffe3c00 0x40081752:0x3ffe3c20 0x4007925b:0x3ffe3c40 0x40079351:0x3ffe3c80 0x4007936f:0x3ffe3cc0 0x40079723:0x3ffe3ce0 0x40080391:0x3ffe3df0 0x40007c31:0x3ffe3eb0 0x4000073d:0x3ffe3f20

CPU halted.


It seems to happen just before the initialisation/check/formatting of the filesystem (SPIFFS).

@loboris, I assume you've not checked this on any PICO D4 boards due to the early exit being present in your code, which is fair enough. It seems @rudi is the only one that has gotten PSRAM working on the PICO D4, but just using IDF and not micropython.

I've tried about 20 combinations of pins... not matter what i try, with or without a PSRAM IC present, it crashes :(

NOTE: The crash happens on any DICO-D4 board I try (TTGO, PICO-KIT & TinyPICO) but it's also crashing the same on a Wemos Lolin32 and my own WROOM32 dev board.... so it's not specific to the PICO D4.

Seon
unexpectedmaker.com
Seon
unexpectedmaker.com

User avatar
seonroz
Posts: 57
Joined: Thu Oct 25, 2018 3:51 am
Location: Melbourne, Australia
Contact:

Re: Small ESP32 Modul ( all include in new ESP32-PICO )

Postby seonroz » Wed Oct 31, 2018 1:31 am

More info....

If I turn off "Initialise SPI RAM when booting the ESP" - even though I had "Ignore PSRAM when not found" ticked, it doesn't crash anymore, but instead it fails to allocate HEAP and then hangs...

D (1130) boot: start: 0x4008148c
E (2118) MicroPython: Error allocating heap, HALTED.


So Initialising PSRAM is crashing all of my ESP32 devices (PICO-D4 & WROOM32) whether or not "Ignore PSRAM when not found" is ticked, so maybe that "ignore" is not working?

Seon
unexpectedmaker.com
Seon
unexpectedmaker.com

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Small ESP32 Modul ( all include in new ESP32-PICO )

Postby loboris » Wed Oct 31, 2018 10:02 am

I've never tested psRAM operation on ESP32-PICO-D4 board (I don't have any at the moment). I'll probably get one next month, then I'll try to attach psRAM chip and test it.

With MicroPython, if psRAM is enabled, "Initialise SPI RAM when booting the ESP" must be enabled. The initialization code sets the variable which is used by MicroPython code to decide if the heap can be placed in psRAM. If the initialization code is not run, this variable is just set to "success" state and allocating the MicroPython heap in psRAM will be attempted.

The first log message related to MicroPython is "D (ttt) MicroPython: Entry" (app_main() entry). Any crash before it is not in any way related to MicroPython.

I have tested running with psRAM on WROVER modules and on WROOM modules with externally added 3.3V psRAM and never had any issue.

I have no idea why you have an issue with ESP32-WROOM with psRAM.
I've tested with psRAM attached as described here. ESP-WROOM-32 module must be with rev1 ESP32

Here is the log when running on WROOM module with added psRAM:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:4996
load:0x40078000,len:8112
load:0x40080000,len:6488
0x40080000: _WindowOverflow4 at /home/LoBo2_Razno/ESP32/MicroPython/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/components/freertos/xtensa_vectors.S:1685

entry 0x40080300
0x40080300: _KernelExceptionVector at /home/LoBo2_Razno/ESP32/MicroPython/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/components/freertos/xtensa_vectors.S:536

I (695) spiram: SPI RAM mode: flash 80m sram 40m
I (695) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (696) cpu_start: Pro cpu up.
I (699) cpu_start: Starting app cpu, entry point is 0x40081674
0x40081674: 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 (1560) spiram: SPI SRAM memory test OK
I (1561) heap_init: Initializing. RAM available for dynamic allocation:
D (1561) heap_init: New heap initialised at 0x3ffaff10
I (1566) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
D (1572) heap_init: New heap initialised at 0x3ffce8e0
I (1577) heap_init: At 3FFCE8E0 len 00011720 (69 KiB): DRAM
I (1584) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (1590) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (1597) heap_init: New heap initialised at 0x4009a7fc
I (1602) heap_init: At 4009A7FC len 00005804 (22 KiB): IRAM
I (1608) cpu_start: Pro cpu start user code
I (1613) spiram: Adding pool of 4096K of external SPI memory to heap allocator
D (1621) clk: waiting for 32k oscillator to start up
E (1706) clk: RTC: Not found External 32 kHz XTAL. Switching to Internal 150 kHz RC chain
D (1714) clk: RTC_SLOW_CLK calibration value: 2973786
I (155) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
D (156) heap_init: New heap initialised at 0x3ffe0440
D (161) heap_init: New heap initialised at 0x3ffe4350


D (166) MicroPython: Entry
D (1169) MicroPython: SPIRAM: Enabled
D (1178) nvs: nvs_flash_init_custom partition=nvs start=9 count=6
D (1206) MicroPython: Configure stack
D (1206) nvs: nvs_open_from_partition MPY_NVM 1
D (1206) nvs: nvs_get MPY_StackSize 4
D (1206) nvs: nvs_get_str_or_blob MpyTimeZone
D (1211) nvs: nvs_get MPY_do_scripts 4
D (1214) MicroPython: MPy stack: 0x3ffd3e40 - 0x3ffd7e48 (16392)
D (1220) MicroPython: Configure heap
D (1224) nvs: nvs_get MPY_HeapSize 4
D (1227) MicroPython: MPy heap: 0x3f80001c - 0x3fb0005c (3145728)
D (1234) MicroPython: Main task exit, stack used: 1428
I (1242) MicroPython: [=== MicroPython FreeRTOS task started (sp=3ffd7d70) ===]

The log when running the same firmware on WROOM without psRAM:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:4996
load:0x40078000,len:8112
load:0x40080000,len:6488
0x40080000: _WindowOverflow4 at /home/LoBo2_Razno/ESP32/MicroPython/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/components/freertos/xtensa_vectors.S:1685

entry 0x40080300
0x40080300: _KernelExceptionVector at /home/LoBo2_Razno/ESP32/MicroPython/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/components/freertos/xtensa_vectors.S:536

E (684) spiram: SPI RAM enabled but initialization failed. Bailing out.
I (684) cpu_start: Failed to init external RAM; continuing without it.

I (687) cpu_start: Pro cpu up.
I (691) cpu_start: Starting app cpu, entry point is 0x40081674
0x40081674: 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 (702) heap_init: Initializing. RAM available for dynamic allocation:
D (708) heap_init: New heap initialised at 0x3ffaff10
I (714) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
D (720) heap_init: New heap initialised at 0x3ffce8e0
I (725) heap_init: At 3FFCE8E0 len 00011720 (69 KiB): DRAM
I (731) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (737) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (744) heap_init: New heap initialised at 0x4009a7fc
I (749) heap_init: At 4009A7FC len 00005804 (22 KiB): IRAM
I (755) cpu_start: Pro cpu start user code
D (760) clk: waiting for 32k oscillator to start up
E (845) clk: RTC: Not found External 32 kHz XTAL. Switching to Internal 150 kHz RC chain
D (852) clk: RTC_SLOW_CLK calibration value: 2996966
I (189) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
D (189) heap_init: New heap initialised at 0x3ffe0440
D (194) heap_init: New heap initialised at 0x3ffe4350


D (199) MicroPython: Entry
W (1202) MicroPython: SPIRAM support enabled but SPIRAM not detected
D (1202) MicroPython: SPIRAM: Disabled

D (1202) nvs: nvs_flash_init_custom partition=nvs start=9 count=6
D (1244) MicroPython: Configure stack
D (1244) nvs: nvs_open_from_partition MPY_NVM 1
D (1244) nvs: nvs_get MPY_StackSize 4
D (1245) nvs: nvs_get_str_or_blob MpyTimeZone
D (1249) nvs: nvs_get MPY_do_scripts 4
D (1253) MicroPython: MPy stack: 0x3ffd3c2c - 0x3ffd7c34 (16392)
D (1259) MicroPython: Configure heap
D (1262) nvs: nvs_get MPY_HeapSize 4
D (1266) MicroPython: MPy heap: 0x3ffe436c - 0x3fff63ac (73728)
D (1272) MicroPython: Main task exit, stack used: 1436
I (1273) MicroPython: [=== MicroPython FreeRTOS task started (sp=3ffd7b60) ===]

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Small ESP32 Modul ( all include in new ESP32-PICO )

Postby loboris » Wed Oct 31, 2018 10:26 am

I've just remembered I have a ESP32-PICO-D4 module (TTGO Micro-32) which I've never used.
I'll try to attach psRAM chip and test it later today.

Who is online

Users browsing this forum: No registered users and 317 guests