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


#1

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:
Regards,

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


Espcomm_sync failed / PIO on Atom/Linux
#2

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?


#3

Hey,
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:
https://de.aliexpress.com/item/WeMos-D1-R2-V2-1-0-WiFi-uno-based-ESP8266-for-arduino-nodemcu-Compatible/32758176555.html?src=google&albslr=220871072&isdl=y&aff_short_key=UneMJZVf&source={ifdyn:dyn}{ifpla:pla}{ifdbm:DBM&albch=DID}&src=google&albch=shopping&acnt=494-037-6276&isdl=y&albcp=664345099&albag=32945289759&slnk=&trgt=61865531738&plac=&crea=de32758176555&netw=g&device=c&mtctp=&gclid=Cj0KCQjw8MvWBRC8ARIsAOFSVBWupouadL9ov0PzqhksB7vNLuPKeCTcjejZ0UvwW_oQoLjUASIwgPQaAmNDEALw_wcB&gclsrc=aw.ds


#4

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)


#5

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


Configuring upload protocol…
MethodWrapper([“upload”], [".pioenvs/d1_mini/firmware.bi
n"])
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 - © 2014 Ch. Klippel <ck@atelier-klippe
l.de>
setting board to nodemcu
setting baudrate from 115200 to 115200
setting port from /dev/ttyUSB0 to /dev/ttyUSB0
espcomm_upload_file

espcomm_upload_mem
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


#6

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.


#7

Of course i did this :wink:

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