Custom flash memory: "Could not auto-detect Flash size" when flashing

ghozali.hadi
Posts: 2
Joined: Mon May 10, 2021 1:09 pm

Custom flash memory: "Could not auto-detect Flash size" when flashing

Postby ghozali.hadi » Mon May 10, 2021 1:19 pm

Hi all,
I'm developing a custom esp32 board with different flash memory. I'm using AT45DB641E (64-Mbits = 8MB) flash memory. I'm using Arduino IDE and it keeps showing that the flash memory size is not recognized while the ID seems detected (image attached).
I have done the GPIO0 trick as well as GPIO2 trick by connecting it to the GND during uploading firmware.
Could you help me to figure out this problem?

Thanks in advance,
Ghozali
Attachments
image_2021_05_10T09_26_16_956Z.png
Error message
image_2021_05_10T09_26_16_956Z.png (45.55 KiB) Viewed 8564 times

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

Re: Custom flash memory: "Could not auto-detect Flash size" when flashing

Postby ESP_Angus » Wed May 12, 2021 4:09 am

Hi Ghozali,

According to the datasheet for the AT45DB641E flash chip (Table 12-1) this is the correct JEDEC ID returned by this flash chip. There's no rule that says the ID has to encode the flash size, it's just that all of the chips currently supported by ESP32 do this so we use it.

In esptool.py you can override the flash size by passing it as a command line argument instead of having esptool.py detect it.

It looks like esptool is not crashing because of the flash id (it ignores this and continues to try and write to the chip), however it's crashing because this chip doesn't behave as expected when writing data to flash. There is no common standard for SPI NOR flash chips, so they don't all respond to the same commands and many of them have subtle differences. I don't believe anyone has successfully used AT45DB641E with ESP32 before.

I don't know why writing to flash isn't working, but the datasheet shows that this chip only supports standard "single SPI" read commands and not any Dual or Quad read modes. This means that even if you can somehow flash it with esptool.py, you won't be able to boot the ESP32 from it as ESP-IDF only supports these modes. Sorry to be the bearer of bad news.

ghozali.hadi
Posts: 2
Joined: Mon May 10, 2021 1:09 pm

Re: Custom flash memory: "Could not auto-detect Flash size" when flashing

Postby ghozali.hadi » Thu May 13, 2021 10:01 am

Hi ESP_Angus,
Thanks for your reply. So basically AT45DB641E can only be used as an additional flash memory with common SPI communication. Am I right?

Regards,
Ghozali S. Hadi

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

Re: Custom flash memory: "Could not auto-detect Flash size" when flashing

Postby ESP_Angus » Fri May 14, 2021 12:05 am

That's right, it should definitely work fine if you use the SPI driver to send commands to it manually for read/write/erase/etc.

It may also be possible to use the "secondary SPI flash" support in the spi_flash driver to talk to it via SPI flash APIs. However as it seems like there is something different in the commands used when writing to the chip, it's possible this won't work as-is. It is technically possible to write a new chip driver for this chip's specific "quirks", and then use it as external storge via the SPI flash APIs. If you're feeling adventurous then take a look in the spi_flash component for examples of existing flash chip drivers.

MANGUKIA
Posts: 24
Joined: Thu Apr 12, 2018 4:21 am
Location: Surat
Contact:

Re: Custom flash memory: "Could not auto-detect Flash size" when flashing

Postby MANGUKIA » Sun Aug 22, 2021 6:16 pm

I got the same issue Can you please check it because I don't get any proper response over this forum Maybe flash issue.


https://www.esp32.com/viewtopic.php?f=2&t=22813

Mohmaa
Posts: 1
Joined: Tue Jun 14, 2022 1:23 pm

Re: Custom flash memory: "Could not auto-detect Flash size" when flashing

Postby Mohmaa » Tue Jun 14, 2022 1:30 pm

I had the same issue,
I used an external power supply (modified usb cable on another usb port on my laptop) to all the attached modules and it worked perfectly

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot] and 121 guests