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

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:47 am

A few other things to note:

Because of the way SPI buses work you can probably keep SPICLK, SPIQ, SPID, SPIHD, SPIWP on the same GPIOs are they are currently using. You only need need to find a new & unused pin for CS0. You will need to set efuses for all these pins anyhow (if one pin is remapped in efuse, then they all need to be remapped).

To set the SPI WP pin assignment, run "make menuconfig", go to "Serial flasher config" and enable QIO or QOUT mode. Then leave that submenu and go into "Bootloader Configuration". There will be a newly visible item "SPI Flash WP Pin when customising pin via efuse...". Set this to the WP pin GPIO number (10 if you are keeping the default pin layout).

If you don't keep SPICLK, SPIQ, SPID, SPIHD & SPIWP pins in the same location then it's likely that the WROVER PSRAM won't work, at least not without code modifications. ESP_Sprite can probably confirm.

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 6:06 am

Hi Angus,
Thanks for quick reply. It is working now with IDFv2.1. Booted ESP32 from external flash.

One more query....
If we just change efuse config value of CS pin only for external flash support as below,

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

In short, we keep same GPIOs for external flash as internal flash except CS pin. Will it work.? Will it possible to access external flash by bypassing internal flash same way..?
It is possible, right.? as I think PSRAM in wrover module uses the same concept, isn't it.?

Thanks.

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 6:08 am

Hi Angus,
I just post the same question as you were giving suggestion for the same. :) . Did not see your last post.


Thanks.

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 » Fri Sep 08, 2017 8:52 am

Hello,
I found one strange thing while testing external flash as standard SPI peripheral on HSPI master. here is my workflow,
I use windbond's W25Q128FV 16MB flash,

1. enable WEL(write enable flag=1).
2. erase flash sector
3. enable WEL (as erase will clear previously set WEL, so will require to set it again)
4. write data into erased sector

[*]Note : WEL should be 1 for erase, read and write command to work for this flash.

For IDFv2.0 after erase command [step 2], WEL gets cleared automatically,this is as expected. But after the erase operation, WEL enable command does not work [step 3]. It does not enable WEL (WEL is still 0), so corresponding write operation do not succeed [step 4].

Now, when using IDFv2.1 with same firmware, it works successfully.
If I bypass erase command [step 2] in IDFv2.0 case, it writes data into flash with success.

Any guesses..?? is this problem associated with IDFv2.0 .??

Thanks.

Ritesh
Posts: 1365
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 08, 2017 6:19 pm

ESP_Angus wrote:
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.
Hi,

Sorry for late Reply as I was busy for some of issues into ESP8266 based product.

MOQ for ESP-WROVER-I module is not higher which is approximately 6000 PCs. So, Espressif Systems might be not providing support to make it with 16 MB Flash Memory due to less quantity.

So, Actually purpose for external SPI Flash is below.

1) We are planning to connect 2 different UART based slave controller with them to make it Gateway type product. So, for that we are planning on make it common image for both controller and ESP32 itself which might reach to 1 MB image size. So, we are planning to use OTA with 2 partitions which are also for 1 MB for each partition. And we also need one extra partition to store combined image which also need 1 to 1.5 MB space.

2) We also need some space to store configurations data and databases.

That's why we need at least 8 MB SPI flash for that and we recommended to use bigger 16 MB Flash size for our project.

Hope you will be clear now for our requirements.
Regards,
Ritesh Prajapati

Ritesh
Posts: 1365
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 08, 2017 6:29 pm

Hi ESP_Angus,

We are also planning to use PSRAM as well for our project and we have tried using current ESP32 latest 5.2.0 Windows based toolchain and ESP32 IDF 2.1 but it is not working as it just detected as PSRAM but malloc failed with that PSRAM.

So, would you please let me know that does it require Linux Based Toolchain with patch to use PSRAM?

If yes then would you please let me know when Windows based toolchain will be released by Espressif Systems to get PSRAM support fully functional.

Also, would you please provide Linux Toolchain compilation steps to generate that kind of Toolchain to access PSRAM support.

Please provide your valuable feedback on this ASAP as we are trying on Linux System to compile Toolchain for PSRAM access but facing some issues over there.

I will provide some more details, steps link and issues details tomorrow morning India time.

I will be waiting for you feedback and positive reply in this ASAP.
Regards,
Ritesh Prajapati

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 » Wed Nov 08, 2017 12:55 pm

ESP_Angus wrote:A few other things to note:

Because of the way SPI buses work you can probably keep SPICLK, SPIQ, SPID, SPIHD, SPIWP on the same GPIOs are they are currently using. You only need need to find a new & unused pin for CS0. You will need to set efuses for all these pins anyhow (if one pin is remapped in efuse, then they all need to be remapped).

To set the SPI WP pin assignment, run "make menuconfig", go to "Serial flasher config" and enable QIO or QOUT mode. Then leave that submenu and go into "Bootloader Configuration". There will be a newly visible item "SPI Flash WP Pin when customising pin via efuse...". Set this to the WP pin GPIO number (10 if you are keeping the default pin layout).

If you don't keep SPICLK, SPIQ, SPID, SPIHD & SPIWP pins in the same location then it's likely that the WROVER PSRAM won't work, at least not without code modifications. ESP_Sprite can probably confirm.
Hi Angus,
I interfaced external 16MB flash on the same lines as internal flash is connected except CS0 pin as below with wrover module,

PI_PAD_CONFIG_CLK Override SD_CLK pad (GPIO6/SPICLK) = 6 R/W (0x6)
SPI_PAD_CONFIG_Q Override SD_DATA_0 pad (GPIO7/SPIQ) = 7 R/W (0x7)
SPI_PAD_CONFIG_D Override SD_DATA_1 pad (GPIO8/SPID) = 8 R/W (0x8)
SPI_PAD_CONFIG_HD Override SD_DATA_2 pad (GPIO9/SPIHD) = 9 R/W (0x9)
SPI_PAD_CONFIG_CS0 Override SD_CMD pad (GPIO11/SPICS0) = 33 R/W (0x1f)

I got successfully access to external 16MB flash which operate on 3.3v. But I found different issues with DIO and QIO mode with current master branch.

[*] DIO Mode:
ESP could not complete the boot processing. It crashed when PSRAM is enabled other than that it when PSRAM is disabled it works fine.

[*] QIO Mode:
ESP could complete the booting without any issue with PSRAM enabled but accessing flash gets fails, flash read, write apis doesn't works. If do not enable PSRAM with menuconfig, accessing the flash works fine...


Can you have some suggestions..? can different voltage levels for the external flash (3.3v) as opposed to 1.8v for PSRAM could be a problem..?

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 Nov 09, 2017 9:27 am

Hello,
Can anybody help me with this.? Is it possible for external 3.3v flash to work while the PSRAM works on 1.8v.?
or VDD_SDIO level need to change to 3.3v.? if so, changing VDD_SDIO to 3.3v will work for PSRAM or it will damage it.?

Or it is entirely different issue.?
I will be looking forward to your suggestions.

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

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

Postby loboris » Thu Nov 09, 2017 2:46 pm

You can't expect reliable (if any) operation with two chips operating on different voltage ranges connected to the same pins.
Why don't you use 1.8V SPI Flash? The price is almost the same, and you will avoid all the problems.
And you can just replace the SPI Flash on wrover module instead of adding external chip and disabling the internal one.
I've replaced 4MB SPI Flash chip on my wrover with W25Q128FW 16MB one and it works without problem.

Ritesh
Posts: 1365
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 Nov 10, 2017 4:23 am

loboris wrote:You can't expect reliable (if any) operation with two chips operating on different voltage ranges connected to the same pins.
Why don't you use 1.8V SPI Flash? The price is almost the same, and you will avoid all the problems.
And you can just replace the SPI Flash on wrover module instead of adding external chip and disabling the internal one.
I've replaced 4MB SPI Flash chip on my wrover with W25Q128FW 16MB one and it works without problem.
Hi Loboris,

We are using ESP32-WROVER-I shielded module in which 4 MB internal SPI Flash memory is connected. SO, it seems like we can not directly replace 4 MB SPI Flash Memory with 16 MB Flash Memory except if we will order module with that support. But we don't have that much MOQ.

Would you please suggest us that is there any other way to replace it? or how you have replaced at your side? are you using module or chip?

Do you have any idea to calibrate 3.3 V Flash memory to 1.8V as PSRAM is also working on 1.8V?

Please provide your suggestions for this which will be good for us.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: No registered users and 52 guests