No access to USB-Port while using PlatformIO with Atom on Linux

Hey there,
I just ran into a problem while trying to use PlatformIO to program a WeMos D1 R2 Board for an Exam of my University:
PlatformIO does not automatically recognize my USB Port while trying to upload code to the board. And after manually configuring it on my Linux Mint (PlatformIO.ini -> upload_port = /dev/ttyUSB0 ) i get the error : cannot access /dev/ttyUSB0. I already added my user account to the dialout group to get root access on the usb port,but i still get the same Error, no matter how often i try.
I would be glad if somebody could help me out :wink:

P.S. If i check the Serial Monitor Option under the “PlatformIO” Tab in the top menu, i dont get any options to select for the port

Show us the output of ls -lha /dev/ttyUSB* when the adapter is plugged in. Does dmesg report anything strange? What USB/UART adapter is on the board, a CH340G?

1 Like

thx for the quick reply :wink:
the output of ls -lha /dev/ttyUSB* shows this: crw-rw-rw- 1 root dialout 188, 0 Apr 15 14:23 /dev/ttyUSB0
dmesg does not report anything special which could be connected this issue.
And because i cant figure out which adapter is used on this board, this is the one we are talking about:

Hm seems like /dev/ttyUSB0 is owned by the group dialout to which you said you were a member of. On other Linux systems there is also the plugdev group. And that board indeed uses the CH340 chip. Can you 1.) execute platformio settings set force_verbose Yes, then 2.) the output of an upload run (platformio run -t upload) and then the same with sudo rights (sudo pio run -t upload)? Are you running Linux natively or on a VM?

You can use markdown formatting for larger pieces of text. (see here)

1 Like

Hi again,
i’m running linux mint natively on my notebook.
If try it without sudo:

Configuring upload protocol…
MethodWrapper([“upload”], [“.pioenvs/d1_mini/
Use manually specified: /dev/ttyUSB0
esptool -vv -cd nodemcu -cb 115200 -cp “/dev/ttyUSB0” -c
f .pioenvs/d1_mini/firmware.bin
esptool v0.4.9 - (c) 2014 Ch. Klippel <ck@atelier-klippe>
setting board to nodemcu
setting baudrate from 115200 to 115200
setting port from /dev/ttyUSB0 to /dev/ttyUSB0

opening port /dev/ttyUSB0 at 115200
error: cannot access /dev/ttyUSB0

error: espcomm_open failed
error: espcomm_upload_mem failed
*** [upload] Error 255

and with sudo i get sh: sudo: command not found

Just to state the not-so-obvious…I have to do a reboot after I added my account to the dialup group on ubuntu.
Nothing would work until I did that.

1 Like

Of course i did this :wink:

But as i said before, it didn’t change anything and the problem is still not solved ^^

We removed “dialup” group from udev rules. Could you try to re-install Redirecting... ?

btw, if adding yourself to the dialout group, it’s not necessary to reboot/restart… simply log out and log back in… it’s a bit quicker :wink: