Hello All, I am running platformIO IDE above VSC. I get the above error trying to upload to my uno board.
My /dev is in my PATH and the file is there.
I got a list of my serial ports using the command below
$ dmesg | grep tty //to find serial ports
[ 0.000000] console [tty0] enabled
[37119.190390] cdc_acm 1-4.3:1.0: ttyACM0: USB ACM device
[38796.029040] cdc_acm 1-4.3:1.0: ttyACM0: USB ACM device
[38860.567181] cdc_acm 1-4.2:1.0: ttyACM0: USB ACM device
The device file (unix: everything is file) does not contain a final :. Itâs just the path to the device file for that USB / UART adapter (or USB ACM device).
So you should try /dev/ttyACM0.
If this doesnât work we need a full error log and the output of ls -la /dev/ttyACM0. You might have wrong group permissions on that âfileâ which disallow that it is opened by a normal user / the dialout / plugdev group or whatever (refer to Linux Setup | Adafruit Arduino IDE Setup | Adafruit Learning System).
I have removed the colon from the upload_port command. Also tried removing the upload_port cmd to
see if platformio could find port by default, but could not.
Below is the error text and some commands showing existance of files, and groups
Configuring upload protocolâŚ
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
Looking for upload portâŚ
Use manually specified: /dev/ttyACM0
*** [upload] could not open port /dev/ttyACM0: [Errno 2] No such file or directory: â/dev/ttyACM0â
[ERROR] Took 6.95 seconds ==============================================================
The terminal process terminated with exit code: 1
Terminal will be reused by tasks, press any key to close it.
$ ls -la /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 May 26 06:53 /dev/ttyACM0
$ groups
joe adm dialout cdrom sudo dip plugdev lpadmin sambashare
/etc/udev/rules.d $ ls -l
-rw-râr-- 1 root root 9304 May 25 21:50 99-platformio-udev.rules
udev rules file (just the part concerning arduino)
Weird that it would say that it cannot find the file when itâs there. Do you run in some kind of VM? Does it work on other computers? You have a standard Uno board, right? Did you try diferent USB cables? Can you attach do a dmesg -w, then an upload from the IDE and post that output?
No VMâs that I no of. Using linux mint and new to linux (about two weeks).
It is wierd that it is looking in the correct directory and saying it can not find it
but i can list it.
Yes, I have a standard uno board.
This is my only computer with linux and my only computer with platformio.
When I upload from Geany or arduino ide there is no problem so itâs not the usb cable.
Output from mesg -w command when connecting uno via usb
[619390.909930] usb 1-4.2: new full-speed USB device number 13 using xhci_hcd
[619391.012156] usb 1-4.2: New USB device found, idVendor=2a03, idProduct=0043
[619391.012160] usb 1-4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[619391.012162] usb 1-4.2: Product: Arduino Uno
[619391.012163] usb 1-4.2: Manufacturer: Arduino Srl
[619391.012165] usb 1-4.2: SerialNumber: 8553130343135131E140
[619391.014942] cdc_acm 1-4.2:1.0: ttyACM0: USB ACM device
when i upload from platformio there is no change in the buffer from the kernel.
Can you try to upload from the shell as root? Inside your project directory, to sudo pio run -t upload.
Have you reloaded the udev rules as in the Adafruit link given above? Have you done a full reboot after that? Can you do a reboot and retry? Can you try removing the 99-platformio-udev.rules again and retry?
I have literally no idea why it doesnât find the device anymore when dmesg doesnât say anything about a removed / inserted device. I thought maybe it would eject the device temporarily or something.
added the ~/.platformio/penv/bin directory to my path so I could access pio commands from outside the platformio_ide , PATH is below so it is in there.
when I try to run the command you gave me I get the error shown below.
joe@joe-450-a114 ~/Documents/PlatformIO/Projects/180525-203708-arduino-blink $ sudo pio run -t upload
[sudo] password for joe:
sudo: pio: command not found
Using the terminal inside platformio
sh-4.3$ pio run -t upload
Configuring upload protocolâŚ
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
Looking for upload portâŚ
Use manually specified: dev/ttyACM0
*** [upload] could not open port dev/ttyACM0: [Errno 2] No such file or directory: âdev/ttyACM0â
I think I tried everything. I will see if I can use the cmd line inside platformio and see if I can get any
traction. Other than that I can un-install then install
I think this is linux permission problem. Try to start vscode with sudo. Following command will open your vscode and then upload your sketch.
$ sudo code --user-data-dir ~/YOURPROJECTLOCATION
I can upload my sketches without errors with the above command in Ubuntu 18.04.