espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.77k stars 7.31k forks source link

esp_image: Checksum failed. (IDFGH-8043) #9547

Open hipal31 opened 2 years ago

hipal31 commented 2 years ago

Environment

Problem Description

I'm getting esp_image: Checksum failed. error during boot of controller. I did OTA using esp_https_ota and after successful upgrade device was working properly. But after 2 months I got this error that controller can't boot due to checksum failed. And out of 100 devices 4 devices are getting this kind of error. Which means it's hard to reproduce this.

Expected Behavior

It should work properly even after 2-3 months or a year.

Actual Behavior

After 2-3 months it's getting checksum failed error during boot.

Debug Logs

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d153a
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x1944
load:0x403ce000,len:0x8d4
load:0x403d0000,len:0x2dc0
entry 0x403ce000
I (35) boot: ESP-IDF v4.3.2-dirty 2nd stage bootloader
I (35) boot: compile time 16:52:33
I (35) boot: chip revision: 3
I (37) boot_comm: chip revision: 3, min. bootloader chip revision: 2
I (44) boot.esp32c3: SPI Speed      : 80MHz
I (49) boot.esp32c3: SPI Mode       : DIO
I (54) boot.esp32c3: SPI Flash Size : 4MB
I (58) boot: Enabling RNG early entropy source...
I (64) boot: Partition Table:
I (67) boot: ## Label            Usage          Type ST Offset   Length
I (75) boot:  0 sec_cert         unknown          3f 06 0000d000 00003000
I (82) boot:  1 nvs              WiFi data        01 02 00010000 00006000
I (90) boot:  2 otadata          OTA data         01 00 00016000 00002000
I (97) boot:  3 phy_init         RF data          01 01 00018000 00001000
I (105) boot:  4 ota_0            OTA app          00 10 00020000 001c2000
I (112) boot:  5 ota_1            OTA app          00 11 001f0000 001c2000
I (120) boot:  6 fctry            WiFi data        01 02 003b2000 00006000
I (127) boot: End of partition table
I (132) boot_comm: chip revision: 3, min. application chip revision: 2
I (139) esp_image: segment 0: paddr=00020020 vaddr=3c130020 size=43074h (274548) map
I (188) esp_image: segment 1: paddr=0006309c vaddr=3fc90000 size=0580ch ( 22540) load
I (193) esp_image: segment 2: paddr=000688b0 vaddr=40380000 size=07768h ( 30568) load
I (200) esp_image: segment 3: paddr=00070020 vaddr=42000020 size=12ec08h (1240072) map
I (389) esp_image: segment 4: paddr=0019ec30 vaddr=40387768 size=086d8h ( 34520) load
I (395) esp_image: segment 5: paddr=001a7310 vaddr=50000000 size=00010h (    16) load
E (396) esp_image: Checksum failed. Calculated 0x12 read 0x32
E (401) boot: OTA app partition slot 0 is not bootable
E (407) esp_image: image at 0x1f0000 has invalid magic byte (nothing flashed here?)
E (415) boot: OTA app partition slot 1 is not bootable
E (421) boot: No bootable app partitions in the partition table
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d153a
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x1944
load:0x403ce000,len:0x8d4
load:0x403d0000,len:0x2dc0
entry 0x403ce000
I (35) boot: ESP-IDF v4.3.2-dirty 2nd stage bootloader
I (35) boot: compile time 16:52:33
I (35) boot: chip revision: 3
I (37) boot_comm: chip revision: 3, min. bootloader chip revision: 2
I (44) boot.esp32c3: SPI Speed      : 80MHz
I (49) boot.esp32c3: SPI Mode       : DIO
I (54) boot.esp32c3: SPI Flash Size : 4MB
I (58) boot: Enabling RNG early entropy source...
I (64) boot: Partition Table:
I (67) boot: ## Label            Usage          Type ST Offset   Length
I (75) boot:  0 sec_cert         unknown          3f 06 0000d000 00003000
I (82) boot:  1 nvs              WiFi data        01 02 00010000 00006000
I (90) boot:  2 otadata          OTA data         01 00 00016000 00002000
I (97) boot:  3 phy_init         RF data          01 01 00018000 00001000
I (105) boot:  4 ota_0            OTA app          00 10 00020000 001c2000
I (112) boot:  5 ota_1            OTA app          00 11 001f0000 001c2000
I (120) boot:  6 fctry            WiFi data        01 02 003b2000 00006000
I (127) boot: End of partition table
I (132) boot_comm: chip revision: 3, min. application chip revision: 2
I (139) esp_image: segment 0: paddr=00020020 vaddr=3c130020 size=43074h (274548) map
I (188) esp_image: segment 1: paddr=0006309c vaddr=3fc90000 size=0580ch ( 22540) load
I (193) esp_image: segment 2: paddr=000688b0 vaddr=40380000 size=07768h ( 30568) load
I (200) esp_image: segment 3: paddr=00070020 vaddr=42000020 size=12ec08h (1240072) map
I (389) esp_image: segment 4: paddr=0019ec30 vaddr=40387768 size=086d8h ( 34520) load
I (395) esp_image: segment 5: paddr=001a7310 vaddr=50000000 size=00010h (    16) load
E (396) esp_image: Checksum failed. Calculated 0x12 read 0x32
E (401) boot: OTA app partition slot 0 is not bootable
E (407) esp_image: image at 0x1f0000 has invalid magic byte (nothing flashed here?)
E (415) boot: OTA app partition slot 1 is not bootable
E (421) boot: No bootable app partitions in the partition table
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d153a
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x1944
load:0x403ce000,len:0x8d4
load:0x403d0000,len:0x2dc0
entry 0x403ce000
I (35) boot: ESP-IDF v4.3.2-dirty 2nd stage bootloader
I (35) boot: compile time 16:52:33
I (35) boot: chip revision: 3
I (37) boot_comm: chip revision: 3, min. bootloader chip revision: 2
I (44) boot.esp32c3: SPI Speed      : 80MHz
I (49) boot.esp32c3: SPI Mode       : DIO
I (54) boot.esp32c3: SPI Flash Size : 4MB
I (58) boot: Enabling RNG early entropy source...
I (64) boot: Partition Table:
I (67) boot: ## Label            Usage          Type ST Offset   Length
I (75) boot:  0 sec_cert         unknown          3f 06 0000d000 00003000
I (82) boot:  1 nvs              WiFi data        01 02 00010000 00006000
I (90) boot:  2 otadata          OTA data         01 00 00016000 00002000
I (97) boot:  3 phy_init         RF data          01 01 00018000 00001000
I (105) boot:  4 ota_0            OTA app          00 10 00020000 001c2000
I (112) boot:  5 ota_1            OTA app          00 11 001f0000 001c2000
I (120) boot:  6 fctry            WiFi data        01 02 003b2000 00006000
I (127) boot: End of partition table
I (132) boot_comm: chip revision: 3, min. application chip revision: 2
I (139) esp_image: segment 0: paddr=00020020 vaddr=3c130020 size=43074h (274548) map
I (188) esp_image: segment 1: paddr=0006309c vaddr=3fc90000 size=0580ch ( 22540) load
I (193) esp_image: segment 2: paddr=000688b0 vaddr=40380000 size=07768h ( 30568) load
I (200) esp_image: segment 3: paddr=00070020 vaddr=42000020 size=12ec08h (1240072) map
I (389) esp_image: segment 4: paddr=0019ec30 vaddr=40387768 size=086d8h ( 34520) load
I (395) esp_image: segment 5: paddr=001a7310 vaddr=50000000 size=00010h (    16) load
E (396) esp_image: Checksum failed. Calculated 0x12 read 0x32
E (401) boot: OTA app partition slot 0 is not bootable
E (407) esp_image: image at 0x1f0000 has invalid magic byte (nothing flashed here?)
E (415) boot: OTA app partition slot 1 is not bootable
E (421) boot: No bootable app partitions in the partition table

Other items if possible

hipal31 commented 2 years ago

Can anyone help?

hipal31 commented 2 years ago

@JiaLWang Can you please help me or connect with the right person for this issue?

JiaLWang commented 2 years ago

Hi Hipal, Is it using wifi OTA?

hipal31 commented 2 years ago

@JiaLWang yes it is using wifi ota. But problem occurs without ota as well with new code flashed.

JiaLWang commented 2 years ago

@Alvin1Zhang Would you please help with it? Thanks.

hipal31 commented 2 years ago

@JiaLWang @Alvin1Zhang Please look into the problem

hipal31 commented 1 year ago

@Alvin1Zhang Can you please help me with this?

ginkgm commented 1 year ago

@hipal31

firstly please help read out the flash ID and the status register when the device is broken, and post it here:

  1. install & export in IDF
  2. run esptool.py flash_id
  3. run esptool.py read_flash_status

and then do you have enough broken devices? if so, please try if re-flash the device can make it work again. (to see if this is a irreversible issue)

Michael

hipal31 commented 1 year ago

@ginkgm Thanks for the reply.

Until now I received 15 devices with same issue. I did re-flash the device and kept it for testing. After re-flashing It's working.

Right now I don't have broken device at present with the issue to read flash id. I'll send once I receive a new broken device.

Regards, Hipal

hipal31 commented 1 year ago

@hipal31

firstly please help read out the flash ID and the status register when the device is broken, and post it here:

  1. install & export in IDF
  2. run esptool.py flash_id
  3. run esptool.py read_flash_status

and then do you have enough broken devices? if so, please try if re-flash the device can make it work again. (to see if this is a irreversible issue)

Michael

Hi @ginkgm , Recently I received a broken device, in which

  1. After running esptool.py flash_id command, result is :

    Connecting....
    Detecting chip type... ESP32-C3
    Chip is ESP32-C3 (revision 3)
    Features: Wi-Fi
    Crystal is 40MHz
    MAC: 34:b4:72:4f:25:3c
    Uploading stub...
    Running stub...
    Stub running...
    Manufacturer: 20
    Device: 4016
    Detected flash size: 4MB
    Hard resetting via RTS pin...
  2. After running esptool.py read_flash_status command, result is :

    Connecting...
    Detecting chip type... ESP32-C3
    Chip is ESP32-C3 (revision 3)
    Features: Wi-Fi
    Crystal is 40MHz
    MAC: 34:b4:72:4f:25:3c
    Stub is already running. No upload is necessary.
    Status value: 0x0200
    Hard resetting via RTS pin...
  3. After that I run idf.py erase-flash and idf.py flash commands to re-flash module and it's working fine after re-flashing.

Please let me know if anything needs to be performed at my side and help me find out solution.

Regards, Hipal

hipal31 commented 1 year ago

@ginkgm please look into the issue.

ginkgm commented 1 year ago

@hipal31 ,

This looks like a random and tricky problem, which may be related to many factors (power supply, PCB, SW, or the flash itself). We have a team dealing with this kind of issues. Please help raise a ticket here:

https://cqms.espressif.com/ticker/add

Please also include this Github issue in the ticket, and our support team will contact with you.

hipal31 commented 1 year ago

@ginkgm I have raised a support ticket.