-->
Page 1 of 1

Esp8266 rebooting when GETing a large file

PostPosted: Sat May 07, 2016 7:39 am
by vcch
Hi !

I'm trying to make a piece of software that GET a file on a server and displays it on a 128x128 SPI display.
It works well until the file stay small than 20K. Above this size, the ESP reboots.

Not clear why. Any idea ?

function showpic()
file.open("avcp","r")
for x=0,127,2 do
for y=0,127,2 do
r=string.byte(file.read(1))
g=string.byte(file.read(1))
b=string.byte(file.read(1))
disp:setColor(r,g,b)
disp:drawHLine(x,y,2)
disp:drawHLine(x,y+1,2)
end
end
file.close()
end

jdone=0
startload=0

conn=net.createConnection(net.TCP)
conn:on("receive", function(cnn, pl)
if (startload==0) then
print("Got header"..pl.."[[")
startload=1
file.open("avcp","w")
else
l=l+pl:len()
file.write(pl)
print(l)
end
end)

conn:on("sent",function(conn)
print("Envoyé !")
jdone = jdone + 1
end)

conn:on("disconnection",function(conn)
print("Disconnected")
file.close()
collectgarbage()
showpic()
end)

conn:on("connection",function(cnn)
print("Connecté")
cnn:send("GET <my_file> HTTP/1.1\r\nHost: cluster015.ovh.net\r\nConnection: keep-alive\r\nAccept: */*\r\nUser-Agent: Mozilla/4.0\r\n\r\n")
end)


conn:on("sent",function(conn)
print("Sent")
end)

conn:connect(80,'<my_server>')

Re: Esp8266 rebooting when GETing a large file

PostPosted: Sun May 08, 2016 10:56 am
by coldpenguin
Is it possible to put a serial console on at the 78400 rate? The cause of the reset could be a corruption, memory full or watchdog timeout. The cause should be listed when the device resets, to the serial port

Re: Esp8266 rebooting when GETing a large file

PostPosted: Mon May 09, 2016 1:08 am
by vcch
In fact the bug with file sizes > 28 K is mentionned elsewhere. This seems to be a software issue. So far my solution is to generate names "picfil"+x with files < 28k

The new issue i'm encoutering is the following : when using UCGLib to adress the screen (ili9163), the first file displayed works well, but the next have colors distorsion (to much green or blue). This is very weird...

Re: Esp8266 rebooting when GETing a large file

PostPosted: Mon May 16, 2016 11:42 pm
by jeffrey92
Um.. 20K is not *small* with regard to the ESP8266. It only has 96K of memory and the SDK uses around 36K of that. If you're using Arduino it goes down even lower, to something like 25 - 35K.

So you're probably exhausting the memory. Which means you need to GET stuff in smaller chunks and process them or write to SPI Flash to save them and free up RAM.