Current Lua downloadable firmware will be posted here

User avatar
By Yomero
#49836 OK, sorry for my poor offered information about my software and hardware, this is what i have and what i do today from scratch:

Macbook with docker environment correctly installed and running and esptool installed too
Nodemcu board 0.9 (ESP8266MOD from AI-Thinker, ESP-12 module, 16 pins, nodemcu 0.9.6 firmware to start)

Step 1
Marcelstoer nodemcu-firmware repository cloned (latest master release cloned) through

Code: Select allgit clone https://github.com/nodemcu/nodemcu-firmware.git


to my user folder -> nodemcu-firmware, done

Step 2
Build the firmware through docker console (i just want INTEGER firmware), change to my nodemcu-firmware folder an then

Code: Select alldocker run -e "INTEGER_ONLY" -e --rm  -ti -v `pwd`:/opt/nodemcu-firmware marcelstoer/nodemcu-build


no file edited from app/include folder (all that lovely code running like hacker movie from console 8-) ) i don´t paste here the whole console output because is huge

and i get the .bin finished correctly (nodemcu_integer_master_20160626-2132.bin), done

Step 3
Flashing the .bin file through esptool

Code: Select allesptool.py --port /dev/cu.wchusberserial1410 write_flash -fm dio -fs 32m 0x00000 nodemcu_integer_master_20160626-2132.bin


esptool.py v1.1
Connecting...
Running Cesanta flasher stub...
Flash params set to 0x0240
Writing 405504 @ 0x0... 405504 (100 %)
Wrote 405504 bytes at 0x0 in 35.2 seconds (92.2 kbits/s)...
Leaving...

done

Step 4
Exit from all the console windows and test via Lua Uploader serial window at 115200 bauds, and this is what i have

Code: Select allSENT: node.restart()
s$rl???

NodeMCU 1.5.1 build unspecified powered by Lua 5.1.4 on SDK 1.5.1(e67da894)


after the second restart, i have this

Code: Select allets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 27528, room 16
tail 8
chksum 0x2d
load 0x3ffe8000, len 2184, room 0
tail 8
chksum 0x9a
load 0x3ffe8888, len 8, room 0
tail 8
chksum 0xc1
csum 0xc1
don't use rtc mem data
;l???

NodeMCU 1.5.1 build unspecified powered by Lua 5.1.4 on SDK 1.5.1(e67da894)


the module seems no restart randomly, but this is the script i run to test and have a bad behaviour

init.lua

Code: Select allwifi.setmode(wifi.STATION)
wifi.sta.config("INF1N1TUM1369","3ncr1pt4d4")
dofile("flovidpdoRESPUESTA.lua")


flovidpdoRESPUESTA.lua

Code: Select allfunction datos()
   azar = math.random(0,10)
   conn = net.createConnection(net.TCP, 0)
   conn:on("receive", function(conn, payload)
       print(payload)
    end)
   conn:on("connection", function(conn, payload)
      print("Conectado a flovid...")
      print("Enviando dato: "..azar)
      conn:send("GET /valoresPDO.php?valmed="..azar.." HTTP/1.1\r\n")
      conn:send("Host: lab.flovid.com.mx\r\n")
      conn:send("Accept: */*\r\n")
      conn:send("User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n")
      conn:send("\r\n")
   end)
   conn:connect(80,"lab.flovid.com.mx")
   conn:on("disconnection", function(conn)
      print("Desconectado de flovid...")
      print("-------------------------")
   end)
end
datos()
--Se ejecuta el envío de datos cada 1 minuto
tmr.alarm(1, 60000, 1, function() datos() end)


the code just send a random value between 0 and 10 and record the value in a MySql DB to the remote server, so when new data is stored to the DB the PHP page returns a message that a sucess record was entered to de data base

with the 0.9.6 firmware all works perfectly, but in the new firmware no more i don´t have a response from the server and the random values always seems to be the same (10,10,7, 9 and go so on...) after a new restart.

I hope with this info you can help me this time

Thanks a lot for your time and patience, regards
User avatar
By marcelstoer
#49837 You obviously don't have a problem upgrading the firmware, sigh. Otherwise you'd get constant restarts even without any Lua files in the file system. When you debug issues you should always establish a baseline first and then work from there.

Your problem is that multiple consecutive "conn:send" calls are no longer supported. After 0.9.x Espressif changed that operation to be asynchronous i.e. non-blocking. See http://nodemcu.readthedocs.io/en/dev/en ... socketsend for details.
User avatar
By Yomero
#49877 Finally I was able to work the code this way :

in one row, not in block

Code: Select allconn:send("GET /valoresPDO.php?valmed="..azar.." HTTP/1.1\r\nHost: lab.flovid.com.mx\r\nAccept: */*\r\nUser-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n\r\n")


And the module has been working all night without any reboot or issue, even with the message at the beginning

Code: Select all ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 27528, room 16
tail 8
chksum 0x2d
load 0x3ffe8000, len 2184, room 0
tail 8
chksum 0x9a
load 0x3ffe8888, len 8, room 0
tail 8
chksum 0xc1
csum 0xc1
don't use rtc mem data
;l???


Thnk you very much @marcelstoer for your help, continue the great work you do ;)