Filesystem problem - lack of memory SPIFF ?
Posted: Thu Aug 11, 2016 11:36 am
I have trying to program ESP8266-1 in lua for a few days, so it could be problem that I'm doing something wrong. I have written simple program to test files.
Idea was to get as much data as I could from sensor. It mean that I was going to write data to file, and when filesystem would be full delete oldest file.
after several runs (about 340) my module hangs, reset with reset code 2 !!! what was impossible. Reset pin pulled.
module doesn't respond to Esplorer even when I try to change lua file
but after format module work OK.
Question is if there is a bug or am I doing sth wrong
my module ESP8266-1,
there is my code
Best regards
Kamil
Idea was to get as much data as I could from sensor. It mean that I was going to write data to file, and when filesystem would be full delete oldest file.
after several runs (about 340) my module hangs, reset with reset code 2 !!! what was impossible. Reset pin pulled.
curr file 348 file to del 51
Waiting answer from ESP - Timeout reached. Command aborted.
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x40100000, len 25952, room 16
tail 0
chksum 0xe0
load 0x3ffe8000, len 2256, room 8
tail 8
chksum 0xf3
load 0x3ffe88d0, len 8, room 0
tail 8
chksum 0xbf
csum 0xbf
module doesn't respond to Esplorer even when I try to change lua file
>
file.remove("meas.lua");
> file.open("meas.lua","w+");
Waiting answer from ESP - Timeout reached. Command aborted.> w = file.writeline
>
but after format module work OK.
Question is if there is a bug or am I doing sth wrong
my module ESP8266-1,
NodeMCU custom build by frightanic.com
branch: master
commit: 98d3b46e2c11068f361154a564ce75a048c9dadc
SSL: true
modules: adc,bit,file,gpio,http,i2c,net,node,ow,rtcfifo,rtcmem,rtctime,sntp,spi,tmr,uart,wifi
build built on: 2016-08-05 08:59
powered by Lua 5.1.4 on SDK 1.5.4.1(39cb9a32)
there is my code
Code: Select all
if singleLua==nil then
singleLua=0
print ("init")
FileCurrNumber=0
FileDelNumber=1
end
dane=FileCurrNumber
for num=0, 100, 1 --init data file
do
dane=dane.." aazzaaax"
end
if singleLua~=0 then
singleLua=singleLua+1
if singleLua>3 then
singleLua=0
end
print(singleLua.." meas ")
return
end
singleLua=1
maxFileNr=500 --OK
FileName='awyn' --OK
FileExt='.dat' --OK
r,u,t=file.fsinfo() print("Total : "..t.." bytes\r\nUsed : "..u.." bytes\r\nRemain: "..r.." bytes\r\n")
if(r<20000) then --less than 20k free
maxFileNr=1 --delete one file
end
r=nil u=nil t=nil
print("curr file "..FileCurrNumber.." file to del "..FileDelNumber)
FileCurrNumber=FileCurrNumber+1
fileCntr=FileCurrNumber+1-FileDelNumber
fileCurrName=tostring(FileName..FileCurrNumber..FileExt)
file.open(fileCurrName ,"w+")
file.write(dane)
--wyn=file.seek()
--print('dlugosc = '..wyn)
file.flush()
file.close()
print (fileCurrName)
print (fileCntr)
if fileCntr>maxFileNr then
fileDelName=tostring(FileName..FileDelNumber..FileExt)
file.remove(fileDelName)
FileDelNumber=FileDelNumber+1
end
singleLua=0
Best regards
Kamil