idf.py 下载程序,MD5不匹配导致下载失败

shenqw
Posts: 2
Joined: Mon Mar 16, 2020 5:08 pm

idf.py 下载程序,MD5不匹配导致下载失败

Postby shenqw » Mon Mar 16, 2020 5:21 pm

sqw@ubuntu:~/esp/hello_world$ idf.py flash
Checking Python dependencies...
Python requirements from /home/sqw/esp/esp-idf-v4.0/requirements.txt are satisfied.
Adding flash's dependency "all" to list of actions
Executing action: all (aliases: build)
Running ninja in directory /home/sqw/esp/hello_world/build
Executing "ninja all"...
[1/3] Performing build step for 'bootloader'
ninja: no work to do.
Executing action: flash
Choosing default port b'/dev/ttyUSB0' (use '-p PORT' option to set a specific serial port)
Running esptool.py in directory /home/sqw/esp/hello_world/build
Executing "/usr/bin/python /home/sqw/esp/esp-idf-v4.0/components/esptool_py/esptool/esptool.py -p /dev/ttyUSB0 -b 460800 --before default_reset --after hard_reset write_flash @flash_project_args"...
esptool.py -p /dev/ttyUSB0 -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x10000 hello-world.bin
esptool.py v2.8
Serial port /dev/ttyUSB0
Connecting........__
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 0)
Features: WiFi, BT, Dual Core, Coding Scheme None
Crystal is 40MHz
MAC: 30:ae:a4:00:1c:ac
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Compressed 3072 bytes to 103...
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 4491.3 kbit/s)...
File md5: 5d61d196adc3dba01928f264eb169be7
Flash md5: 1cbd8b1afbfa4df8a7b1e1800ea4c8c5
MD5 of 0xFF is 988a096f6bee866b744ec2be0247ba9e

A fatal error occurred: MD5 of file does not match data in flash!
esptool.py failed with exit code 2



idf输出如上所示,我用的是ESP32比较早的开发板,是ESP32-S,最开始能够下载运行,后来运行spi receiver 历程并修改代码后出现此情况。
Attachments
idf-err.png
idf-err.png (132.91 KiB) Viewed 5433 times

06userit
Posts: 5
Joined: Tue Jan 19, 2021 6:02 am

Re: idf.py 下载程序,MD5不匹配导致下载失败

Postby 06userit » Tue Jan 19, 2021 6:37 am

As indicated here
https://forum.m5stack.com/topic/838/a-f ... a-in-flash
I managed to solve error "A fatal error occurred: MD5 of file does not match data in flash!" with following WRITE FLASH command :
esptool.py --port <YOUR PORT> write_flash_status --non-volatile 0

1) BEFORE activating WRITE FLASH command, upload to ESP32 generates error :

[...]
Hash of data verified.
Compressed 229344 bytes to 112708...
Wrote 229344 bytes (112708 compressed) at 0x00010000 in 1.6 seconds (effective 1161.2 kbit/s)...
File md5: e68beba9df55b1cadc51a9c4b44004c0
Flash md5: 12b54d37dda6d321d283034959c4b6d2
MD5 of 0xFF is e14ab325b06643bd719d9f0fe4beae74
A fatal error occurred: MD5 of file does not match data in flash!
A fatal error occurred: MD5 of file does not match data in flash!


2) WRITE FLASH
Using Arduino IDE (ESP32 WRover module), under Windows 10, so exact commands for WRITE FLASH are :
cd C:\Users\<YOUR NAME>\esp\components\esptool_py\esptool
python esptool.py --port COM12 write_flash_status --non-volatile 0
esptool.py v2.9-dev
Serial port COM12
Connecting....
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: ac:67:b2:2a:a7:c0
Uploading stub...
Running stub...
Stub running...
Initial flash status: 0x4200
Setting flash status: 0x0000
After flash status: 0x0000
Hard resetting via RTS pin...



3) AFTER WRITE FLASH command, upload to ESP32 is OK, error is no longer generated
[...]
Hash of data verified.
Leaving...
Hard resetting via RTS pin.
..

4) READ FLASH (OPTIONAL)
it is also possible to get flash_status with READ FLASH command :
cd C:\Users\<YOUR NAME>\esp\components\esptool_py\esptool
python esptool.py --port COM12 read_flash_status
esptool.py v2.9-dev
Serial port COM12
Connecting....
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: ac:67:b2:2a:a7:c0
Uploading stub...
Running stub...
Stub running...
Status value: 0x0200
Hard resetting via RTS pin...

OllieK
Posts: 58
Joined: Mon Jan 18, 2016 8:08 am
Location: USA, PA
Contact:

Re: idf.py 下载程序,MD5不匹配导致下载失败

Postby OllieK » Wed Jan 20, 2021 1:21 am

There can be several reasons for this error message. In my setup, I am seeing this error message quite often. In all those cases it is related to the JTAG debugger. After I have disconnect and reconnect the debugger USB cable, the problem goes away.

I have not been able to determine why and when the debugger interferes with the flashing process.

Who is online

Users browsing this forum: No registered users and 71 guests