Downloading and installing the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By cems
#47242 I have the same problem and I've even tried isolateting this using a VM

first my problem:
I am trying to use platformIO and arduinoIDE to talk to an esp8266-12e nodemcu with ch340 chip.

I get the same error messages in OSX el capitan. Iver used signed kext from both Replio and from codebender (not at the same time!!! they crash machines at the same time).

you can see that the drivers get loaded into the kernel and show up in /dev/tty.whatever when the device is plugged in.

I removed the drivers and installed linux mint in a virtual box VM. I add the USB device in virtual box and linux recognizes it. lsusb shows the device by manufaturer's name when you plug it in, and dmesg shows the ch340 driver loaded.

But still I get an error when it tries to write to /dev/tty.usb0 in platformIO in liinux.

thus I'm not using the mac software for the platformIO or any mac drivers for the ch340. Yet I still can't talk to it.

When I move the device over to a windows machine I can talk to it in arduinoIDE, platformIO and easy-ESP.pl

I'm totally stuffed on the mac.....

I've also tried to use over the air programming but I'm less confident I'm doing it right so I can't claim it's the mac that is the problem.

by the way a second problem I have with platformIO on the windows machine is that I can't keep a serial monitor open. Everytime I upload it closes the serial monitor. The nuiscance here is that I can't open the serial monitor back open fast enough to see the debug information that I print back to the serial monitor. I'm not very good with windows so I don't know how to keep a serial monitor open to the port. Is there way way to continuously monitor the device?


I have tired holding the flash button down during the upload but this does not change the error.
User avatar
By cems
#47264 I tried using cu to connect to the port. and I discovered that unless I used sudo in front of cu I could not connect to the device. But if I did use sudo I could connect!! Aha!

Therefore I tried to see if maybe it was a privledge issue so I tried running this command as Sudo

I now get this message:
sudo "/Users/cems/.platformio/packages/tool-esptool/esptool" -vv -cd nodemcu -cb 115200 -cp "/dev/cu.wchusbserialfd140" -cf .pioenvs/nodemcuv2/firmware.bin
esptool v0.4.8 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
setting board to nodemcu
setting baudrate from 115200 to 115200
setting port from /dev/tty.usbserial to /dev/cu.wchusbserialfd140
espcomm_upload_file
espcomm_upload_mem
opening port /dev/cu.wchusbserialfd140 at 115200


it then stalls here and nothing at all happens. I can't even control-c out of it!

but if I don't use sudo I get exactly the same output followed by an error message saying it cannot connect to /dev/tty.wusbXXXXXX

where the latter is the correct device port name.
User avatar
By cems
#47329 update update: Weird but platformIO just started working for me! yeah! but why was it so reproducibly not working before? A mystery but having investigated these permissions I have a hypothesis. I think what can happen is that between running arduinoIDE, plateformIO and screen, it's possible at somepoint to have some process locking the device port. When this happens no other program can attach to the port. and you just get permission errors. Well that's my theory. I'll see if it still works tommorrow.


UPDATE: I think this permissions issue could possibly be related to the problem since the error message I get is somewhat similar. However I also note that while I observe the permission error when using "cu", I don't get the error when using the serial terminal "screen". The origin of the error with "cu" as the serrial terminal is somehow tied up with uucp lock files. The directory where it tries to create the lock file does not have write access to a non-wheel/root and so the cu command fails in el capitan osx. Apparently "screen" doesn't use this lock file and so doesn't have an error when a non-admin user talks to the device.

It could be then that that the esp-tool that writes to the device is under the hood trying to access some directory it lacks permissions for. This I can't say but it's a good hypothesis for why esp8266 tools are failing in osx el capitan.


here's my original unedited post.




Thanks for the suggestion on the permissions. It is owned by root wheel. However it also is world read/write so it seems like it should be accessible.

ls -l@ /dev/tty.wchusbserialfd140
crw-rw-rw- 1 root wheel 17, 6 May 11 20:04 /dev/tty.wchusbserialfd140

Here's the actual output from the cu command. Maybe someone can interpret the error

First with sudo it works and we see some text sent by the esp8266 12e sent at 19200 baud:

sudo cu -l /dev/tty.wchusbserialfd140 -s 19200
Connected.
Hello Computer
get down
~.
Disconnected.


Next I try the same command without the sudo and I get an error:

iMac:esp8266-sandbox cems$ cu -l /dev/tty.wchusbserialfd140 -s 19200
cu: creat during lock (/var/spool/uucp/TMP000000250e in /Users/cems/.atom/packages/platformio-ide/project-examples/espressif/esp8266-sandbox as uid 501): Permission denied
cu: /dev/tty.wchusbserialfd140: Line in use