letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.26k stars 2.21k forks source link

ESP-01 (1MB) flashing problems #650

Closed faisalthaheem closed 5 years ago

faisalthaheem commented 6 years ago

Steps to reproduce

Flash a fresh esp-01 module (black) with any 1MB bin

Does the problem presist after powering off and on? (just resetting isnt enough sometimes) yes

Expected behavior

Tell us what should happen? Should start normally

Actual behavior

Tell us what happens instead? board keeps resetting and complaining about the same problem. I have tried flashing with different baud rates and modes, but nothing works. The same firmware works great on wemos d1r2.

System configuration

Hardware:ESP-01 1MB version Software or git version: v2.0.0-dev12

here''s the output from the serial interface

RESET: Warm boot, reset count: 1 RESET: formatting... RESET: formatting done... FS : Error while reading/writing config.dat in 878 FS : Error while reading/writing security.dat in 878 FS : Error while reading/writing notification.dat in 878 FS : Error while reading/writing config.dat in 922 FS : Error while reading/writing config.dat in 895 RESET: Succesful, rebooting. (you might need to press the reset button if you've justed flashed the firmware)

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

load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d v09826c6d ~ld ⸮U

INIT : Booting version: v2.0.0-dev12 INIT : Warm boot #2 FS : Mounting... FS : Mount successful, used 1255 bytes of 113201 RESET: Resetting factory defaults... RESET: Warm boot, reset count: 2 RESET: formatting... RESET: formatting done... FS : Error while reading/writing config.dat in 878 FS : Error while reading/writing security.dat in 878 FS : Error while reading/writing notification.dat in 878 FS : Error while reading/writing config.dat in 922 FS : Error while reading/writing config.dat in 895 RESET: Succesful, rebooting. (you might need to press the reset button if you've justed flashed the firmware)

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

load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d v09826c6d ~ld ⸮U

INIT : Booting version: v2.0.0-dev12 INIT : Warm boot #3 FS : Mounting... FS : Mount successful, used 1255 bytes of 113201 RESET: Resetting factory defaults... RESET: Warm boot, reset count: 3 RESET: Too many resets, protecting your flash memory (powercycle to solve this) FS : Error while reading/writing config.dat in 922

PID:0 Version:0 INIT : Incorrect PID or version! RESET: Resetting factory defaults... RESET: Warm boot, reset count: 3 RESET: Too many resets, protecting your flash memory (powercycle to solve this)

Exception (0): epc1=0x40106f19 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont sp: 3fff3500 end: 3fff3770 offset: 01a0

stack>>> 3fff36a0: 0000001c 00000000 3fff2680 401004d8
3fff36b0: 3fff0ab0 0000004e 3fff4f9c 40205cb9
3fff36c0: 00000000 00000001 00000119 4010020c
3fff36d0: 0000001c 00000000 3fff2680 00000000
3fff36e0: 0000001c 00000000 3fff2680 40201710
3fff36f0: 00000001 3fff37c8 00000000 40203d13
3fff3700: 3fffdad0 3fff2680 3fff4f9c 3fff2740
3fff3710: 3fffdad0 3fff2680 3fff1464 402142f1
3fff3720: 3fffdad0 3fff2680 3fff1464 402319b9
3fff3730: 00000000 00000000 00000000 3fff4fac
3fff3740: 0000002f 00000013 feefeffe feefeffe
3fff3750: 3fffdad0 00000000 3fff273a 402033f4
3fff3760: feefeffe feefeffe 3fff2750 40205e54
<<<stack<<<

TD-er commented 6 years ago

For another issue-thread I created these test builds yesterday: https://www.dropbox.com/s/tr2w99jw6hfgdph/ESPeasy_issue640_test_20171220.rar?dl=0 Could you please try one of these test builds? Just to test if it is a recently fixed bug, which is not yet released in a build dev-13.

faisalthaheem commented 6 years ago

thanks for sharing the build, tried that, but same issue, please see following output

ets Jan 8 2013,rst cause:2, boot mode:(3,1)

load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d v09826c6d ~ld ⸮U

INIT : Booting version: INIT : Warm boot 1 FS : Mounting... FS : Mount successful, used 1506 bytes of 113201 RESET: Resetting factory defaults... RESET: Warm boot, reset count: 1 RESET: formatting... RESET: formatting done... FS : Error while reading/writing config.dat in 917 FS : Error while reading/writing security.dat in 917 FS : Error while reading/writing notification.dat in 917 FS : Error while reading/writing config.dat in 961 FS : Error while reading/writing config.dat in 934 RESET: Succesful, rebooting. (you might need to press the reset button if you've justed flashed the firmware)

ets Jan 8 2013,rst cause:2, boot mode:(3,1)

load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d v09826c6d ~ld ⸮U

INIT : Booting version: INIT : Warm boot 2 FS : Mounting... FS : Mount successful, used 1506 bytes of 113201 RESET: Resetting factory defaults... RESET: Warm boot, reset count: 2 RESET: formatting... RESET: formatting done... FS : Error while reading/writing config.dat in 917 FS : Error while reading/writing security.dat in 917 FS : Error while reading/writing notification.dat in 917 FS : Error while reading/writing config.dat in 961 FS : Error while reading/writing config.dat in 934 RESET: Succesful, rebooting. (you might need to press the reset button if you've justed flashed the firmware)

TD-er commented 6 years ago

Just to verify it is not a broken ESP device, can you also test another version, like the 'old' v120: http://www.letscontrolit.com/downloads/ESPEasy_R120.zip

It kind of looks like you cannot write to parts of the flash. Are you certain it is a 1MB flash version and not perhaps a 512 kB version?

Edit: Judging from this table, there is no 1MB flash version of the ESP01, just 512 kB

faisalthaheem commented 6 years ago

I have tried flashing "ESPEasy_R120_1024" and it works, however, the tasks do not function correctly, for example, I am unable to read DHT-11.

I have also tried flashing sketches that perform various functions (DHT, MQTT etc) and they appear to be working normally, however when I flash any recent version of easyesp (ESPEasy_R147_RC8 and upwards) I run into the same restart issues.

I'm certain it's a 1MB version (the table mentions below with ** that amount of flash size may vary with board models), I have verified the same using esptool, output follows

flash_id output

esptool.py v2.2 Connecting.... Detecting chip type... ESP8266 Chip is ESP8266EX Uploading stub... Running stub... Stub running... Manufacturer: 85 Device: 6014 Detected flash size: 1MB Hard resetting...

chip_id output

esptool.py v2.2 Connecting.... Detecting chip type... ESP8266 Chip is ESP8266EX Uploading stub... Running stub... Stub running... Chip ID: 0x004aae02 Hard resetting...

psy0rz commented 6 years ago

which .bin file of 2.0.0-dev12 did you flash?

funtastic99 commented 6 years ago

Hi, i have the same problem. It seems that the newer ESP-01 are delivered with a different flash chip.

The working ESP-01 report as flash_id: Manufacturer: e0 Device: 4014

and the new ones that are not working: Manufacturer: 85 Device: 6014

Any idea how to get the new one working ?

TD-er commented 6 years ago

Apparently, that is the GIGADEVICE_GD25LQ80 flash chip. (taken from here: https://code.coreboot.org/p/flashrom/source/tree/HEAD/trunk/flashchips.h ) It looks there have been issues in the past to support that chip: https://www.google.nl/search?q=GIGADEVICE_GD25LQ80 I am not sure about how the programming does handle different chips, but maybe the flashtool has to be upgraded to support those chips? Although it looks like these chips should already be supported for well over a year now. Does ESP easy have to know about these chips too? And could this knowledge be located in the ESP core so we have to upgrade to 2.4.0 to get it working?

funtastic99 commented 6 years ago

ESP core 2.4.0 also cannot handle this chip yet. I also created an issue for that. Maybe we can only wait for them to analyze and support this new flash. I will try to use another flash frequency. Just as a try

Pablo2048 commented 6 years ago

Can anyone with this problem try to burn with DOUT mode (https://github.com/espressif/esptool/wiki/SPI-Flash-Modes)?

funtastic99 commented 6 years ago

Hi Pablo, I already tried that but I will try again this evening.

funtastic99 commented 6 years ago

Still does not work. Also not with DOUT. But to have this clear: everything is working fine. The firmware runs but only SPIFFS is not working with the news flash

TD-er commented 6 years ago

So making changes to the settings is not possible?

eriktews commented 6 years ago

How are you actually supposed to get it working for the first time. As far as I understood ESPEasy, you have to flash it and when you do the initial configuration, the firmware has to write to the flash, right?

Also in the meantime, it looks like it's hard to predict which chip you will get when you buy a ESP-01 from an online show. Does anyone have a suggestion where I can buy the old modules?

HarryHase11 commented 6 years ago

But ESPEasy_R147_1024.bin works fine.

moo2089 commented 6 years ago

hi, same problem here, mod type: esp8266 esp01s flash P25Q80 8Mbit

r147, r148 ok, but above them nothing is working properly, tried different setups, ext. psu, ftdi built in psu, 2 ftdi module, 2 esp module, 470uF cap and 100nF also added, same problem, confused

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

load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d v09826c6d ~ld ŞU

INIT : Booting version: v2.0.0-dev12 INIT : Warm boot #308 FS : Mounting... FS : Mount successful, used 1255 bytes of 113201 RESET: Resetting factory defaults... RESET: Warm boot, reset count: 3 RESET: Too many resets, protecting your flash memory (powercycle to solve this) FS : Error while reading/writing config.dat in 922

PID:0 Version:0 INIT : Incorrect PID or version! RESET: Resetting factory defaults... RESET: Warm boot, reset count: 3 RESET: Too many resets, protecting your flash memory (powercycle to solve this)

Exception (0): epc1=0x40106f19 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont sp: 3fff3500 end: 3fff3770 offset: 01a0

stack>>> 3fff36a0: 0000001c 00000000 3fff2680 401004d8
3fff36b0: 3fff0ab0 0000004e 3fff4f9c 40205cb9
3fff36c0: 00000000 00000001 00000119 4010020c
3fff36d0: 0000001c 00000000 3fff2680 00000000
3fff36e0: 0000001c 00000000 3fff2680 40201710
3fff36f0: 00000001 3fff37c8 00000000 40203d13
3fff3700: 3fffdad0 3fff2680 3fff4f9c 3fff2740
3fff3710: 3fffdad0 3fff2680 3fff1464 402142f1
3fff3720: 3fffdad0 3fff2680 3fff1464 402319b9
3fff3730: 00000000 00000000 00000000 3fff4fac
3fff3740: 0000002f 00000015 feefeffe feefeffe
3fff3750: 3fffdad0 00000000 3fff273a 402033f4
3fff3760: feefeffe feefeffe 3fff2750 40205e54
<<<stack<<<

psy0rz commented 6 years ago

strange..normally a reset should format the SPIFFS and everything should be fine.

From the logs above:

RESET: formatting...
RESET: formatting done...
FS : Error while reading/writing config.dat in 878
FS : Error while reading/writing security.dat in 878
FS : Error while reading/writing notification.dat in 878
FS : Error while reading/writing config.dat in 922
FS : Error while reading/writing config.dat in 895
RESET: Succesful, rebooting. (you might need to press the reset button if you've justed flashed the firmware)

Those errors while writing are the cause of all the problems: If that steps fails, your ESPEasy is unusable. It kinda works but it cannot save files.

I think there where other issues with the same problems? Didn't it have to do with the flash-mode of the flash tool or something?

HarryHase11 commented 6 years ago

but it's only with espeasy 2.0 and mega -> tasmota and espeasy R148 works fine on same device

TD-er commented 6 years ago

Could it be that those other versions (Tasmota, Espurna, ESPeasy R148) have a sketch size < 512 kB?

psy0rz commented 6 years ago

I think so, since mega was especially for >=1M devices only.

if that is the problem in this case, we might need to build in a extra flash-size check that warns and stops the boot process?

TD-er commented 6 years ago

It looks like it is a 1 MB flash. But if I remember correctly, the ESP8266EX will load up to 1 MB into memory, which means the sketch may never be more than 1 MB. However, since I saw a lot of ESP-01 boards to be with only 512k flash and also support for OTA was sometimes different, I thought maybe the ESP01 was also limited in the max. sketch size, or perhaps it cannot access the flash like the "bigger" ones do.

HarryHase11 commented 6 years ago

can anyone build a testversion wich is alittle bit smaller to test with this devices?

working: ESPEasy_R147_1024.bin: 431.376 Bytes sonoff.8266.5.10.0.h.bin: 481.184 Bytes

not working: ESP_Easy_mega-20180104_normal_ESP8266_1024.bin: 569.184 Bytes

maybe thats the solution?

TD-er commented 6 years ago

I think we can disable the OLED framed module? That one is quite big with its font embedded.

HarryHase11 commented 6 years ago

Good Idea; Let's try; I can't compile it myself yet; can anybody do it?

psy0rz commented 6 years ago

@HarryHase11 so your module only has 512kb flash?

HarryHase11 commented 6 years ago

i bought it with 1MB, but not sure what wrong; and that problem some other user have the same issue.

http://fs1.directupload.net/images/180110/4uq4edt6.jpg

P25Q80H

psy0rz commented 6 years ago

ah k thx

HarryHase11 commented 6 years ago

found some hints in the internet that this flash chip have only 512KB size.

psy0rz commented 6 years ago

can you checkout the sysinfo page? it should tell you how much flash you have.

moo2089 commented 6 years ago

hi, this is mine, with same issues:

Load: 8% (LC=32657)
Uptime: 85 minutes
Wifi RSSI: -45 dB
IP: 10.0.0.15
GW: 10.0.0.12
Build: 148
Core Version: 2_3_0
Unit: 2
STA MAC: 2c:3a:e8:4a:bf:cf
AP MAC: 2e:3a:e8:4a:bf:cf
ESP Chip ID: 4898767
Flash Chip ID: 1335429
Flash Size: 1024 kB
Flash Writes (since boot): 2
Sketch Size/Free: 421 kB / 516 kB
Free Mem: 26792
Devices: 35
Boot cause: Cold boot
psy0rz commented 6 years ago

ok so its not flashsize

psy0rz commented 6 years ago

does someone have a link where to buy this type?

moo2089 commented 6 years ago

what do you mean? module itself?

psy0rz commented 6 years ago

yeah the module that it is giving these problems. then i'll order a few so i can test/debug.

moo2089 commented 6 years ago

https://www.ebay.com/itm/ESP8266-ESP-01S-Serial-WIFI-Wireless-Module-Adapter-Breakout-Send-Receive-AP-STA/311736436700?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649

moo2089 commented 6 years ago

this is what i use in this moment

moo2089 commented 6 years ago

and i ordered some 8Mbit and 32Mbit flash to relpace, to see what happens

psy0rz commented 6 years ago

thanks..i've ordered 5 but esptimated shipping is 30 days :(

moo2089 commented 6 years ago

i have got it within 2 weeks (Hungary)

HarryHase11 commented 6 years ago

can't you build a binary with smaller size only for testing, i think that could be a temporary solution.

psy0rz commented 6 years ago

if that is the case, then all 1Mb modules should give problems at this moment, not only yours.

TD-er commented 6 years ago

I think it is probably more ESP01 related than flash size. But that's just a feeling :)

moo2089 commented 6 years ago

i agree, this is very small sketch, also not working! https://www.letscontrolit.com/wiki/index.php/ESPEasy#Loading_firmware

2.0+ firmware on 1MB modules If you are running the stock Mega edition firmware on 1MB modules, you will find that you can no longer load newer images because there's insufficient free space to upload the image (344kB as of 2.0.0.-Dev 9 edition). You can compile smaller images to solve this issue or use a small image that has been build just to upload newer images. So you would always have to use a two-step process to renew using OTA on 1MB modules. Using the uploader image as an in-between step, you can use images up to 604kB.

ESPEasyUploaderMega

The uploader uses SPIFFS so it uses the same configuration regarding SSID, WPA key and IP. It will connect to your Wifi network as usual, but it will only present this small web page:

ESPUploader.png

Tutorial_ESPEasy_Firmware_Upload

TD-er commented 6 years ago

I assume these modules were not updated OTA? But rather via a flash tool?

moo2089 commented 6 years ago

anyway, i ordered different esp01 modules, to see if it is module related issue, or what?

moo2089 commented 6 years ago

i tried OTA and serial flash as well, with same issues

HarryHase11 commented 6 years ago

at the weekend i take a look with a microscope on the esp01-flash chip which are working

Build: 20000 - Mega
GIT version: v2.0.0-dev12
Plugin sets: [Normal]
Number of Plugins: 45
Core Version: 2_3_0
Flash Size: 1024 kB
Flash Writes (daily/boot): 0 / 0
Sketch Size/Free: 553 kB / 320 kB
Boot cause: Cold boot
Warm boot count: 0
STA MAC: 2c:3a:e8:20:f7:c4
AP MAC: 2e:3a:e8:20:f7:c4
ESP Chip ID: 2160580
Flash Chip ID: 1327328
TD-er commented 6 years ago

Please try this test build: https://www.dropbox.com/s/t98zoqeouafhkvx/512k_Firmware_issue650_v2.0_stripped.rar?dl=0

I removed:

It is based on the latest v2.0 branch.

This one should also give more information about the flash.

funtastic99 commented 6 years ago

You might have the same problem than described here: https://github.com/esp8266/Arduino/issues/4061

TD-er commented 6 years ago

Hmm, converting the ESP-chip ID, posted by Harry is: 2160580 Converted to HEX is still the last 3 bytes of the MAC address. So still no way to detect these versions :(

HarryHase11 commented 6 years ago

TD-er: thx, test build has the same issue, so it's not the sketch size

INIT : Booting version: INIT : Warm boot #1 FS : Mounting... FS : Mount successful, used 2008 bytes of 113201 FS : Error while reading/writing config.dat in 970

PID:0 Version:0 INIT : Incorrect PID or version! RESET: Resetting factory defaults... RESET: Warm boot, reset count: 1 RESET: formatting... RESET: formatting done... FS : Error while reading/writing config.dat in 917 FS : Error while reading/writing security.dat in 917 FS : Error while reading/writing notification.dat in 917 FS : Error while reading/writing config.dat in 970 FS : Error while reading/writing config.dat in 940 RESET: Succesful, rebooting. (you might need to press the reset button if you've justed flashed the firmware)

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

load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d v09826c6d ~ld ªU

INIT : Booting version: INIT : Warm boot #2 FS : Mounting...