Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By vcch
#47042 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>')
User avatar
By vcch
#47163 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...
User avatar
By jeffrey92
#47539 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.