Cannot program ESP32-U4WDH Flash, flash not detected.

Stef_Esp32
Posts: 6
Joined: Tue Jun 21, 2022 9:26 pm

Cannot program ESP32-U4WDH Flash, flash not detected.

Postby Stef_Esp32 » Tue Jun 21, 2022 9:39 pm

On a board with a ESP32-U4WDH mcu, I cannot program the the embedded flash. The board used to be populated with a ESP32-D2WD and there programming worked as it should.

As recommended in the datasheet, GPIO16, GPIO17, SD_CMD, SD_CL, SD_DATA_0 and SD_DATA_1 have no external connection.

I already upgraded to the latest stable idf-tools (4.4.1), but programming keeps failing. It seems there is no communication with the flash.

Output of: esptool.py --port COM7 flash_id
esptool.py v3.3-dev
Serial port COM7
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting...
Detecting chip type... ESP32
Chip is ESP32-U4WDH (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 94:b5:55:52:e2:78
Uploading stub...
Running stub...
Stub running...
WARNING: Failed to communicate with the flash chip, read/write operations will fail. Try checking the chip connections or removing any other hardware connected to IOs.
Manufacturer: ff
Device: ffff
Detected flash size: Unknown
Hard resetting via RTS pin...

What can I do to fix this? Any ideas?

Regards,
Stef
--
Stef

Stef_Esp32
Posts: 6
Joined: Tue Jun 21, 2022 9:26 pm

Re: Cannot program ESP32-U4WDH Flash, flash not detected.

Postby Stef_Esp32 » Wed Jun 22, 2022 11:17 am

In the mean time I have found one possible cause:

Pin MTDI (strapping pin) is pulled to 3.3V on this board, this means VDD_SDIO is connected to the 1.8V LDO.

In the datasheet, in the recommended operating conditions, it says the minimum operation voltage for VDD_SDIO (3.3V mode) is 2.3V for parts with no embedded flash and 3.0V for parts with 3.3V embedded flash.

This raises some questions, I hope anyone can answer:
1) Is this a likely cause for the problem I see?
2) Why is there no specification for VDD_SDIO (1.8 V mode)?
3) Is embedded flash always 3.3V?
4) Why did this work with the ESP32-D2WD?
5) Should I connect and external 3.3V or pull MTDI low?

I think I found the answer to 3) and 4) in an older version of the datasheet (version 3.1):
• ESP32-U4WDH (with a 3.3 V flash embedded): this minimum voltage is 3.0 V;
• ESP32-D2WD (with a 1.8 V flash embedded) and other chips (no flash): this minimum voltage is 2.3 V;

There is no recommended operating voltage spec for the flashes in the datasheet. From what I see, I would say the D2WD flash can handle at least 1.8V - 3.6V and the U4WDH flash 3.0V - 3.6V. Would be nice to mention this explicitly in the datasheet.

I will proceed with either pulling MTDI low or connecting 3.3V to VDD_SDIO for test for now. Whichever is easiest to patch on the board.

Regards,

Stef
--
Stef

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

Re: Cannot program ESP32-U4WDH Flash, flash not detected.

Postby ESP_Sprite » Wed Jun 22, 2022 2:39 pm

Note that a third option is to burn an eFuse to fix the flash voltage, independent of the bootstrap pins.

Stef_Esp32
Posts: 6
Joined: Tue Jun 21, 2022 9:26 pm

Re: Cannot program ESP32-U4WDH Flash, flash not detected.

Postby Stef_Esp32 » Wed Jun 22, 2022 3:48 pm

Thanks, I was not aware of that option.

I had already wired the 3.3V to VDD_SDIO and that solved the flash problem.
Now I removed the wire and burnt these fuses to 1

XPD_SDIO_FORCE Ignore MTDI pin (GPIO12) for VDD_SDIO on reset = 1 R/W (0x1)
XPD_SDIO_REG If XPD_SDIO_FORCE, enable VDD_SDIO reg on reset = 1 R/W (0x1)
XPD_SDIO_TIEH If XPD_SDIO_FORCE & XPD_SDIO_REG, 1=3.3V 0=1.8V = 1 R/W (0x1)

First I tried without XPD_SDIO_REG as 3.3V would not require the (1.8V) regulator but that did not work. But with all 3 set to 1, I have 3.3V on VDD_SDIO without an external wire. Much better. :-)

Re-tested flash programming after this and that was OK as well.
So all solved. Thanks for listening and for your help.
--
Stef

nullbert
Posts: 15
Joined: Sun May 29, 2022 5:31 pm

Re: Cannot program ESP32-U4WDH Flash, flash not detected.

Postby nullbert » Fri Jun 24, 2022 5:31 pm

This piqued my interest. I couldn't find anywhere in the datasheet - or in the technical reference manual, or hardware integration guide - any mention of GPIO16, GPIO17 recommending not being connected for flashing firmware.

Right now I have these connected to a button and used as an output to an LCD (not an input to the ESP32).

What are the specific details around this constraint? TIA!

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

Re: Cannot program ESP32-U4WDH Flash, flash not detected.

Postby ESP_Sprite » Fri Jun 24, 2022 11:53 pm

nullbert wrote:
Fri Jun 24, 2022 5:31 pm
This piqued my interest. I couldn't find anywhere in the datasheet - or in the technical reference manual, or hardware integration guide - any mention of GPIO16, GPIO17 recommending not being connected for flashing firmware.
[...]
What are the specific details around this constraint? TIA!
It depends on the chip itself. Because of pad layout reasons, some ESP32 chips with internal flash use GPIO16/17 as signal pins, in which case it's better not to use them. Also, if you use PSRAM, these pins are occupied. If your design has a (module with an) ESP32 with external flash and no psram, GPIO16/17 are available for your use.

Who is online

Users browsing this forum: No registered users and 51 guests