Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32 not supported? #72

Open
joysfera opened this issue Jun 15, 2017 · 12 comments
Open

ESP32 not supported? #72

joysfera opened this issue Jun 15, 2017 · 12 comments

Comments

@joysfera
Copy link

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:

$ python nodemcu-uploader.py -p /dev/ttyUSB0 -t 30 upload init.lua
opening port /dev/ttyUSB0 with 115200 baud
Traceback (most recent call last):
  File "nodemcu-uploader.py", line 10, in <module>
    main.main_func()
  File "/tmp/nodemcu-uploader/nodemcu_uploader/main.py", line 252, in main_func
    uploader = Uploader(args.port, args.baud, start_baud=args.start_baud)
  File "/tmp/nodemcu-uploader/nodemcu_uploader/uploader.py", line 78, in __init__
    __sync()
  File "/tmp/nodemcu-uploader/nodemcu_uploader/uploader.py", line 76, in __sync
    raise DeviceNotFoundException('Device not found or wrong port')
nodemcu_uploader.exceptions.DeviceNotFoundException: Device not found or wrong port
$ python nodemcu-uploader.py -p /dev/ttyUSB0 -t 30 terminal
--- Miniterm on /dev/ttyUSB0  115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

> 
@vincegre
Copy link

I have same problem here :( Found a solution ??

@joysfera
Copy link
Author

Just a work-around. IIRC https://github.com/4refr0nt/luatool worked OK.

@kmpm
Copy link
Owner

kmpm commented Jul 12, 2017

need to get me a esp32 i think.
Looks as if the method of detecting a working device is not working as it should.

@Gaius-Velleius
Copy link

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.

@mucek4
Copy link

mucek4 commented Apr 19, 2019

As a workaround comment next line in uploader.py
self.__expect('%sync%\r\n> ')

@joysfera
Copy link
Author

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?

@mucek4
Copy link

mucek4 commented Apr 19, 2019

I don't know, I haven't check. I am not really good at python. I'll try to check.

@jasaw
Copy link

jasaw commented Jun 19, 2019

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()

@jasaw
Copy link

jasaw commented Jun 19, 2019

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()
 

@joysfera
Copy link
Author

Tried all above mentioned patches, nothing helped.

@joysfera
Copy link
Author

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.

@Cyberfonic
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants