ESP32 PICO D4 - Bootloader reset? - Flash error

Martin1454
Posts: 13
Joined: Wed Oct 04, 2017 6:28 am

ESP32 PICO D4 - Bootloader reset? - Flash error

Postby Martin1454 » Mon Nov 28, 2022 12:54 pm

Hello everyone, and thank you for taking a look at my post.
I'm in a situation where I'm using a custom PCB with an ESP32 PICO D4 on in. The code that have been written for it was made for the ESP32 WROOM module, and after a few paramter changes to fit the PICO D4, I flashed the firmware, and now I cannot connect to the ESP32 correctly anymore. Opening a terminal, I can see the following error

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
I have tried to flash the exact same firmware to a ESP32 Devkit C (WROOM) and it works without any issues there.

I have tried to make a "hello world" sketch and flashed on another PICO D4 board, and it works without issue, so it is not the strapping pins / flash pins.

Right now I cannot flash new firmware to the "corrupt" ESP32 - Is there a way I can "reset" the bootloader so that I can flash new firmware? I have tried flashing with EN and BOOT pins.

My plan is right now to first try to unbrick my ESP, and then try to fix the firmware from WROOM firmware to PICO D4.

Since it is complaining about the SPI flash, I was looking at the schematic of the PICO D4 and the WROOM - And I can see there is a different pinout of the flash. In the PICO, the flash uses CMD, CLK, SD0, SD1 and GPIO 16 + 17, where the WROOM only uses the SD0-SD3,CLK and CMD pins - Could it be here there is an issue with the firmware?

I'm using MS VS code with platformIO as IDE

Thank you for helping!
Last edited by Martin1454 on Wed Nov 30, 2022 9:37 am, edited 1 time in total.

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 PICO D4 - Bootloader reset?

Postby chegewara » Mon Nov 28, 2022 2:30 pm

It looks like the flash is erased and nothing is flashed on it (no bootloader).

Martin1454
Posts: 13
Joined: Wed Oct 04, 2017 6:28 am

Re: ESP32 PICO D4 - Bootloader reset?

Postby Martin1454 » Mon Nov 28, 2022 3:38 pm

chegewara wrote:
Mon Nov 28, 2022 2:30 pm
It looks like the flash is erased and nothing is flashed on it (no bootloader).
What is the recomended way to flash a new bootloader? It looks like there is a few ways to do it

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 PICO D4 - Bootloader reset?

Postby chegewara » Mon Nov 28, 2022 3:50 pm

https://docs.espressif.com/projects/esp ... t-messages
Bootloader is flashed along with the firmware, when you press flash.

You should also try configuration for pico:
https://docs.platformio.org/en/latest/b ... figuration

Martin1454
Posts: 13
Joined: Wed Oct 04, 2017 6:28 am

Re: ESP32 PICO D4 - Bootloader reset?

Postby Martin1454 » Wed Nov 30, 2022 7:17 am

chegewara wrote:
Mon Nov 28, 2022 3:50 pm
https://docs.espressif.com/projects/esp ... t-messages
Bootloader is flashed along with the firmware, when you press flash.

You should also try configuration for pico:
https://docs.platformio.org/en/latest/b ... figuration
The issue I cannot flash the board - I tried again to make the simple "hello world" in arduino and compile it for ESP32 PICO D4, and upload buy I get the error:

Code: Select all

esptool.py v4.2.1
Serial port COM3
Connecting....
Chip is ESP32-PICO-D4 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: e8:9f:6d:09:8e:28
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
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.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x0004afff...
Compressed 17472 bytes to 12125...

A fatal error occurred: Packet content transfer stopped (received 8 bytes)
Failed uploading: uploading error: exit status 2
So it is unable to communicate with the flash chip becasue of missing bootloader - So how would I burn a bootloader if I cannot reach the flash? Most post I find relating flash issues is HW related where SDx pins, GPIO0/2 and MTDI is used wrong, but I have check those multiple times, and since I was able to flash it before, I don't think it is hardware related - GPIO 6-11 is also unused in my design.

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

Re: ESP32 PICO D4 - Bootloader reset?

Postby ESP_Sprite » Wed Nov 30, 2022 8:42 am

That is very likely to be hardware related: it means that the SoC cannot communicate with the (internal) flash. The Pico D4 has a few pads that are also connected to the internal flash and as such marked 'do not use' in the datasheet - IO16, IO17, CMD, CLK, SD0 and SD1 to be specific. You don't happen to have these connected or shorted to something?

Martin1454
Posts: 13
Joined: Wed Oct 04, 2017 6:28 am

Re: ESP32 PICO D4 - Bootloader reset?

Postby Martin1454 » Wed Nov 30, 2022 8:54 am

ESP_Sprite wrote:
Wed Nov 30, 2022 8:42 am
That is very likely to be hardware related: it means that the SoC cannot communicate with the (internal) flash. The Pico D4 has a few pads that are also connected to the internal flash and as such marked 'do not use' in the datasheet - IO16, IO17, CMD, CLK, SD0 and SD1 to be specific. You don't happen to have these connected or shorted to something?

I tried to not connect most of them to anything - Unconnected in this case means floating or solder to pad that is not connected to anything else.

SD0-SD3 Unconnected
CMD, CLK Unconnected
IO16, IO17 Unconnected
IO0 only connected to programmer
IO2 connected to LED Anode (But removed to test if this was the issue)
IO12 (MTDI) connected with pull-down (also tested with this removed)

Any other pins I should be aware of related to this?

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

Re: ESP32 PICO D4 - Bootloader reset? - Flash error

Postby ESP_Sprite » Wed Nov 30, 2022 2:43 pm

Are you sure that those pins got soldered down correctly, as in, aren't shorted under the QFN package or something? If you happen yo have multiple PCBs, you could try putting together another one to see if it also has the issue.

Martin1454
Posts: 13
Joined: Wed Oct 04, 2017 6:28 am

Re: ESP32 PICO D4 - Bootloader reset? - Flash error

Postby Martin1454 » Wed Nov 30, 2022 3:00 pm

ESP_Sprite wrote:
Wed Nov 30, 2022 2:43 pm
Are you sure that those pins got soldered down correctly, as in, aren't shorted under the QFN package or something? If you happen yo have multiple PCBs, you could try putting together another one to see if it also has the issue.
So far we have have testet 4 PCBs where we can flash a small hello world sketch without issue, and then when we try to flash our larger program, then it bricks, and we are not allowed to flash the small hello world sketch back on due to issues seen previously in the post.

I'm not good with the efuses, but I cannot see any issue in them either:

Code: Select all

espefuse.py v4.4
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP32

=== Run "summary" command ===
EFUSE_NAME (Block) Description  = [Meaningful Value] [Readable/Writeable] (Hex Value)
----------------------------------------------------------------------------------------
Calibration fuses:
BLK3_PART_RESERVE (BLOCK0):                        BLOCK3 partially served for ADC calibration data   = False R/W (0b0)
ADC_VREF (BLOCK0):                                 Voltage reference calibration                      = 1114 R/W (0b00010)

Config fuses:
XPD_SDIO_FORCE (BLOCK0):                           Ignore MTDI pin (GPIO12) for VDD_SDIO on reset     = False R/W (0b0)
XPD_SDIO_REG (BLOCK0):                             If XPD_SDIO_FORCE, enable VDD_SDIO reg on reset    = False R/W (0b0)
XPD_SDIO_TIEH (BLOCK0):                            If XPD_SDIO_FORCE & XPD_SDIO_REG                   = 1.8V R/W (0b0)
CLK8M_FREQ (BLOCK0):                               8MHz clock freq override                           = 56 R/W (0x38)
SPI_PAD_CONFIG_CLK (BLOCK0):                       Override SD_CLK pad (GPIO6/SPICLK)                 = 6 R/W (0b00110)
SPI_PAD_CONFIG_Q (BLOCK0):                         Override SD_DATA_0 pad (GPIO7/SPIQ)                = 17 R/W (0b10001)
SPI_PAD_CONFIG_D (BLOCK0):                         Override SD_DATA_1 pad (GPIO8/SPID)                = 8 R/W (0b01000)
SPI_PAD_CONFIG_HD (BLOCK0):                        Override SD_DATA_2 pad (GPIO9/SPIHD)               = 11 R/W (0b01011)
SPI_PAD_CONFIG_CS0 (BLOCK0):                       Override SD_CMD pad (GPIO11/SPICS0)                = 16 R/W (0b10000)
DISABLE_SDIO_HOST (BLOCK0):                        Disable SDIO host                                  = False R/W (0b0)

Efuse fuses:
WR_DIS (BLOCK0):                                   Efuse write disable mask                           = 0 R/W (0x0000)
RD_DIS (BLOCK0):                                   Efuse read disable mask                            = 0 R/W (0x0)
CODING_SCHEME (BLOCK0):                            Efuse variable block length scheme
   = NONE (BLK1-3 len=256 bits) R/W (0b00)
KEY_STATUS (BLOCK0):                               Usage of efuse block 3 (reserved)                  = False R/W (0b0)

Identity fuses:
MAC (BLOCK0):                                      Factory MAC Address
   = e8:9f:6d:09:8e:28 (CRC 0xc1 OK) R/W
MAC_CRC (BLOCK0):                                  CRC8 for factory MAC address                       = 193 R/W (0xc1)
CHIP_VER_REV1 (BLOCK0):                            Silicon Revision 1                                 = True R/W (0b1)
CHIP_VER_REV2 (BLOCK0):                            Silicon Revision 2                                 = False R/W (0b0)
WAFER_VERSION_MINOR (BLOCK0):                      WAFER VERSION MINOR                                = 0 R/W (0b00)
CHIP_PACKAGE (BLOCK0):                             Chip package identifier                            = 5 R/W (0b101)
CHIP_PACKAGE_4BIT (BLOCK0):                        Chip package identifier #4bit                      = 0 R/W (0b0)
MAC_VERSION (BLOCK3):                              Version of the MAC field                           = 0 R/W (0x00)
WAFER_VERSION_MAJOR (BLOCK0):                      calc WAFER VERSION MAJOR from CHIP_VER_REV1 and CH = 1 R/W (0b001)
                                                   IP_VER_REV2 and apb_ctl_date (read only)
PKG_VERSION (BLOCK0):                              calc Chip package = CHIP_PACKAGE_4BIT << 3 + CHIP_ = 5 R/W (0x5)
                                                   PACKAGE (read only)

Security fuses:
FLASH_CRYPT_CNT (BLOCK0):                          Flash encryption mode counter                      = 0 R/W (0b0000000)
UART_DOWNLOAD_DIS (BLOCK0):                        Disable UART download mode (ESP32 rev3 only)       = False R/W (0b0)
FLASH_CRYPT_CONFIG (BLOCK0):                       Flash encryption config (key tweak bits)           = 0 R/W (0x0)
CONSOLE_DEBUG_DISABLE (BLOCK0):                    Disable ROM BASIC interpreter fallback             = True R/W (0b1)
ABS_DONE_0 (BLOCK0):                               Secure boot V1 is enabled for bootloader image     = False R/W (0b0)
ABS_DONE_1 (BLOCK0):                               Secure boot V2 is enabled for bootloader image     = False R/W (0b0)
JTAG_DISABLE (BLOCK0):                             Disable JTAG                                       = False R/W (0b0)
DISABLE_DL_ENCRYPT (BLOCK0):                       Disable flash encryption in UART bootloader        = False R/W (0b0)
DISABLE_DL_DECRYPT (BLOCK0):                       Disable flash decryption in UART bootloader        = False R/W (0b0)
DISABLE_DL_CACHE (BLOCK0):                         Disable flash cache in UART bootloader             = False R/W (0b0)
BLOCK1 (BLOCK1):                                   Flash encryption key
   = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W
BLOCK2 (BLOCK2):                                   Secure boot key
   = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W
BLOCK3 (BLOCK3):                                   Variable Block 3
   = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W

Flash voltage (VDD_SDIO) determined by GPIO12 on reset

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 PICO D4 - Bootloader reset? - Flash error

Postby chegewara » Thu Dec 01, 2022 12:27 am

All logs are suggesting its something with UART (not stable connection, during flashing) or IO12 is not grounded properly, but i may missing something. Are there any pullup on TX/RX, which may help?

Who is online

Users browsing this forum: No registered users and 113 guests