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

Rewrite PUYA patch to be more universal and mem friendly. #5493

Closed
TD-er opened this issue Dec 14, 2018 · 36 comments
Closed

Rewrite PUYA patch to be more universal and mem friendly. #5493

TD-er opened this issue Dec 14, 2018 · 36 comments

Comments

@TD-er
Copy link
Contributor

TD-er commented Dec 14, 2018

The (current) patch:

  1. uses a static 4KB buffer, which means everyone using the patch has 4KB less heap, including those users who do not have a puya chip. Instead, a dynamically allocated buffer should be used.
  2. evaluates the first if condition every single call of the function, although only the first one after boot actually does anything. Instead of a private static, a global could be used that is set elsewhere only once at bootup, and then if condition is no longer needed. Alternatively, The ESPClass could get a new data member (i.e.: instead of the global flag) which is set on construction, and a method to return its value.
  3. calculates the flash_chip_id condition in the second if every single call of the function, which makes no sense, because it can't ever change at runtime. Instead, the condition should be fully calculated once and the result stored in a flag, which should then be checked.
  4. detects the condition based on flash_chip_id, which isn't very robust, as has been shown with the flash chip size. Instead, a general purpose detection approach should be implemented that transparently covers other potential brands and manufacturers that have the same quirk, should they appear.
    Example: on first bootup after flashing, choose a sector, e.g.: within the update area of the flash layout., preferably one that is unlikely to be used. Do a write test and read back sequence known to behave differently with puya chips. If puya is detected, set a quirk flag somewhere. On all successive bootups, detect that the quirk flag is set, so don't do the test again. Use the quirk flag in the write function to decide whether the additional logic is done or not.

Given the above, the patch won't be accepted as-is into our core. There have been several internal discussions on exactly what to do, but given that the patch is available, there have been, and still are, higher priorities, e.g.: figuring out how to ease IRAM usage.

There have been a lot of comments from many users in this discussion, and I see the patch is even being applied elsewhere, but I still don't see a PR here. Instead of wondering what will happen, I invite those involved to make a PR with the proposed patch, and implement at least points 1-3 above on top of it. If you come up with a good solution for point 4, even better.

Originally posted by @devyte in #4061 (comment)

Will have a look at it tomorrow (well, after sleep)

@devyte
Copy link
Collaborator

devyte commented Dec 14, 2018

Note: From #4061 :
Patch v3 in use by ESPEasy, which needs rework per points quoted above:
https://github.com/letscontrolit/ESPEasy/blob/mega/patches/puya_v3.patch#L8

@uzi18
Copy link

uzi18 commented Dec 14, 2018

@devyte in #4061 we found it is only true for flash_chip_id 0x146085 PUYA,
even no other size of flash were found/reported in issue, other brands worked.

@mrWheel
Copy link

mrWheel commented Dec 14, 2018

@devyte
Good to know, but I do a lot of development for various projects that use the ESP-01 and so .. I'm stuck with the PUYA chip problems.....

TD-er added a commit to TD-er/Arduino that referenced this issue Dec 14, 2018
Applied the patch to get the starting point as described in esp8266#5493
@TD-er
Copy link
Contributor Author

TD-er commented Dec 14, 2018

Where is a good place to check for PUYA chip at boot? (and then allocate read buffer for the write function)
Inside the getFlashChipId() function?
Inside the flashRead() function is also possible, but then we're checking it for every read, which is silly.

By the way, this is a simple test with the dynamic allocation active in a simulated setup (faked PUYA detection) :

core 2.5.0 PUYA patch, no puya chip present:

Description #calls call/sec min (ms) Avg (ms) max (ms)
Save File 4 0.25 34.755 45.264 67.620
  • Free Mem: 16168

core 2.5.0 PUYA patch, Faked Puya detect:

Description #calls call/sec min (ms) Avg (ms) max (ms)
Save File 2 0.04 41.332 57.544 73.756
  • Free Mem: 11560

See the code (Work-in-progress): https://github.com/TD-er/Arduino/tree/bugfix/5493_puya_patch

Edit:
See TD-er@715fc99
Check for PUYA chip in call for getFlashChipId()
This will only be done once and the result of the get function is also cached.
I assume it will not change anymore, right?

@devyte
Copy link
Collaborator

devyte commented Dec 14, 2018

Do you mean the simple check similar to what's in the patch, or the general check I described in point 4?

@TD-er
Copy link
Contributor Author

TD-er commented Dec 14, 2018

@devyte The moment to allocate the 4k buffer.
When allocated as soon as possible, it will give the least amount of fragmentation. (and the most chance of success to allocate the block)

Point 1 - 3 should be done by the patch as far as I have it.

My idea to detect PUYA write behavior is to check for the first 4 bytes after the sketch to see if there is the word "PUYA" written.
In order to write it, I would like to write the NOT representation of "PUYA" in ASCII and then again the text "PUYA".
If it is a PUYA chip, it will contain the text "PUYA". If it is a normal flash chip, it will contain only zeroes.
If not tested, it will contain 0xFF.

Or am I missing something in my thought experiment?

@devyte
Copy link
Collaborator

devyte commented Dec 14, 2018

It sounds reasonable. However, please investigate the flash mem layout and start/stop addresses thoroughly (SPIFFS/no SPIFFS and update area, btw from your description I understand you're using the very start of the update area), and keep in mind that you have to handle an entire 4KB flash sector when writing ~(PUYA)PUYA.
I suggest implementing a struct with 2 const data members that are const char uint8_t[4]. Then you write the struct as a whole to the flash address. If there are additional 1-time values to add in the future, the struct and logic could then be extended.

@TD-er
Copy link
Contributor Author

TD-er commented Dec 14, 2018

Why must I write an entire flash sector?
The check does not work when it will do an erase like the normal write procedure.
The whole issue with SPIFFS not working was related to low-level writing without erasing.
Or can write calls at low level only write an entire sector at a time?

@devyte
Copy link
Collaborator

devyte commented Dec 14, 2018

I didn't say you have to write the entire sector, I said you have to handle it. I don't know what goes on at low level for puya or non puya chips. But what I was getting at are two things:

  • there could be data at the high end of the sector, e.g.: from a new sketch coming OTA. Care that you don't impact that.
  • if you do a single malloc of 4KB at bootup, that heap is used up whether you do flash writes or not, and if you do a malloc inside the if in the patch code once per write, it could potentially fail when oom or due to mem fragmentation. Each has pros and cons.

@TD-er
Copy link
Contributor Author

TD-er commented Dec 14, 2018

I will indeed look into the flash structure and right now it looks more complicated than expected.

And indeed 4 kB used even when no writes are needed is a waste.
I will think of a way to use less memory.
Would it be OK to preset some kind of 'flash profile' which determines the allocation strategy?

Only thing is, I had trouble finding my "PUYA" nodes to test.
I should have a bag full of them somewhere...

@TD-er
Copy link
Contributor Author

TD-er commented Dec 14, 2018

One other thing I notice.
There isn't a while loop in there and also no check for the size.

What guarantee do we have the write cycle is always 4 kB max?

I've been reading the datasheet.

  • A page is said to be 256 bytes. So why not write the data in chunks of 256 bytes?
  • spiffs_hal uses a buffer of 512 bytes to correct unaligned data to be written.
  • Updater class uses 256 as a fall-back when heap memory is low:

if (ESP.getFreeHeap() > 2 * FLASH_SECTOR_SIZE) {
_bufferSize = FLASH_SECTOR_SIZE;
} else {
_bufferSize = 256;
}
_buffer = new uint8_t[_bufferSize];

So is it OK to set the PUYA buffer size as a define with default set to 512?

@TD-er
Copy link
Contributor Author

TD-er commented Dec 14, 2018

In this last commit, I am using a 512 byte buffer and do checks on the amount of data to write.
TD-er@ed5a14e

I have tested writing files (to SPIFFS) of 2 kB and partial updates in files, but not sure if SPIFFS also divided the amount of data to be sent in parts of 512 bytes.

N.B. would be nice if it is also tested on real PUYA hardware.

@igrr
Copy link
Member

igrr commented Dec 15, 2018

PUYA chips have software erase page size of 256 bytes, so 256 byte buffer should also be okay.

@TD-er
Copy link
Contributor Author

TD-er commented Dec 15, 2018

What about the rest of the patch?
Looks OK?
I will also look into better detection of the puya behavior, but that can be a later pr also.

@TD-er
Copy link
Contributor Author

TD-er commented Dec 15, 2018

It has been tested on a module with PUYA, with the suggested 256 Byte buffer and appears to be working.

TD-er added a commit to TD-er/Arduino that referenced this issue Dec 15, 2018
devyte pushed a commit that referenced this issue Dec 19, 2018
* [PUYA] Applied ESPeasy puya_v3.patch

Applied the patch to get the starting point as described in #5493

* [PUYA] Only allocate memory when PUYA detected

core 2.5.0 PUYA patch, no puya:

Description	Function	#calls	call/sec	min (ms)	Avg (ms)	max (ms)
Save File		4	0.25	34.755	45.264	67.620
Free Mem:	16168

core 2.5.0 PUYA patch, Faked Puya detect:

Description	Function	#calls	call/sec	min (ms)	Avg (ms)	max (ms)
Save File		2	0.04	41.332	57.544	73.756
Free Mem:	11560

* [PUYA] Check for PUYA chip as soon as possible at boot

Check for PUYA chip in call for `getFlashChipId()`
This will only be done once and the result of the get function is also cached.

* [PUYA] Use limited buffer (512 byte) allocated at first write

No need to allocate a buffer when not writing to flash.
The default buffer size is 512 bytes, which is 2 pages in the flash chip.

* [PUYA] Lower PUYA flash buffer to 1 page (256 B)

As discussed here: #5493 (comment)

* [PUYA] Fix indents naming and return conditions

* [PUYA] Move Puya write code to spi_flash_write_puya

* [PUYA] Make spi_flash_write_puya static and define PUYA_SUPPORT

* [PUYA] Add some SPI flash vendor IDs

As requested by @igrr #5504 (comment)

* [PUYA] All suggested changes.

See: #5504 (review)
@devyte
Copy link
Collaborator

devyte commented Dec 19, 2018

@TD-er Thank you for working to get this done!
Closing via #5504 .

@devyte devyte closed this as completed Dec 19, 2018
@devyte devyte self-assigned this Dec 19, 2018
@devyte devyte added this to the 2.5.0 milestone Dec 19, 2018
@uzi18
Copy link

uzi18 commented Dec 19, 2018

Nice job @TD-er

@johncoles
Copy link

johncoles commented Dec 20, 2018

Hello I have tried pulling this in to my machine from Git but I still seem to have issues. Any hints on how to check this is working?

I've run the test Sketches from the initial thread but running the test write code is still yielding empty lines?

Sketches:
WriteReadTest.ino
FlashInfo.ino

WriteReadTest.ino Log

11:54:46.909 -> ====== Writing to SPIFFS file =========
11:54:46.943 -> 62296
11:54:46.943 -> 62296
11:54:46.943 -> 62296
11:54:46.943 -> 62296
11:54:46.977 -> 62296
11:54:46.977 -> 62296
11:54:46.977 -> 62296
11:54:46.977 -> 62296
11:54:47.012 -> 62296
11:54:47.012 -> 62296
11:54:47.012 -> ====== Reading from SPIFFS file =======
11:54:47.948 -> 1:
11:54:48.925 -> 2:
11:54:49.946 -> 3:
11:54:50.931 -> 4:
11:54:51.931 -> 5:
11:54:52.932 -> 6:
11:54:53.936 -> 7:
11:54:54.946 -> 8:
11:54:55.943 -> 9:
11:54:56.934 -> 10:

FlashInfo.ino Log

12:03:07.885 ->  ==========================================================
12:03:08.794 -> Firmware: 
12:03:08.828 ->  Chip Id: 0097A7C9
12:03:08.828 ->  Core version: 4c04c63c
12:03:08.865 ->  SDK version: 3.0.0-dev(c0f7b44)
12:03:08.903 ->  Boot version: 31
12:03:08.937 ->  Boot mode: 1
12:03:08.937 -> __________________________
12:03:08.971 -> 
12:03:08.971 -> Flash chip information: 
12:03:09.009 ->  Flash chip Id: 00146085 (for example: Id=001640E0 Manuf=E0, Device=4016 (swap bytes))
12:03:09.080 ->  Sketch thinks Flash RAM is size: 1.00 MB
12:03:09.113 ->  Actual size based on chip Id: 1.00 Flash frequency: 40.00 MHz
12:03:09.184 ->  Flash write mode: QIO
12:03:09.218 ->  CPU frequency: 160 MHz
12:03:09.218 -> 
12:03:09.254 -> __________________________
12:03:09.254 -> 
12:03:09.254 -> File system (SPIFFS): 
12:03:09.292 ->  Total KB: 110.55 KB
12:03:09.330 ->  Used KB: 0.00 KB
12:03:09.330 ->  Block size: 4096
12:03:09.363 ->  Page size: 256
12:03:09.363 ->  Maximum open files: 5
12:03:09.401 ->  Maximum path length: 32
12:03:09.436 -> 
12:03:09.436 -> __________________________
12:03:09.473 -> 
12:03:09.473 -> SPIFFS directory {/} :

@TD-er
Copy link
Contributor Author

TD-er commented Dec 20, 2018

Did you set the build flag to activate this patch?
PUYA_SUPPORT must be set to 1
Thus: -DPUYA_SUPPORT=0

@johncoles
Copy link

johncoles commented Dec 20, 2018

AH! That makes sense, sorry 6 hours of debugging my own code then I found this :D
How do I set that??

I have added #define PUYA_SUPPORT=1 in my Sketch but still no luck...
Here's a verbose compile log view log

@TD-er
Copy link
Contributor Author

TD-er commented Dec 20, 2018

You must define it as a global define when building it and probably make a clean build.
Or else it will not re-build the core libs.
You can also edit the cores/esp8266/Esp.h file to set the define to 1.

 #ifndef PUYA_SUPPORT
   #define PUYA_SUPPORT 1
 #endif

@johncoles
Copy link

Whooo! Changing it in the cores/esp8266/Esp.h worked. Many thanks again for your help and this fix!

@TD-er
Copy link
Contributor Author

TD-er commented Dec 20, 2018

Thanks for testing it.

@carlosmtolosa
Copy link

Hello @ALL you Gurus...

Just a favor for us amateurs and ignorants in the matter: can you please give a link with the patch and a small explanation in mortal language of how to install (use) it?

Many THANKS for your incredible work.

@TD-er
Copy link
Contributor Author

TD-er commented Jan 3, 2019

@carlosmtolosa As an example you can see how we use it in the PlatformIO.ini file for ESPeasy:
https://github.com/letscontrolit/ESPEasy/blob/5ee18ec556c9c58802af29f5fd78593905ef35c1/platformio.ini#L80-L88

@daniftodi
Copy link

@TD-er in which version of platform IO was this patch merged? (If it's not merged yet in a published version, what are the steps to use it?

I was waiting for months for this patch. Thank you for fixing this.

@uzi18
Copy link

uzi18 commented Jan 4, 2019

same file, but look at lines 106-108

@TD-er
Copy link
Contributor Author

TD-er commented Jan 4, 2019

@daniftodi It is included in the staging version of core 2.5.0
The important lines are:

  • Define PUYA_SUPPORT=1 (-DPUYA_SUPPORT=1)
  • Use platform = https://github.com/platformio/platform-espressif8266.git#feature/stage (like @uzi18 pointed out)

I will try to make a git branch on my own repository, so it is included in the older core versions too.
This makes it easier to build patched versions on core 2.4.x (and 2.3.x)

@TD-er
Copy link
Contributor Author

TD-er commented Jan 5, 2019

@daniftodi
I just made a patch for older versions of the core libraries to have this version backported.
Patch file

And also I made tar.gz downloads for the older core libraries.
Not sure if @ivankravets does want to make those available too, but for now it would be nice to have them tested.
See this commit to get inspired on how to use these patched downloads in your own platformio.ini file.
I only applied the patch on the latest versions of these core libs and changed the package.json file to include -puya in the version number.

@daniftodi
Copy link

Thank @TD-er. I'm using espressif8266 and have written some code based on this library. Can you tell me how to apply your patch on this? Because I have tried with development version (indicated inside platformio.ini the github link to project) and with PUYA_SUPPORT=1 flag and it didn't worked for me.

May be that I have to format somehow the SPIFFS before will be able to use PUYA_SUPPORT?

@ivankravets
Copy link
Collaborator

@TD-er what should be done on our site?

@TD-er
Copy link
Contributor Author

TD-er commented Jan 9, 2019

@TD-er what should be done on our site?

I think it would be nice to have the patch included in a platformio-archive of older core versions, like I did.
The core versions already released will not be backported with this Puya patch, but apparently there is some demand for it.
So if you can add the patch to a new build of core libs (2.3.0, 2.4.0, 2.4.1 and 2.4.2) so people can use them, I think that would be nice.

Like @daniftodi already showed, it is apparently not that obvious how to change the platformio.ini to include the right platform (e.g. https://github.com/TD-er/platform-espressif8266.git#patch/v1.7.3_Puya) and activate the Puya support. (add -DPUYA_SUPPORT=1 to the build flags)
So if it is included in the 'automatic update' way you normally update a mayor release with .1 etc. then it would make it a lot easier to use I guess.
Also since I had to add something like "-Puya" to it, I had to set the matching requirements to be the exact version or else things would not include the patch anymore if you release a newer version, but that also takes away the beauty of the semi-automatic updates you can normally apply without users having to worry.

@ivankravets
Copy link
Collaborator

We stopped maintaining custom packages and use only official releases. You are able to create own package and use it. I hope this feature platformio/platformio-core#1367 will help to use a custom package per build environment.

@TD-er
Copy link
Contributor Author

TD-er commented Jan 9, 2019

@ivankravets As you may have seen, I already created a custom version including this patch and we're using it for ESPeasy to build the nightly builds with it.
But like I said, others may also be interested so that's why I thought it would be nice to have included in the platformIO packages.
People can now use the version I supplied, but I think lots of people will loose some valueable time searching for the solution when writing to SPIFFS is not working.

But on the other hand, I get it when you don't want to add various patches and thus move away from the official core releases.

Is there a way for me to get notified when you create a new version of those older core packages?
Then I can keep up the merging/patching.

@joaocarlosss84
Copy link

Hi,

I was having some issues with a json file inside the SPIFFS which I read it (open() with 'r'), parse it, add new values to the jsonObject, write it back to the file (open() with 'w').

So, I applied the patched described by @PaulBortnikov at #4061 at the Esp.cpp which checks the flash, but now I'm getting several problems trying to write to the SPIFFS.
According to the Exception Decoder, looks like a problem to the "delete" of the buffer inside the EspClass::flashWrite.

Someone else with the same problem?

`
Exception (9):
epc1=0x4020fd88 epc2=0x00000000 epc3=0x00000000 excvaddr=0x30363a2a depc=0x00000000

stack>>>

ctx: sys
sp: 3fffed90 end: 3fffffb0 offset: 01a0
3fffef30: 4010185e 00000000 00000002 3ffef328
3fffef40: 3fffdc10 00000000 3fff3f4c 40249e1c
3fffef50: 40000f49 3fffdab0 3fffdab0 40000f49
3fffef60: 40000e19 40001878 00000001 00000000
3fffef70: 3fffff10 aa55aa55 000000ed 401053cc
3fffef80: 401053d2 00000001 00000000 212fd34d
3fffef90: 4010000d 3a9b9c6c 35040619 a012488b
3fffefa0: 00000000 3fffef3c 00000000 3fffff08
3fffefb0: 3fffffc0 00000000 00000000 feefeffe
3fffefc0: feefeffe feefeffe feefeffe feefeffe
3fffefd0: feefeffe feefeffe feefeffe feefeffe
3fffefe0: feefeffe feefeffe feefeffe feefeffe
3fffeff0: feefeffe feefeffe feefeffe feefeffe
3ffff000: feefeffe feefeffe feefeffe feefeffe
3ffff010: feefeffe feefeffe feefeffe feefeffe
3ffff020: feefeffe feefeffe feefeffe feefeffe
3ffff030: feefeffe feefeffe feefeffe feefeffe
3ffff040: feefeffe feefeffe feefeffe feefeffe
3ffff050: feefeffe feefeffe feefeffe feefeffe
3ffff060: feefeffe feefeffe feefeffe feefeffe
3ffff070: feefeffe feefeffe feefeffe feefeffe
3ffff080: feefeffe feefeffe feefeffe feefeffe
3ffff090: feefeffe feefeffe feefeffe feefeffe
3ffff0a0: feefeffe feefeffe feefeffe feefeffe
3ffff0b0: feefeffe feefeffe feefeffe feefeffe
3ffff0c0: feefeffe feefeffe feefeffe feefeffe
3ffff0d0: feefeffe feefeffe feefeffe feefeffe
3ffff0e0: feefeffe feefeffe feefeffe feefeffe
3ffff0f0: feefeffe feefeffe feefeffe feefeffe
3ffff100: feefeffe feefeffe feefeffe feefeffe
3ffff110: feefeffe feefeffe feefeffe feefeffe
3ffff120: feefeffe feefeffe feefeffe feefeffe
3ffff130: feefeffe feefeffe feefeffe feefeffe
3ffff140: feefeffe feefeffe feefeffe feefeffe
3ffff150: feefeffe feefeffe feefeffe feefeffe
3ffff160: feefeffe feefeffe feefeffe feefeffe
3ffff170: feefeffe feefeffe feefeffe feefeffe
3ffff180: feefeffe feefeffe feefeffe feefeffe
3ffff190: feefeffe feefeffe feefeffe feefeffe
3ffff1a0: feefeffe feefeffe feefeffe feefeffe
3ffff1b0: feefeffe feefeffe feefeffe feefeffe
3ffff1c0: feefeffe feefeffe feefeffe feefeffe
3ffff1d0: feefeffe feefeffe feefeffe feefeffe
3ffff1e0: feefeffe feefeffe feefeffe feefeffe
3ffff1f0: feefeffe feefeffe feefeffe feefeffe
3ffff200: feefeffe feefeffe feefeffe feefeffe
3ffff210: feefeffe feefeffe feefeffe feefeffe
3ffff220: feefeffe feefeffe feefeffe feefeffe
3ffff230: feefeffe feefeffe feefeffe feefeffe
3ffff240: feefeffe feefeffe feefeffe feefeffe
3ffff250: feefeffe feefeffe feefeffe feefeffe
3ffff260: feefeffe feefeffe feefeffe feefeffe
3ffff270: feefeffe feefeffe feefeffe feefeffe
3ffff280: feefeffe feefeffe feefeffe feefeffe
3ffff290: feefeffe feefeffe feefeffe feefeffe
3ffff2a0: feefeffe feefeffe feefeffe feefeffe
3ffff2b0: feefeffe feefeffe feefeffe feefeffe
3ffff2c0: feefeffe feefeffe feefeffe feefeffe
3ffff2d0: feefeffe feefeffe feefeffe feefeffe
3ffff2e0: feefeffe feefeffe feefeffe feefeffe
3ffff2f0: feefeffe feefeffe feefeffe feefeffe
3ffff300: feefeffe feefeffe feefeffe feefeffe
3ffff310: feefeffe feefeffe feefeffe feefeffe
3ffff320: feefeffe feefeffe feefeffe feefeffe
3ffff330: feefeffe feefeffe feefeffe feefeffe
3ffff340: feefeffe feefeffe feefeffe feefeffe
3ffff350: feefeffe feefeffe feefeffe feefeffe
3ffff360: feefeffe feefeffe feefeffe feefeffe
3ffff370: feefeffe feefeffe feefeffe feefeffe
3ffff380: feefeffe feefeffe feefeffe feefeffe
3ffff390: feefeffe feefeffe feefeffe feefeffe
3ffff3a0: feefeffe feefeffe feefeffe feefeffe
3ffff3b0: feefeffe feefeffe feefeffe feefeffe
3ffff3c0: feefeffe feefeffe feefeffe feefeffe
3ffff3d0: feefeffe feefeffe feefeffe feefeffe
3ffff3e0: feefeffe feefeffe feefeffe feefeffe
3ffff3f0: feefeffe feefeffe feefeffe feefeffe
3ffff400: feefeffe feefeffe feefeffe feefeffe
3ffff410: feefeffe feefeffe feefeffe feefeffe
3ffff420: feefeffe feefeffe feefeffe feefeffe
3ffff430: feefeffe feefeffe feefeffe feefeffe
3ffff440: feefeffe feefeffe feefeffe feefeffe
3ffff450: feefeffe feefeffe feefeffe feefeffe
3ffff460: feefeffe feefeffe feefeffe feefeffe
3ffff470: feefeffe feefeffe feefeffe feefeffe
3ffff480: feefeffe feefeffe feefeffe feefeffe
3ffff490: feefeffe feefeffe feefeffe feefeffe
3ffff4a0: feefeffe feefeffe feefeffe feefeffe
3ffff4b0: feefeffe feefeffe feefeffe feefeffe
3ffff4c0: feefeffe feefeffe feefeffe feefeffe
3ffff4d0: feefeffe feefeffe feefeffe feefeffe
3ffff4e0: feefeffe feefeffe feefeffe feefeffe
3ffff4f0: feefeffe feefeffe feefeffe feefeffe
3ffff500: feefeffe feefeffe feefeffe feefeffe
3ffff510: feefeffe feefeffe feefeffe feefeffe
3ffff520: feefeffe feefeffe feefeffe feefeffe
3ffff530: feefeffe feefeffe feefeffe feefeffe
3ffff540: feefeffe feefeffe feefeffe feefeffe
3ffff550: feefeffe feefeffe feefeffe feefeffe
3ffff560: feefeffe feefeffe feefeffe feefeffe
3ffff570: feefeffe feefeffe feefeffe feefeffe
3ffff580: feefeffe feefeffe feefeffe feefeffe
3ffff590: feefeffe feefeffe feefeffe feefeffe
3ffff5a0: feefeffe feefeffe feefeffe feefeffe
3ffff5b0: feefeffe feefeffe feefeffe feefeffe
3ffff5c0: feefeffe feefeffe feefeffe feefeffe
3ffff5d0: feefeffe feefeffe feefeffe feefeffe
3ffff5e0: feefeffe feefeffe feefeffe feefeffe
3ffff5f0: feefeffe feefeffe feefeffe feefeffe
3ffff600: feefeffe feefeffe feefeffe feefeffe
3ffff610: feefeffe feefeffe feefeffe feefeffe
3ffff620: feefeffe feefeffe feefeffe feefeffe
3ffff630: feefeffe feefeffe feefeffe feefeffe
3ffff640: feefeffe feefeffe feefeffe feefeffe
3ffff650: 000005e0 00000020 401040cd 3ffedf80
3ffff660: 0000013a 00000000 feefeffe 000000fb
3ffff670: 00000078 00000001 4010520e 3ffedf80
3ffff680: 3ffedf50 feefeffe 00000000 3fff442c
3ffff690: 3fff43fc 00000020 401040cd 3ffedf80
3ffff6a0: 00000005 00000000 00000020 40101ebe
3ffff6b0: 3ffe9e05 401052c3 3ffed818 000000fa
3ffff6c0: 40102bd9 3ffed818 4010520e 3ffedf80
3ffff6d0: 00007fff 0bcdf5d2 3ffee260 40102daa
3ffff6e0: 3ffea698 00000000 00000000 00000000
3ffff6f0: 00007fff 0bcdf5d2 401031ea 00000100
3ffff700: 7fffffff 3ffea698 3ffea698 00000001
3ffff710: 00000001 00001148 00000000 4000050c
3ffff720: 00000000 00000000 0000001f 40105ba5
3ffff730: 4000050c 40102f84 3fffc200 00000022
3ffff740: 400043e4 00000030 00000015 ffffffff
3ffff750: 400044ab 3fffc718 3ffff840 08000000
3ffff760: 00000005 00000000 00000020 40101ebe
3ffff770: 3ffe9e05 401052c3 3ffed868 60000200
3ffff780: 40102bd9 3ffed868 000eb504 00000030
3ffff790: 00000014 0bce4d3a 3ffee260 40102daa
3ffff7a0: 3ffea680 00000000 00000000 00000000
3ffff7b0: 00000014 0bce4d3a 401031ea 00000100
3ffff7c0: 7fffffff 3ffea680 3ffea680 00000001
3ffff7d0: 00000001 00000040 3fffc200 00000022
3ffff7e0: 3ffff7f0 0bce4d3a 00000000 4000050c
3ffff7f0: 3fffc278 40102f84 3fffc200 00000022
3ffff800: 3ffea6b0 00000000 3feffe00 00000004
3ffff810: 400043e6 00000030 00000015 ffffffff
3ffff820: 400044ab 3fffc718 3ffff910 08000000
3ffff830: 60000200 08000000 08000000 00000000
3ffff840: 00000000 00000000 0000001f 40105ba5
3ffff850: 4000050c 00000000 000eb8a8 00000030
3ffff860: 400043e6 00000030 00000015 ffffffff
3ffff870: 400044ab 3fffc718 3ffff960 08000000
3ffff880: 60000200 08000000 08000000 00000000
3ffff890: 0000ffff 00042035 00002035 60000200
3ffff8a0: 3fff45a4 000000a0 000eb760 00000030
3ffff8b0: 00000001 000007e9 000007e9 40101168
3ffff8c0: 3fff4544 3fff4544 00000000 00000000
3ffff8d0: 000eb505 000eb504 00000001 4021705c
3ffff8e0: ffffff7e 40214aac 00000004 40214ab5
3ffff8f0: 00000001 4000422e 00002710 402160a6
3ffff900: 00000000 4000444e 000000fc 00000000
3ffff910: 00000000 4000422e 60000200 3fff45e8
3ffff920: 00000100 40004aa0 000000f8 000eb808
3ffff930: 00000100 3fff4544 3fffc718 000eb808
3ffff940: 3fff00a8 000007e9 000007e9 40101168
3ffff950: 00000000 4000444e 00000000 401015ac
3ffff960: 00000000 400041bc 60000200 3fff4644
3ffff970: 00000100 40004b14 00000100 000eb700
3ffff980: 00000100 3fff4544 3fffc718 000eb800
3ffff990: 3fff00a8 000007e9 000007e9 40101168
3ffff9a0: 3fff4544 3fff4544 00000000 401015ac
3ffff9b0: 3fffc718 3fff4544 3fff293c 4022141d
3ffff9c0: 40214abe 40214aac 00000100 40214ab5
3ffff9d0: 00000001 2264227b 00002710 402160a6
3ffff9e0: 74222c31 39333a22 77222c30 000eb700
3ffff9f0: 000eb800 000eb800 00000100 40216fe1
3ffffa00: 74222c32 38343a22 77222c30 32313a22
3ffffa10: 7b2c7d36 3a226922 74222c35 32313a22
3ffffa20: 222c3030 363a2264 77222c30 35323a22
3ffffa30: 7b2c7d34 3a226922 74222c36 34353a22
3ffffa40: 64222c30 30363a22 2277222c 3435323a
3ffffa50: 0a7d5d7d 00000000 00000020 40101ebe
3ffffa60: 00000006 00000000 0000000a 00000000
3ffffa70: 00000006 00000000 0000000a 00000000
3ffffa80: 4010492e feefeffe feefeffe feefeffe
3ffffa90: 00000000 a0000000 00000000 0000001c
3ffffaa0: 00006000 3fff2a3c 00006000 00000000
3ffffab0: 3ffffc10 00000000 3ffffc10 4021fa1e
3ffffac0: 00000005 00000000 00000020 40101ebe
3ffffad0: 3ffe9e05 401052c3 3ffed868 00000000
3ffffae0: 40102bd9 3ffed868 0000000a 00000000
3ffffaf0: 00007fff 0bcf7417 3ffee260 40102daa
3ffffb00: 3ffea6a4 00000000 00000000 0000001c
3ffffb10: 00007fff 0bcf7417 401031ea 00000100
3ffffb20: 7fffffff 3ffea6a4 3ffea6a4 00000001
3ffffb30: 00000001 00004108 413d3822 00000008
3ffffb40: 3fff0afc 0bcf7417 00002200 4000050c
3ffffb50: 3fffc278 40102f84 3fffc200 00000022
3ffffb60: 3ffea698 3fff31dc 3ffed570 00000000
3ffffb70: 4000e292 00000030 00000005 ffffffff
3ffffb80: 00000002 00000000 00000020 40101ebe
3ffffb90: 3ffe9e02 401052a8 3ffed570 00000007
3ffffba0: 00000001 401044cb 3ffedfc8 80000000
3ffffbb0: 4010492e 38000000 4021f958 00000030
3ffffbc0: 3ffe9e00 401052a8 3fff0cbc 00000000
3ffffbd0: 40104412 0000003f 7fffffff 00000002
3ffffbe0: 0000013f 4010420e 00040000 40223404
3ffffbf0: 40103287 00080000 3f302064 4021fa1e
3ffffc00: 00000000 3ffe8b38 00002200 4000050c
3ffffc10: 3fffc278 40102f84 3fffc200 00000022
3ffffc20: 3ffffc30 3ffe8b39 3ffffcd0 4021fc08
3ffffc30: 4021b39e 00000030 00000010 ffffffff
3ffffc40: 4021fe2f 3ffffee8 0000000c 0000000c
3ffffc50: 4021f958 00000006 00000000 00000005
3ffffc60: 000000a0 40255bf0 3ffffdc3 3ffffd80
3ffffc70: 0000000f 00000000 00000010 00000000
3ffffc80: 0000000f 00000000 00000010 00000000
3ffffc90: 00000001 401044cb 3ffedfc8 40223458
3ffffca0: 00000000 80000000 00000000 0000001b
3ffffcb0: 00007800 00000000 00007800 00000000
3ffffcc0: 3ffffe20 00000000 3ffffe20 4021fa1e
3ffffcd0: 00008000 3ffffdc3 00000000 0000001c
3ffffce0: 40103287 00080000 4021b40c 00000002
3ffffcf0: 3ffffe20 00000002 3ffffe20 4021fa1e
3ffffd00: 3ffffd80 3ffffdc1 3ffffd30 00000000
3ffffd10: 3ffe9e05 401052c3 3ffed818 4021f958
3ffffd20: 3ffffe20 3ffffdc1 3ffffd80 00000000
3ffffd30: 3ffffe90 00000000 3ffffe90 4021fa1e
3ffffd40: 00000000 3ffffe33 3ffffe20 4021fa1e
3ffffd50: 3ffffdc3 402526bf 00000000 00000018
3ffffd60: 3ffffe90 00000018 3ffffe90 4021fa1e
3ffffd70: 00000000 00000000 00000020 40101ebe
3ffffd80: 3ffe9e00 401052a8 3fff0cbc 40101ebe
3ffffd90: 00000005 00000000 00000020 40101ebe
3ffffda0: 3ffe9e05 401052c3 3ffed818 40102daa
3ffffdb0: 40102bd9 3ffed818 3ffee260 40102daa
3ffffdc0: 00000012 0bd28202 3ffee260 40102daa
3ffffdd0: 3ffea6bc 00000000 00000000 00000100
3ffffde0: 00000012 0bd28202 401031ea 00000100
3ffffdf0: 00000000 00000000 0000001f 40105ba5
3ffffe00: 4000050c 00000040 3fffc200 00000022
3ffffe10: 40000e32 00000030 00000010 ffffffff
3ffffe20: 40215fe9 00000001 00000000 00000000
3ffffe30: 00000000 00000000 0000001f 40105ba5
3ffffe40: 4000050c 3fffc6fc 00000001 00000000
3ffffe50: 4020effc 00000030 00000010 ffffffff
3ffffe60: 4020effc 00000000 00000001 00000000
3ffffe70: 00000000 00000000 00000000 fffffffe
3ffffe80: ffffffff 3fffc6fc 00000001 3ffef83c
3ffffe90: 3ffef83c 3fffdad0 3ffefed8 00000030
3ffffea0: 00000000 00000000 00000000 fffffffe
3ffffeb0: ffffffff 3fffc6fc 00000001 3ffefea4
3ffffec0: 00000000 3fffdad0 3ffefed8 00000030
3ffffed0: 3ffefc75 3ffefbf8 00000000 4020e9d9
3ffffee0: 3ffefc75 00000594 00000005 3ffefc4c
3ffffef0: 3fff00a8 0000072a 0000072a 40101168
3fffff00: 00000000 3fffff50 3ffe8660 3ffef83c
3fffff10: 3ffefbf8 000000b4 3ffef758 40210e25
3fffff20: 3ffe8b36 3fffff50 00000000 40201bbf
3fffff30: 3a3032fe 3ffef83c 3ffef754 40217644
3fffff40: 3ffefc75 3ffef83c 3ffef754 402123d4
3fffff50: 40217bf0 00000000 00001388 3ffefed8
3fffff60: 00000000 00000000 3ffef83c 4020f82d
3fffff70: 3fffdad0 3ffef83c 3ffefea4 4020dc1b
3fffff80: 00000000 3ffe91bf 3ffe8755 feefeffe
3fffff90: 00000000 00000000 00000001 40215fe9
3fffffa0: 3fffdad0 00000000 3ffefea4 4021607a
<<<stack<<<

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

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

wdt reset
`

@rupin
Copy link

rupin commented Nov 9, 2019

I came to this issue from the original issue #4061.After much deliberation, I decided to save my settings into EEPROM.

EEPROMs have limited write cycles, but they are pretty huge (4096 bytes for the ESP01), and ESP01's are cheap, but it is possible and it works. You will be able to see working sample code here. https://github.com/rupin/IoT-Projects/blob/master/TriggerAlarm/TriggerAlarm.ino

I hope someone finds this useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests