3

I just bought an ARDUINO MICRO and it looks it is recognized by the system since it shows on /dev/ttyS0. The sketch I wrote compiles without error, but when I try to upload I get: enter image description here If I press the reset button, as suggested, after starting the loading process, I get

Arduino: 1.8.13 (Linux), Board: "Arduino Micro"

Sketch uses 4026 bytes (14%) of program storage space. Maximum is 28672 bytes. Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes. An error occurred while uploading the sketch avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied

Using the verbose output, I get:

Arduino: 1.8.13 (Linux), Board: "Arduino Micro"

Sketch uses 4026 bytes (14%) of program storage space. Maximum is 28672 bytes. Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes. PORTS {/dev/ttyACM0, } / {/dev/ttyACM0, } => {} ... PORTS {/dev/ttyACM0, } / {} => {} PORTS {} / {} => {} ... PORTS {} / {} => {} PORTS {} / {/dev/ttyACM0, } => {/dev/ttyACM0, } Found upload port: /dev/ttyACM0 /home/gigiux/src/arduino/hardware/tools/avr/bin/avrdude -C/home/gigiux/src/arduino/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D -Uflash:w:/tmp/arduino_build_442878/pushLED.ino.ino.hex:i

avrdude: Version 6.3-20190619 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "/home/gigiux/src/arduino/hardware/tools/avr/etc/avrdude.conf"
     User configuration file is "/home/gigiux/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : /dev/ttyACM0
     Using Programmer              : avr109
     Overriding Baud Rate          : 57600

avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied

avrdude done. Thank you.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

It looks like a system error more than a board's issue. What would be the problem? The troubleshooting list does not give a proper solution for this issue since it does not mention access denied to port...

Thank you

Tsundoku
  • 139
Gigiux
  • 777
  • can you show us ls -al /dev/ttyACM0 and id – nobody Jul 23 '20 at 11:30
  • 2
    Start with sudo usermod -a -G dialout $USER , and then retry. – N0rbert Jul 23 '20 at 11:38
  • I got nothing on ACM0, but something on S0: $ ls -al /dev/ttyACM0 ls: cannot access '/dev/ttyACM0': No such file or directory $ ls -al /dev/ttyS0 crw-rw---- 1 root dialout 4, 64 Jul 24 08:18 /dev/ttyS0 – Gigiux Jul 24 '20 at 06:28
  • When I ran sudo usermod -a -G dialout $USER I got the opposite: PORTS {} / {} => {} PORTS {} / {/dev/ttyACM0, } => {/dev/ttyACM0, } Found upload port: /dev/ttyACM0 /home/gigiux/src/arduino/hardware/tools/avr/bin/avrdude System wide configuration file is "/home/gigiux/src/arduino/hardware/tools/avr/etc/avrdude.conf" User configuration file is "/home/gigiux/.avrduderc" User configuration file does not exist or is not a regular file, skipping error occurred while uploading the sketch Using Port: /dev/ttyACM0 avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied – Gigiux Jul 24 '20 at 06:36
  • You should check if your device really connects to a serial port when you plug it in. The existence of /dev/ttyS0 does not mean the Arduino is connected to it. Use dmesg just after plugging it in to verify if your system recognizes it and to which port it connects. – Sebastian Jul 24 '20 at 16:37
  • On Mint, where I have the same problem, dmesg gives: [ 288.520355] usb 7-4: New USB device found, idVendor=2341, idProduct=0037, bcdDevice= 0.01 [ 288.520361] usb 7-4: New USB device strings: Mfr=2, Product=1, SerialNumber=0 [ 288.520364] usb 7-4: Product: Arduino Micro [ 288.520367] usb 7-4: Manufacturer: Arduino LLC [ 289.048770] cdc_acm 7-4:1.0: ttyACM0: USB ACM device [ 289.049714] usbcore: registered new interface driver cdc_acm [ 289.049717] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters but ID indicates only port ttyS0 – Gigiux Jul 26 '20 at 10:11
  • I have seen on https://plugable.com/2011/07/04/how-to-change-the-com-port-for-a-usb-serial-adapter-on-windows-7 that it is possible to change the arduino's default port. What would be the procedure for Ubuntu/Mint? – Gigiux Jul 26 '20 at 10:20
  • I tried with: $ sudo chmod a+rw /dev/ttyACM0 chmod: cannot access '/dev/ttyACM0': No such file or directory $ sudo chmod a+rw /dev/ttyUSB0 chmod: cannot access '/dev/ttyUSB0': No such file or directory – Gigiux Jul 26 '20 at 10:24
  • On Ubuntu I got: usb 7-4: Manufacturer: Arduino LLC [ 726.573758] cdc_acm 7-4:1.0: ttyACM0: USB ACM device – Gigiux Jul 27 '20 at 06:49
  • sudo usermod -a -G dialout $USER allows IDE to show /dev/ttyACM0 (Arduino Micro). That should do it... Thank you – Gigiux Aug 07 '20 at 11:24
  • Could you please write out the text in the screenshot at the top? The alt-text currently says "enter image description here", which makes the image inaccessible to screen reader users (and the small size of the text is an issue for many other users). – Tsundoku Sep 02 '20 at 20:48

1 Answers1

4

This happens because your user account does not have permission to access the USB Serial port.

You can fix this by running sudo usermod -a -G dialout $USER and rebooting your computer. After this, start Arduino IDE again, choose the port again and upload the firmware again.

Note: In general, I recommend installing the "Arduino IDE" Snap from Ubuntu Software instead of installing Arduino IDE manually from the Arduino website. The snap should check if you have the right permissions and explains how to fix the issue.

Merlijn Sebrechts
  • 7,394
  • 1
  • 42
  • 70