Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP-01 (1MB) flashing problems #650

Closed
faisalthaheem opened this issue Dec 21, 2017 · 94 comments
Closed

ESP-01 (1MB) flashing problems #650

faisalthaheem opened this issue Dec 21, 2017 · 94 comments
Labels
Category: Core related Related to the (external) core libraries Type: Bug Considered a bug
Milestone

Comments

@faisalthaheem
Copy link

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
Copy link
Member

TD-er commented Dec 21, 2017

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
Copy link
Author

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
Copy link
Member

TD-er commented Dec 22, 2017

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
Copy link
Author

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
Copy link
Member

psy0rz commented Dec 28, 2017

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

@funtastic99
Copy link

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
Copy link
Member

TD-er commented Jan 4, 2018

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
Copy link

funtastic99 commented Jan 4, 2018

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
Copy link

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

@funtastic99
Copy link

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

@funtastic99
Copy link

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
Copy link
Member

TD-er commented Jan 5, 2018

So making changes to the settings is not possible?

@eriktews
Copy link

eriktews commented Jan 5, 2018

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
Copy link

But ESPEasy_R147_1024.bin works fine.

@moo2089
Copy link

moo2089 commented Jan 8, 2018

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 psy0rz added Type: Bug Considered a bug Category: Core related Related to the (external) core libraries labels Jan 10, 2018
@psy0rz psy0rz added this to the 2.0.0 milestone Jan 10, 2018
@psy0rz
Copy link
Member

psy0rz commented Jan 10, 2018

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
Copy link

HarryHase11 commented Jan 10, 2018

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

@TD-er
Copy link
Member

TD-er commented Jan 10, 2018

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

@psy0rz
Copy link
Member

psy0rz commented Jan 10, 2018

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
Copy link
Member

TD-er commented Jan 10, 2018

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
Copy link

HarryHase11 commented Jan 10, 2018

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
Copy link
Member

TD-er commented Jan 10, 2018

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

@HarryHase11
Copy link

HarryHase11 commented Jan 10, 2018

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

@psy0rz
Copy link
Member

psy0rz commented Jan 10, 2018

@HarryHase11 so your module only has 512kb flash?

@HarryHase11
Copy link

HarryHase11 commented Jan 10, 2018

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
Copy link
Member

psy0rz commented Jan 10, 2018

ah k thx

@HarryHase11
Copy link

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

@ondabeach
Copy link

Hi @TD-er. This is why I asked for people who don't have PUYA chipped module to comment in #748. All the back and forth with long posts that get nowhere just makes the thread hard to follow and so long most people just wouldn't bother to make sense of it.

I am absolutely dumbfounded by the lack of urgency shown by the supposed gurus in the 8266 community in relation to this issue. This issue was raised 3 weeks ago that I know of maybe more. I warned that it was going to quickly become widespread 2 weeks ago. There are now at least 4 current threads on this issue. And still nothing concrete has been done.

I know you're trying to help, but no-one's suggestions have been helpful to date. Even @igrr got me to try a number of modified esp.cpp's to nail it down, but all to no avail. And now, he's just left me hanging as if he's just put it in the too hard basket. If he can't find the problem without a PUYA chipped module in hand I seriously doubt that anyone can.

This isn't a minor issue and it's going to spread exponentially as these PUYA chips are being used by a growing number of manufacturers and I can't see it being restricted to the esp-01 module for long.

Someone who knows what they're doing needs get one of these modules urgently so this issue can be resolved as quickly as possible.

@TD-er
Copy link
Member

TD-er commented Jan 22, 2018

That's why I want to get my hands on them.
So where can I get them for sure with speedy delivery?

@faisalthaheem
Copy link
Author

@ondabeach
Copy link

@TD-er, this is where I bought one of the batches(20) from and they all had the PUYA flash chip.

https://www.aliexpress.com/item/ESP-01-serial-WIFI-industry-milestone-agent-Supply-ESP8266-DIY/32805754095.html?spm=a2g0s.9042311.0.0.I6heFt

If you want to receive them more quickly you must choose 'ePacket' from the drop down list of postage options.

@HarryHase11
Copy link

I will send TD-er one of this esp-01 at the weekend, maybe he can solve this puya problem

@HarryHase11
Copy link

any news?

@TD-er
Copy link
Member

TD-er commented Feb 12, 2018

Yep, there is a solution, but we still have to build it.

The problem is in the Arduino ESP8266 core library.

The problem is the implementation of SPIFFS which does rely on a very typical property of flash memory.
With normal flash memory, a bit can only be set from 1 to 0.
To do the other way around, (0 to 1), you have to read a block, erase the entire block, change the data in memory and write the entire block back to flash.

So the SPIFFS implementation relies on this by not erasing, but just writing to the flash.
For example the administration of used blocks is perfect for this.
Just write a 0 to the bit representing the new used block and the rest of your write is just ones (to the bits you don't want to change)
You'll have to keep two of these lists. One for used blocks and one for blocks marked to be erased.
Then after a while almost no free (and erased) blocks are left and thus the index table for free blocks is almost all zeroes.
Then you only have to erase the blocks which are marked accordingly and the block(s) which contain the table of used or ready-to-be-erased blocks.

But with the PUYA chips, the byte written is actually stored the same way as it is offered to the flash memory.
With normal flash: existing pattern: 11110000 => write: 11101111, should result in 11100000
But with PUYA: existing pattern: 11110000 => write: 11101111, results in 11101111
This makes the current bookkeeping implementation useless.

Adding a small piece of code to the write flash function, should be enough to fix all SPIFFS issues.
To be precise, this commit is enough.

Thing is, you don't want this on other chips. So it is not a general solution, so we have to split it into several builds, one specific for PUYA chips.
The reason you don't want it on other chips is that it will increase the number of writes to the chip.
Especially on the addresses where SPIFFS stores its (free/used) block allocation register.

@psy0rz is looking into building the core lib to be used with PUYA builds.

@psy0rz
Copy link
Member

psy0rz commented Feb 14, 2018

i just tested this on my PUYA chips: writing now seems slow as hell? or is it always slower on ESP01s chips?

trying to get it to build via travis now, so hopefully we'll have a extra PUYA binary in the next nightly.

@psy0rz
Copy link
Member

psy0rz commented Feb 14, 2018

ok its building, i'm going to sleep, with some luck both nightly builds will now have a dev_ESP8266PUYA_1024 version. keep in mind its slow and wears your flash fast.

there is still hope the upstream guys figure out a way to reconfigure the chip so it behaves normally.

see esp8266/Arduino#4061 (comment)

@uzi18
Copy link
Contributor

uzi18 commented Feb 15, 2018

Have got my own PUYA :)

my-puya

@HarryHase11
Copy link

is there a binary downoad avaible for testing?

@TD-er
Copy link
Member

TD-er commented Feb 15, 2018

Yep, but there were some reports of non functional Advanced view.
One of the firmware versions in the last release is for the PUYA.

@soif
Copy link
Contributor

soif commented Mar 5, 2018

I have an ESP01 with a Puya IC, and I've tried to upload the latest [env:dev_ESP8266PUYA_1024] built on it !

I don't remember it if was on the mega or v2.0. branches (.. well... #997), but it has totally failed : The boot log loops after failing to do something certainly related to the SPIFF partition.

I've always flash_erase using esptool.py before flashing the firmware, but it always ends up crashing after some ESPEASY boot logs , and keeps rebooting.

Is there anything else i should take care of, or is my board simply fried (totally credible) ?
Otherwise, is the PUYA fix supposed to work fine at this time? Don't i have to ALSO patch the ArduinoEspressif framework manually, using the included script?

I'm gonna receive new (certainly PUYA equipped) ESP01 modules from AliExpress, but it takes time, and for sure I will report further success or not.

@uzi18
Copy link
Contributor

uzi18 commented Mar 5, 2018

@soif try my patch v2 for puya, it will detect if flash is puya and use workaround if necessary.

@soif
Copy link
Contributor

soif commented Mar 5, 2018

@uzi18 Thanks for the quick help, but I cant figure out what your "patch v2" is.
I've just seen you own "patch-2" branch which only commit is a9dbb79 "update Blynk controller".... ???

any link ? 😎

@uzi18
Copy link
Contributor

uzi18 commented Mar 5, 2018

here: esp8266/Arduino#4061

@soif
Copy link
Contributor

soif commented Mar 5, 2018

Well OK, understood.

But i'm currently on the 2.4 version and patching pio components is not something I want to experiment/maintain until it is officially merged.

Hence MANY thanks for your efforts 🎉

I now quess that I just have to wait for a potentially fast merge into the Espressif-arduino framework, for the PUYA IC to be supported. I'm pretty sure that they will merge it ASAP:

@uzi18
Copy link
Contributor

uzi18 commented Mar 5, 2018

I just see noone it testing it there.
Just backup Esp.cpp and Esp.h files from core.

@elschopi
Copy link

elschopi commented Mar 7, 2018

i'm quite new to the ESP and ESPeasy, could someone help me choosing a flash chip to change the PUYA ones with? i had a Microchip 25PF020B80-4C-S and a SST 25VF040B at hand but both seem to not work with the ESP. i'd especially appreciate hints as to make & model and where to buy in germany ;) thanks =)

@uzi18
Copy link
Contributor

uzi18 commented Mar 7, 2018

find w25q32 :)

@bramschats
Copy link

From the ESP-easy site: At this time ESP-01S are sold with a flash chip marked "PUYA". These flash chips have a problem with using SPIFFS memory and do not work with ESP Easy. The problem is under investigation. At this time there is no given solution besides using other ESP-01 if available or changing the flash chip on the ESP-01S. UPDATE: A fix seems to be on the horizon. Stay tuned!

When to expect the new firmware for the ESP-01s boards?

Regards, Bram

@uzi18
Copy link
Contributor

uzi18 commented Mar 13, 2018

It is available in mega/v2 releases.

@bramschats
Copy link

Thanks, which one should I use, the PUYA_1024.bin or the PUYA_1024_VCC.bin?

@Micha-he
Copy link
Contributor

PUYA_1024, when you don't use analog-input or use analog from external
&
PUYA_1024_VCC, when you use the measurement from Vcc with the internal ADC

@ChrisNbg
Copy link

Hello,

I struggled some hours around with an ESP-07 board with 1M... with the PUYA-Version from 20180714 it worked at least to boot. Now I will start testing :).
My ESP-07 has although (flash_id)
Manufacturer: 85
Device: 6014
ChipID: 146085

greets Christian

@Grovkillen
Copy link
Member

#2005 and #1989 probably fix this issue. Open if not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Core related Related to the (external) core libraries Type: Bug Considered a bug
Projects
None yet
Development

No branches or pull requests