So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Demin
#72200 Hi.
I'm new to electronics and ESP8266 and I am sorry for this huge post but I want to understand what I did wrong because I want to play with ESP8266 more and don't want to kill more chips for reason I don't know.

My hardware:
ESP-12F
Home-made board with sensors and relay to play with (photo: https://i.imgur.com/Ie80oIK.jpg )
LM317 voltage regulator configured to ~3.25V but for this post I used external home-made regulated power supply configured to ~3.4V
I soldered 220uF and 100nF capacitors near power input for this post
Relay have diode to protect board from voltage spikes under board, I use "1N4001" diode, but maybe its too slow and voltage spikes got to ESP8266.
But on other hand my problems started before I clicked relay for first time.

So my story sounds like this:
About half year ago I made that board and flashed it with NodeMCU. It was great until I configured WiFi and rebooted it. It entered infinity reboot with random errors (you can see them below) (not NodeMCU syntax errors).
I thought I killed it, but after re-flash same code was working fine.
It was running for about a week and clicking relay thousands of times and it was great. But every time I change some file there was risk entering infinity reboot or random garbage/error.
Re-flashing was helping for some time, but few days ago I again started to play with board and it died after some file changes and reboot.
Now I can not reflash it anymore.

I have "nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin" that was working before.
So I try to flash it:
Code: Select all# esptool write_flash 0x0 nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0240
Compressed 609104 bytes to 399502...
Wrote 609104 bytes (399502 compressed) at 0x00000000 in 35.8 seconds (effective 136.1 kbit/s)...
File  md5: 1594477986b73266ec8ccc5c4448349e
Flash md5: 0cbcace321deb1e51c306eeec9cfb03e
MD5 of 0xFF is 31e6a3e8a4f4fc92aa8e83a99614718e

A fatal error occurred: MD5 of file does not match data in flash!


Again:
Code: Select all<skipped first part>
File  md5: 1594477986b73266ec8ccc5c4448349e
Flash md5: a8e45ef8c096f10c602d49a5ac3044ef
MD5 of 0xFF is 31e6a3e8a4f4fc92aa8e83a99614718e

A fatal error occurred: MD5 of file does not match data in flash!


Again:
Code: Select all<skipped first part>
File  md5: 1594477986b73266ec8ccc5c4448349e
Flash md5: c5278f2138a2664837934ff7598b0566
MD5 of 0xFF is 31e6a3e8a4f4fc92aa8e83a99614718e

A fatal error occurred: MD5 of file does not match data in flash!


Again:
Code: Select all<skipped first part>
File  md5: 1594477986b73266ec8ccc5c4448349e
Flash md5: ba96260c06067360080f22fd6ffd4256
MD5 of 0xFF is 31e6a3e8a4f4fc92aa8e83a99614718e

A fatal error occurred: MD5 of file does not match data in flash!


Again:
Code: Select all# esptool write_flash 0x0 nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0240
Compressed 609104 bytes to 399502...
Wrote 609104 bytes (399502 compressed) at 0x00000000 in 35.8 seconds (effective 136.2 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...

Now I reboot and look in serial console at speed 115200

Reboot:
Code: Select allepc1=0x402165d2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0xba
csum 0xba
Fatal exception 0(IllegalInstructionCause):
epc1=0x402165d2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0xba
csum 0xba
Fatal exception 28(LoadProhibitedCause):
epc1=0x4021835a, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0xba
csum 0xba
Fatal exception 0(IllegalInstructionCause):
epc1=0x402165d2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0xba
csum 0xba

And stops. Current is 0.14A at 3.35V

Reboot again:
Code: Select allepc1=0x4021c2f0, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00040380, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
ch su um 0Fatal exception 0(IllegalInstructionCause):
epc1=0x402165d2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0xba
csum 0xba
Fatal exception 0(IllegalInstructionCause):
epc1=0x402165d2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0xba
csum 0xba
‚‚nlњr’‚nnnЊ blnа|~nм nћвr’r’brlrl ‚ Њl мв‚blњrbl  blњrrl  blњrв‚‚b’  Њl‚b њвЂr’  l`rl
epc1=0x402165d2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0xba
csum 0xba
Fatal exception 0(IllegalInstructionCause):
epc1=0x60000200, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0xba
csum 0xba
Fatal exception 0(IllegalInstructionCause):
epc1=0x402165d2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0xba
csum 0xba
Fatal exception 0(IllegalInstructionCause):
epc1=0x402165d2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0xba
csum 0xba
Fatal exception 0(IllegalInstructionCause):
epc1=0x402165d2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0xba
csum 0xba
Fatal exception 0(IllegalInstructionCause):
epc1=0x60000200, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0xba
csum 0xba
Fatal exception 28(LoadProhibitedCause):
epc1=0x4021c2f0, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00040380, depc=0x00000000
я
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 27016, room 16
tail 8
chksum 0xed
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0xf2
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0xba
csum 0xba

And stops. Current is 0.18A at 3.35V

And again:
Code: Select all<did not catch first part but then there is infinite flood of:>
epc1=0x40210dd2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
Fatal exception (0):
epc1=0x40210dd2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
Fatal exception (0):
epc1=0x40210dd2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
Fatal exception (0):
epc1=0x40210dd2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
Fatal exception (0):
epc1=0x40210dd2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
Fatal exception (0):
epc1=0x40210dd2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
Fatal exception (0):
epc1=0x40210dd2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
Fatal exception (0):
epc1=0x40210dd2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
Fatal exception (0):
epc1=0x40210dd2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
Fatal exception (0):
epc1=0x40210dd2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
Fatal exception (0):
epc1=0x40210dd2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4028f35a, depc=0x00000000
Fatal exception (0):

And stops. Current is 0.15A at 3.36V

And again:
Code: Select all<random garbage that I can't copy, here is screenshot https://i.imgur.com/p9Bg3EF.png>

And stops. Current is 0.06A at 3.36V

So I get random results on every reboot.
But even with MD5 error I can get this after few reboots
Code: Select allFormatting file system. Please wait...

 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x40100000, len 27016, room 16
tail 8
chksum 0x6d
load 0x3ffe8000, len 2400, room 0
tail 0
chksum 0x72
load 0x3ffe8960, len 136, room 8
tail 0
chksum 0x3a
csum 0x3a
csum err
ets_main.c

But it not helps, still no success. And "Formatting file system. Please wait..." can repeat after reboots, so I think it fails to format.

Now I want to try to read flash 20 times.
Code: Select all# esptool read_flash 0 609104 nodemcu_dumps/dump_1.bin
# esptool read_flash 0 609104 nodemcu_dumps/dump_2.bin
.....
# esptool read_flash 0 609104 nodemcu_dumps/dump_20.bin


I saw errors:
Code: Select all# esptool read_flash 0 609104 nodemcu_dumps/dump_10.bin
esptool.py v2.0.1
Connecting........
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
81920 (13 %)
A fatal error occurred: Timed out waiting for packet header

Code: Select allesptool read_flash 0 609104 nodemcu_dumps/dump_12.bin
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
217088 (35 %)
A fatal error occurred: Timed out waiting for packet header


Now MD5:
Code: Select all$ md5sum ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin
8230c2a80d9d644bd91a7ac8753260a2  ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin

nodemcu_dumps]$ md5sum *
1594477986b73266ec8ccc5c4448349e  dump_10.bin
1594477986b73266ec8ccc5c4448349e  dump_11.bin
eb6c36bd30ef8eef4ec33f58fc78be99  dump_12.bin
6f0e07cb93587c297f747a4e95736410  dump_13.bin
e7c509f564e9203debc30eb1d905c5df  dump_14.bin
97941c67f0ebb3a4ff0d374a86e5ecb7  dump_15.bin
3bbdf2af7d0a1e451f51705f1f63d8e2  dump_16.bin
ba96260c06067360080f22fd6ffd4256  dump_17.bin
64f602ad6f2e21886eaa413384fa8c86  dump_18.bin
ba96260c06067360080f22fd6ffd4256  dump_19.bin
fefd7d59816d5f7af3c2c4c109d82355  dump_1.bin
67bf6cffb8192cece08d7277d7dfbcac  dump_20.bin
e7c509f564e9203debc30eb1d905c5df  dump_2.bin
1594477986b73266ec8ccc5c4448349e  dump_3.bin
573c757660d9552d937083b95d3f79ea  dump_4.bin
d7b5cd2b20b7c2920ee407437c94b783  dump_5.bin
0ea30d062f4214b259af43de8bdcdeaa  dump_6.bin
b80b1ec5e7bf9a1215a56e7289476ee8  dump_7.bin
2391d06a3db5c78b8e3146ae8ee9556e  dump_8.bin
fcb86f24c4013eb80d2016703fefa9ef  dump_9.bin

Sooo... Uhm...

Diff:
(command found in google)
Code: Select all$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_1.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
0005D008 56 D6
0006F008 52 D2
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_2.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
00059007 32 33
0006F008 52 D2
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_3.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_4.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
0007B005 28 29
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_4.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
0007B005 28 29
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_5.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
00030008 03 83
00059007 32 33
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_6.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
00059007 32 33
0007C00A 7A FA
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_7.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
00059007 32 33
00060007 2A 2B
00073007 CA CB
00083008 78 F8
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_8.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
00059007 32 33
00078005 78 79
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_9.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
0004B005 0C 0D
0005D008 56 D6
00061007 00 01
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_10.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_11.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_12.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
00059007 32 33
0005D008 56 D6
00065005 22 23
00079005 18 19
0007B005 28 29
0007C005 46 47
00083008 78 F8
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_13.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
00059007 32 33
0007C005 46 47
0008100A 40 C0
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_14.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
00059007 32 33
0006F008 52 D2
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_15.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
0004B005 0C 0D
00059007 32 33
0006B00A 13 93
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_16.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
0001C008 05 85
00059007 32 33
00065005 22 23
0006E008 38 B8
00073007 CA CB
00078005 78 79
00078008 55 D5
0007B005 28 29
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_17.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
00059007 32 33
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_18.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
00059007 32 33
00065005 22 23
00079005 18 19
0007C00D 78 79
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_19.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
00059007 32 33
$ cmp -l ../nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin dump_20.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
00000004 00 40
00040008 70 F0
0004E005 18 19
00065005 22 23

For some reason all corrupted addresses have x00x at address. That should mean something. Maybe.
In all dumps 00000004 changed from 0x00 to 0x40
I attempted to flash 4 byte file with bytes from original nodemcu .bin file but something erased 0x5-0xFFF with zeros, but 0x0-0x4 was fine and 0x4 was not changed this time.
Interesting.
So I generated random file
Code: Select alldd if=/dev/urandom of=random.bin bs=1 count=609104

And 2 times got MD5 error.
So flash is dead.
...or not?

I made 16 files 609104 bytes each.
First filled with 0x00 0x00 0x00...
Second filled with 0x11 0x11 0x11...
...
Last filled with 0xFF 0xFF 0xFF...

Flashing is 0.1 second due to compression and no MD5 errors.
And reading is 54.7 seconds (as always)

One time I managed to get error
Code: Select all$ sudo esptool read_flash 0 609104 0xBB_dump.bin
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
536576 (88 %)
A fatal error occurred: Timed out waiting for packet heade


But after everything is done, all MD5 matched.
Code: Select all$ md5sum *
e11a8da12d26d9d9d3c7d3553d5a9a72  0x00.bin
e11a8da12d26d9d9d3c7d3553d5a9a72  0x00_dump.bin
e7cd81833d4297a63bb990c134780f4c  0x11.bin
e7cd81833d4297a63bb990c134780f4c  0x11_dump.bin
86b80fd5c3eb05b2f3b3d300421691f7  0x22.bin
86b80fd5c3eb05b2f3b3d300421691f7  0x22_dump.bin
98c615b041f9076eca39185597dec2af  0x33.bin
98c615b041f9076eca39185597dec2af  0x33_dump.bin
16c03ef0f650d0a646b5c4710877081d  0x44.bin
16c03ef0f650d0a646b5c4710877081d  0x44_dump.bin
c3cfa3298923aaaa59a15c690f84e5ca  0x55.bin
c3cfa3298923aaaa59a15c690f84e5ca  0x55_dump.bin
be6cf456be4d36b09873c588ea9c22bb  0x66.bin
be6cf456be4d36b09873c588ea9c22bb  0x66_dump.bin
75e2929f9c5f98dc98028edd12d22605  0x77.bin
75e2929f9c5f98dc98028edd12d22605  0x77_dump.bin
24dbb1b5ba1566aaf6a8ed8587f44f85  0x88.bin
24dbb1b5ba1566aaf6a8ed8587f44f85  0x88_dump.bin
0bee104673926feba057d4e0097f2029  0x99.bin
0bee104673926feba057d4e0097f2029  0x99_dump.bin
34e091e27f9f42b3f52da1a956ba5c14  0xAA.bin
34e091e27f9f42b3f52da1a956ba5c14  0xAA_dump.bin
ae2e60f514e91562add9055ecdf18141  0xBB.bin
ae2e60f514e91562add9055ecdf18141  0xBB_dump.bin
b698e9a43901f9243a76731c6d180326  0xCC.bin
b698e9a43901f9243a76731c6d180326  0xCC_dump.bin
d9f4f1edf3ae885b4c519a4573852df6  0xDD.bin
d9f4f1edf3ae885b4c519a4573852df6  0xDD_dump.bin
991d645986a11c0da3f34c60295d1b72  0xEE.bin
991d645986a11c0da3f34c60295d1b72  0xEE_dump.bin
31e6a3e8a4f4fc92aa8e83a99614718e  0xFF.bin
31e6a3e8a4f4fc92aa8e83a99614718e  0xFF_dump.bin

Non-compessed files corrupted even if flash was success and compressable files are fine.
I rebooted ESP8266 100 times (yes I counted) and 0xFF still dumps with same MD5
Then I generated random file again using /dev/urandom
Code: Select all$ sudo esptool write_flash 0 random.bin
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 609104 bytes to 609300...
Wrote 609104 bytes (609300 compressed) at 0x00000000 in 54.6 seconds (effective 89.3 kbit/s)...
File  md5: d797834937e24ddc5c8f0a08eab34508
Flash md5: b7a376ba11e568942cade08cf6640842
MD5 of 0xFF is 31e6a3e8a4f4fc92aa8e83a99614718e

A fatal error occurred: MD5 of file does not match data in flash!

Now read and diff:
Code: Select all$ cmp -l random.bin random_dump.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}'
0001000C 71 F1
0004C00C 67 E7
0004D00B 7C 7D
0005D00C 7A FA
0006F00C 56 D6
0007A00C 58 D8

Flashing NodeMCU I tried different flashing tools under windows and different firmware and none of them works.
I tried different power sources, nothing changes.
I do have another ESP-12F but I do not want to solder it to kill it too without understanding why.
Please help me to understand what is happening and why.
User avatar
By Demin
#72211 Update:
Trying to get more information about problem and trying everything I can think of I did something.
I have Chinese clone of selae logic analyzer so I soldered it to memory chip (and it kinda works actually, but I understand nothing https://i.imgur.com/mBRYFIz.png )
And everything started to flash normally. Dump shows only one byte at 00000004 changed. Maybe it should be like that since it changes in all my NodeMCU flash tests.
After reboot I got:
Code: Select allFormatting file system. Please wait...

NodeMCU custom build by frightanic.com
   branch: master
   commit: 443e8219527f5b2190324a969a4586f9d3d731bf
   SSL: false
   modules: adc,bit,crypto,dht,file,gpio,mqtt,net,node,pwm,sjson,tmr,uart,websocket,wifi
 build    built on: 2017-11-24 03:42
 powered by Lua 5.1.4 on SDK 2.1.0(116b762)
lua: cannot open init.lua
> =node.heap()
43896

Now I de-solder selae logic analyzer.
And try to flash again:
Code: Select all# esptool write_flash 0 nodemcu-master-15-modules-2017-11-24-03-43-03-integer.bin
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0240
Compressed 609104 bytes to 399502...
Wrote 609104 bytes (399502 compressed) at 0x00000000 in 35.7 seconds (effective 136.4 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...

And reboot:
Code: Select allNodeMCU custom build by frightanic.com
   branch: master
   commit: 443e8219527f5b2190324a969a4586f9d3d731bf
   SSL: false
   modules: adc,bit,crypto,dht,file,gpio,mqtt,net,node,pwm,sjson,tmr,uart,websocket,wifi
 build    built on: 2017-11-24 03:42
 powered by Lua 5.1.4 on SDK 2.1.0(116b762)
lua: cannot open init.lua

Working. Trying 5 random files.
Code: Select all# dd if=/dev/urandom of=random_1.bin bs=1 count=609104
# dd if=/dev/urandom of=random_2.bin bs=1 count=609104
# dd if=/dev/urandom of=random_3.bin bs=1 count=609104
# dd if=/dev/urandom of=random_4.bin bs=1 count=609104
# dd if=/dev/urandom of=random_5.bin bs=1 count=609104

Code: Select all# esptool write_flash 0 random_1.bin
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 609104 bytes to 609300...
Wrote 609104 bytes (609300 compressed) at 0x00000000 in 54.6 seconds (effective 89.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...

Reading
Code: Select all# esptool read_flash 0 609104 random_1_dump.bin
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
609104 (100 %)
609104 (100 %)
Read 609104 bytes at 0x0 in 54.7 seconds (89.1 kbit/s)...
Hard resetting...

Code: Select all# md5sum *
6adb96a9c02ea68e18632cfec241f039  random_1.bin
6adb96a9c02ea68e18632cfec241f039  random_1_dump.bin

MD5 is marching. Never happened before.
Now second file
Code: Select all# esptool write_flash 0 random_2.bin           
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 609104 bytes to 609300...
Wrote 609104 bytes (609300 compressed) at 0x00000000 in 54.6 seconds (effective 89.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...

And after that I have no activity on my board. Blue led is not blinking, reset button does nothing, current is 10mA at 3.28V (I think its my pull up/down resistors on board)
I can't make it enter flash mode anymore.
Correction: blue LED rarely blinks and some data is sending, in console on speed 115200 I see it like this: https://i.imgur.com/Eold3vA.png
GPIO0 is pulled to GND
I think I will try erase flash chip with arduino later. Google says it is possible.
Any ideas?
User avatar
By Demin
#72217 Another update:
(This message should be 3rd in thread, not sure how moderator approving works on this forum, hope my 2nd message will be not overwrited)
I tried to make blue led blink for long time but nothing helped.
So I de-soldered memory chip to try to erase it with arduino and blue led started reacting to reset button.
I pressed down memory chip on pads holding by finger and blue led is reacting. I downloaded random_2.bin and MD5 matches. I flashed it again, no problem. Powered on/off, pressed reset, flash button, no problem, it works.
Downloaded again, again MD5 match.
Soldered memory chip back, flashed with NodeMCU, it works. Rebooted 100 times (I counted) and 100/100 NodeMCU loaded successfully.

So something here is broken in random moments.
If it is memory, then why ESP8266 was not loading at all? It loads even without chip.
If it is ESP8266 itself, then how soldering logic analyzer helped?
But looks like problems appearing only when some files modified on flash. I'm sure my board will brick itself again when I will write some files on it and fix will be re-soldering memory chip.
Maybe its reacting to heat like broken GPU computer video cards.
Still I would like to know how I broke it and how to not repeat this in future. Not sure if universe have answer to that question.
User avatar
By Narfel
#72261 I hate to see this very detailed post to go unanswered, but then again i think you answered it yourself. Your memory appears to be not 100%. I have quite some boards that work... until they're not. While these are presoldered dev-boards with all the circuitry on board that doesn't in any way prevent them from showing exactly what you report. It might be a combination of small power fluctuations, random(ish) power draws and a flash chip from the "good enough" pile. Sorry to be of no help, but i think you did as much as you could and there is no sensible way to prevent this sort of thing other than the precautions you already took. Others with more knowledge may have more input, but based on my exp sometimes the universe is just out to get you(r ESP) :)