Open joysfera opened 7 years ago
I have same problem here :( Found a solution ??
Just a work-around. IIRC https://github.com/4refr0nt/luatool worked OK.
need to get me a esp32 i think. Looks as if the method of detecting a working device is not working as it should.
I've had the same issue when trying to communicate with the ESP8266 chip on my Adafruit Feather Huzzah. Installing the cp210x.ko kernel module driver from Silicon Labs (which the Adafruit guide links to) didn't fix it either.
Just like for @joysfera, I can communicate with my device using nodemcu-uploader terminal
or screen /dev/ttyUSB0 9600.
However, I need access to init.lua because lua: cannot open init.lua
.
Whenever I try nodemcu-uploader download init.lua --port /dev/ttyUSB0
I get
nodemcu_uploader.exceptions.DeviceNotFoundException: Device not found or wrong port
as well.
As a workaround comment next line in uploader.py
self.__expect('%sync%\r\n> ')
But NodeMCU on ESP32 does print the '>' char prompt, just like on the ESP8266, doesn't it? Does it perhaps omit the '\r' or what's up?
I don't know, I haven't check. I am not really good at python. I'll try to check.
I split the expect sync line to two lines and got me further, but now I'm hitting a different problem.
self.__expect('%sync%\r\n')
self.__expect()
Uploading binary file in verbose mode causes it to print garbage. This patch fixes it. Hope it helps somebody.
diff --git a/nodemcu_uploader/uploader.py b/nodemcu_uploader/uploader.py
index e12d243..b8a15e2 100644
--- a/nodemcu_uploader/uploader.py
+++ b/nodemcu_uploader/uploader.py
@@ -74,7 +74,8 @@ class Uploader(object):
time.sleep(self.autobaud_time) # Wait for autobaud timer to expire
self.__exchange(';') # Get a defined state
self.__writeln('print("%sync%");')
- self.__expect('%sync%\r\n> ')
+ self.__expect('%sync%\r\n')
+ self.__expect()
except CommunicationTimeout:
raise DeviceNotFoundException('Device not found or wrong port')
@@ -375,7 +376,7 @@ class Uploader(object):
log.debug('pad with %d characters', padding)
data = data + (' ' * padding)
log.debug("packet size %d", len(data))
- self.__write(data)
+ self.__write(data, True)
self._port.flush()
return self.__got_ack()
Tried all above mentioned patches, nothing helped.
FYI, working on a real fix. Seems like the issue is related to multiple Lua commands in one line. Doesn't make sense but spliting the commands to separate lines seems to help so I'm giving it a try.
I'm using a SparkFun ESP-32 Thing and had to rebuild the firmware for 26MHz.
I found that commenting out the auto-baud code in uploader.py
, i.e.
#self.__writeln('UUUUUUUUUUUU') # Send enough characters for auto-baud
self.__clear_buffers()
#time.sleep(0.30) # Wait for autobaud timer to expire
helps. BUT not all the time.
When I get the usual error, then I connect as a terminal, enter =print 'please work'
, exit and try again. The actual string printed doesn't matter.
nodemcu-uploader fails on NodeMCU for ESP32 on my esp32 dev board. No idea why. The 'terminal' works normally, but the 'upload' dies this way: