Need help to connect external 16 MB SPI Flash Memory on ESP32-WROVER Kit

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Need help to connect external 16 MB SPI Flash Memory on ESP32-WROVER Kit

Postby Ritesh » Fri Sep 01, 2017 4:15 am

Hi,

We have started to work on ESP32 WROVER kit in which ESP32 WROVER module has been used.

So, In that module, There are mainly 4 MB SPI Flash and 4 MB PSRAM is connected over SPI Interface. I have checked that some if pins for both SPI Flash and PSRAM are common like MISO and MOSI. So why it has been kept common for that?

Also, I just want to add extra 16 MB external SPI Flash memory in addition to 4 MB SPI Flash memory. So, would you please suggest pin configuration for that and is it possible or not?

Mainly my purpose is to add some more extra memory interface in addition to existing one for my application development.

Looking forward for some positive feedback on this.
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Need help to connect external 16 MB SPI Flash Memory on ESP32-WROVER Kit

Postby Ritesh » Fri Sep 01, 2017 9:34 pm

Does any one has any idea for this?
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Need help to connect external 16 MB SPI Flash Memory on ESP32-WROVER Kit

Postby Ritesh » Mon Sep 04, 2017 4:06 am

Hi Espressif Systems Developer,

Do you have any update regarding external SPI Flash connection and its respective configurations on ESP32-WROVER Kit?
Regards,
Ritesh Prajapati

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

Re: Need help to connect external 16 MB SPI Flash Memory on ESP32-WROVER Kit

Postby ESP_Sprite » Mon Sep 04, 2017 8:05 am

The MMU in the ESP32 is incapable of putting 2 devices in the same memory space, so 'adding' memory to the internal memory is not going to be possible. You can connect the flash to a 'normal' SPI peripheral and use it as a SPI device where you can store 'plain' data in the same way you can use an SD-card to do that. Alternatively, you can burn the ESP32 fuses to let it use different GPIO pins for the main flash and connect your 16MiB flash there; that way it will be used instead of the 4MiB flash in the WROOM chip.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Need help to connect external 16 MB SPI Flash Memory on ESP32-WROVER Kit

Postby Ritesh » Mon Sep 04, 2017 6:18 pm

ESP_Sprite wrote:The MMU in the ESP32 is incapable of putting 2 devices in the same memory space, so 'adding' memory to the internal memory is not going to be possible. You can connect the flash to a 'normal' SPI peripheral and use it as a SPI device where you can store 'plain' data in the same way you can use an SD-card to do that. Alternatively, you can burn the ESP32 fuses to let it use different GPIO pins for the main flash and connect your 16MiB flash there; that way it will be used instead of the 4MiB flash in the WROOM chip.
Hi,

Thanks for reply.

Would you please send me configurations and examples to use external SPI Flash memory like SD Card?

If I want to use 16 MB external SPI Flash memory as main memory then how I can do it and what are hardware + software changes are required to make it?
Regards,
Ritesh Prajapati

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

Re: Need help to connect external 16 MB SPI Flash Memory on ESP32-WROVER Kit

Postby rudi ;-) » Tue Sep 05, 2017 6:14 pm

Ritesh wrote:
ESP_Sprite wrote:The MMU in the ESP32 is incapable of putting 2 devices in the same memory space, so 'adding' memory to the internal memory is not going to be possible. You can connect the flash to a 'normal' SPI peripheral and use it as a SPI device where you can store 'plain' data in the same way you can use an SD-card to do that. Alternatively, you can burn the ESP32 fuses to let it use different GPIO pins for the main flash and connect your 16MiB flash there; that way it will be used instead of the 4MiB flash in the WROOM chip.
Hi,

Thanks for reply.

Would you please send me configurations and examples to use external SPI Flash memory like SD Card?
you can use usually SPI ( Master ) for this
SPI
MOSI
MISO
CLK CS

read the datasheet from your favority SPI Flash, there are "commands" for read and write and erase and protections

if you use SD Card too in the lines, you need a different /CS Pin from GPIO


SPI Flash simple connect ( example 3.3V ) :
pullups / pulldowns take from your HW design
spi_flash.JPG
spi_flash.JPG (14.84 KiB) Viewed 35784 times

have a look to storages examples too.
example wear_levelling

Ritesh wrote: If I want to use 16 MB external SPI Flash memory as main memory then ...
then you need knowledge about espefuses

Ritesh wrote: ..how I can do it and what are hardware + software changes are required to make it?
this is your start

edit:
IMPORTANT: Because efuse is one-time-programmable, it is possible to permanently damage or "brick" your ESP32 using this tool. Use it with great care.

further note:
Wrover "system" Flash is 1.8V and pSRAM also is 1.8V and they supply from VDD_SDIO domain,
that have boostrap MTDI ( IO12 ) - done in the wrover modul.

if you want use "deep sleep" and you connect "extern spi flash" or "extern system flash" and efused this,
note, that VDD_SDIO is not breakout from wrover modul.
if you want use 1.8V extern flash you need regulator 1.8 or "wire" from SoC.

think over your conzept detailed what you want to do.

btw
i changed in the past the 1.8 V pSRAM and 1.8V Flash gen 3v3 pRSAM and Flash
and yes, then Bootstrap must be low done by user for VDD_SDIO 3V3
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Need help to connect external 16 MB SPI Flash Memory on ESP32-WROVER Kit

Postby Ritesh » Wed Sep 06, 2017 6:17 am

rudi ;-) wrote:
Ritesh wrote:
ESP_Sprite wrote:The MMU in the ESP32 is incapable of putting 2 devices in the same memory space, so 'adding' memory to the internal memory is not going to be possible. You can connect the flash to a 'normal' SPI peripheral and use it as a SPI device where you can store 'plain' data in the same way you can use an SD-card to do that. Alternatively, you can burn the ESP32 fuses to let it use different GPIO pins for the main flash and connect your 16MiB flash there; that way it will be used instead of the 4MiB flash in the WROOM chip.
Hi,

Thanks for reply.

Would you please send me configurations and examples to use external SPI Flash memory like SD Card?
you can use usually SPI ( Master ) for this
SPI
MOSI
MISO
CLK CS

read the datasheet from your favority SPI Flash, there are "commands" for read and write and erase and protections

if you use SD Card too in the lines, you need a different /CS Pin from GPIO


SPI Flash simple connect ( example 3.3V ) :
pullups / pulldowns take from your HW design
spi_flash.JPG

have a look to storages examples too.
example wear_levelling

Ritesh wrote: If I want to use 16 MB external SPI Flash memory as main memory then ...
then you need knowledge about espefuses

Ritesh wrote: ..how I can do it and what are hardware + software changes are required to make it?
this is your start

edit:
IMPORTANT: Because efuse is one-time-programmable, it is possible to permanently damage or "brick" your ESP32 using this tool. Use it with great care.

further note:
Wrover "system" Flash is 1.8V and pSRAM also is 1.8V and they supply from VDD_SDIO domain,
that have boostrap MTDI ( IO12 ) - done in the wrover modul.

if you want use "deep sleep" and you connect "extern spi flash" or "extern system flash" and efused this,
note, that VDD_SDIO is not breakout from wrover modul.
if you want use 1.8V extern flash you need regulator 1.8 or "wire" from SoC.

think over your conzept detailed what you want to do.

btw
i changed in the past the 1.8 V pSRAM and 1.8V Flash gen 3v3 pRSAM and Flash
and yes, then Bootstrap must be low done by user for VDD_SDIO 3V3
Hi,

Thanks for reply.

We will check and let you know result after doing some feasibility on ESP32 Module.
Regards,
Ritesh Prajapati

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Need help to connect external 16 MB SPI Flash Memory on ESP32-WROVER Kit

Postby ESP_Angus » Wed Sep 06, 2017 10:50 pm

Ritesh wrote: Also, I just want to add extra 16 MB external SPI Flash memory in addition to 4 MB SPI Flash memory. So, would you please suggest pin configuration for that and is it possible or not?

Mainly my purpose is to add some more extra memory interface in addition to existing one for my application development.
Hi Ritesh,

Can you please clarify exactly what your goal is for usage of this 16MB flash chip?

For example:
  1. Run read/write commands to store some data from your application.
  2. Execute code from this flash.
  3. Map this flash into the address space.
The option you're discussing with rudi is to manually send SPI read/write commands to the flash. This will let you achieve goal (1), but you'll have to write your own flash access code based on the flash chip datasheet.

The option suggested by ESP_Sprite is to set efuses inside the ESP32 chip that remap internal 4MB SPI flash pins so that the ESP32 replaces its internal on-module flash with the 16MB external flash chip. This will allow you to achieve goals 1, 2, & 3 by replacing the internal 4MB flash with the external 16MB. But if you do this then you won't get automatic access to the internal 4MB flash any more (you could still send manual SPI flash commands to the internal flash.)

Another option, if your order volume is large enough then Espressif may be able to produce ESP-WROVER modules with a 16MB flash chip instead of 4MB. I do not know what the MOQ is or what other costs may be associated with this, you would need to email sales directly. However such a module would work identically to the current ESP-WROVER, just with 16MB of flash space.

rahul.b.patel
Posts: 62
Joined: Wed Apr 19, 2017 6:35 am

Re: Need help to connect external 16 MB SPI Flash Memory on ESP32-WROVER Kit

Postby rahul.b.patel » Thu Sep 07, 2017 4:58 am

Hello Angus,
Ritesh and I work together. As per our requirement I tried to bypass the internal 4MB flash and replace it with 16MB external flash. So as ESP_Sprite suggested, I tried to efuse configurations on my ESP32 Core v2 board as following GPIOs,

SPI_PAD_CONFIG_CLK Override SD_CLK pad (GPIO6/SPICLK) = 14 R/W (0xe)
SPI_PAD_CONFIG_Q Override SD_DATA_0 pad (GPIO7/SPIQ) = 15 R/W (0xf)
SPI_PAD_CONFIG_D Override SD_DATA_1 pad (GPIO8/SPID) = 13 R/W (0xd)
SPI_PAD_CONFIG_HD Override SD_DATA_2 pad (GPIO9/SPIHD) = 27 R/W (0x1b)
SPI_PAD_CONFIG_CS0 Override SD_CMD pad (GPIO11/SPICS0) = 5 R/W (0x5)

-> As per the efuse value set above, I interfaced external flash pins as below,

ESP32 Pins External Flash
GPIO14 -> CLK
GPIO15 -> SDO
GPIO13 -> SDI
GPIO27 -> HOLD
GPIO5 -> CS

3.3v supplied to external flash.
-> After this connection, I tried to flash firmware into external flash, but "make flash" detected internal 4MB flash and its id rather than external 16MB flash, here is the "make flash" logs,

esptool.py v2.0-beta1
Connecting....................................
Uploading stub...
Running stub...
Stub running...
Attaching SPI flash...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0220
Compressed 11600 bytes to 6705...
Wrote 11600 bytes (6705 compressed) at 0x00001000 in 0.6 seconds (effective 148.7 kbit/s)...
Hash of data verified.
Compressed 415168 bytes to 177384...
Wrote 415168 bytes (177384 compressed) at 0x00010000 in 16.1 seconds (effective 206.8 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 82...
Wrote 3072 bytes (82 compressed) at 0x00008000 in 0.0 seconds (effective 787.7 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...


-> After firmware loaded, I started the board but it count start as following boot error,

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57


-> So, I suspect that it does not find the bootloader image at 0x1000, so possibly it tries to load bootloader image from external 16MB flash but bootloader image it flashed into internal 4MB flash, if I am not wrong.
-> Did I missed any step.? How to access external flash with this efused values.?

Looking for your suggestions.
Thanks.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Need help to connect external 16 MB SPI Flash Memory on ESP32-WROVER Kit

Postby ESP_Angus » Thu Sep 07, 2017 5:34 am

Hi Rahul,

Glad to hear that you and Ritesh are making progress.
rahul.b.patel wrote: esptool.py v2.0-beta1
This version of esptool.py is very old and predates support for efuse pin remappings. You will probably need to use IDF v2.1 or more recent, as these are the versions which added support for ESP32-D2WD (which also uses efuse pin remapping, set in the factory.)

If you use a recent esptool.py then it will detect the efuse configuration correctly.

Who is online

Users browsing this forum: No registered users and 55 guests