1

I have a problem with ESP8266 12E and 12F series about write commands. When I need to write data to the flash in ESP8266 it only allows to around 6800 times with (w+) command. I am using both integer and float and lastest and previous firmwares but nothing changes. An example simple code is below. With ESPlorer I run the codes and when both test1 lua and test2 lua reaches to 3400 file system starts to reset the module. I only activate module by formatting it. If I use just one file it reaches around 6800 cycle of writing. With (a+) command and 2 files I only managed to write up to total 13600 number somehow. Then again a format is needed. I do not how to erase and where to erase flash form lua file. Any help would be appreciated.

test=0
tmr.alarm(6, 100, 1, function() 
             file.open("test1.lua","w+")       
              file.writeline(test)
            file.close()
             file.open("test2.lua","w+")       
              file.writeline(test)      
            file.close()

            test=test+1
end)
test gprs
  • 169
  • 3
  • 16
  • Did you try to change the data size to be written into file? For example the text: `1234567890`. Currently it looks like you're writing 0 and \n? – Mert Gülsoy Mar 10 '16 at 09:10
  • Also it is important that you must determine the reset reason. When esp resets it prints the reset reason. Check [this](http://stackoverflow.com/questions/34826257/esp8266-at-firmware-doesnt-say-its-ready/34838735#34838735) – Mert Gülsoy Mar 10 '16 at 09:21
  • I changed data size, I wrote "0123456789ABCDEFG" data every cycle. At the 3420's cycle program restarted. While the program running, I watched serial 748880's port. When program restarted, came garbage data on serial and I reset esp 8266 i saw,rst cause:2, after this reset. – test gprs Mar 10 '16 at 12:20
  • rst cause:2 means device is reset by using reset pin. If you reset the esp manually, you'll get this. If the device resets itself you should get another code. When you say "program restarted" did you observe any `rst cause` or do you have to reset to get the device functional? – Mert Gülsoy Mar 10 '16 at 13:18
  • Program was restarted (at the error) came only [garbage data](http://oi65.tinypic.com/rsc5xi.jpg) after then i restart esp8266 (energy restart) came [normal data](http://oi68.tinypic.com/2d9se38.jpg). – test gprs Mar 10 '16 at 13:37
  • I control rst cause respond for soft restart in nodemcu firmware. i use [node.restart()](http://nodemcu.readthedocs.org/en/dev/en/modules/node/#noderestart) function for this test. I saw [garbage data](http://oi64.tinypic.com/2vlsh2q.jpg) like error respond. Maybe rst cause respond only visible energy restart for nodemcu fimware. – test gprs Mar 10 '16 at 13:59
  • Can you try adding file.flush() before file.close()? (_I would like to test them but currently I dont have ESP with me, sorry_) – Mert Gülsoy Mar 10 '16 at 15:36
  • I try it but there is no effect this error. – test gprs Mar 10 '16 at 15:59

0 Answers0