Left here for archival purposes.

User avatar
By jas
#37479 Hi,

I have the NodeMCU DEVKIT v0.9 05/12/2014 board.

I connect the NodeMCU to Linux (Lubuntu) via ttyUSB0.
I can and have writen firmware to the chip/ board successfully any number of times using
esptool with the following command
Code: Select allsudo python esptool.py --port=/dev/ttyUSB0 write_flash 0 nodemcu_integer_0.9.6-dev_20150704.bin


I can also successfully program the board/ chip any number of times using the Arduino IDE.

However when I use luatool to program the board/ chip with the command
Code: Select allsudo ./luatool.py --port /dev/ttyUSB0 --src init.lua --dest init.lua --verbose


I get the errors
Code: Select allUpload starting
Stage 1. Deleting old file from flash memory
->file.open("init.lua", "w")Traceback (most recent call last):
  File "./luatool.py", line 268, in <module>
    transport.writeln("file.open(\"" + args.dest + "\", \"w\")\r")
  File "./luatool.py", line 107, in writeln
    self.performcheck(data)
  File "./luatool.py", line 60, in performcheck
    raise Exception('No proper answer from MCU')
Exception: No proper answer from MCU


I have done extensive googling and can find no answer to this problem.

Yesterday all was well; when the chip arrived I was able to upload any number of test init.lua scripts.

Then for no obvious reason the above error started appearing, very consistently, with no remission, and no ability to load up new test init.lua scripts.

That is when I started trying the Arduino IDE. Really I did this to see if the board/ chip was bricked; what I discovered was Arduino IDE could successfully load the blinky sketch onto the board/ chip. This was tested and shown to be working with an LED across the appropriate pins. Other Arduino sketches also load successfully.

So the board/ chip is not bricked.

Before luatool stopped working I loaded about 30 test init.lua scripts on board.
Also the command sudo screen /dev/ttyUSB0 9600 worked fine.
Then for the rest of yesterday I tried about 50 times with different small tweaks to things like file privileges, change of USB cable, port, new s/w from github etc.

This morning I flashed the board/ chip again with a newly found line (google)
Code: Select allsudo python esptool.py --port=/dev/ttyUSB0 write_flash 0 nodemcu_integer_0.9.6-dev_20150704.bin -fs 32m -fm dio -ff 40m

Immediately after trying this the first time I managed to load test init.lua files using luatool before it then stopped working again. While it was working the command sudo screen /dev/ttyUSB0 9600 worked fine.
I was also able to see the (init.lua programmed) test page served by the Board/ chip from 192.168.1.230 in the laptop browser; the web links were switching the appropriate pins on and off as intended.

The chip is not bricked.

There is a problem with either Luatool reliability or Esptool or the .bin firmware on Linux.

Ideas as to why it worked 30 times or so yesterday, and then suddenly, for no reason that is obvious to me, stopped working, might point me in the right direction.

In my reading I see that some people feel there may be timing or bi-directional issues with the data send down the USB cable.

Of course; if anyone can point me to the solution I will be forever grateful.

Frustratingly yours

Thank you
User avatar
By jas
#37491 I picked the suggested build options for a custom firmware build at
http://nodemcu-build.com
and got an email once the build was done. I clicked the link to download the .bin file, see below, and flashed with esptool.

Now I can successfully and repeatably upload init.lua scripts with luatool.

ps here is the build I am using
http://nodemcu-build.com/builds/nodemcu ... nteger.bin