我刚买了一个 ARDUINO MICRO,它似乎被系统识别了,因为它显示在 上/dev/ttyS0
。我编写的草图编译时没有错误,但当我尝试上传时,我得到:
如果我按照建议在开始加载过程后按下重置按钮,我会得到
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
使用详细输出,我得到:
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.
这看起来更像是系统错误,而不是主板问题。问题是什么?故障排除列表没有提供此问题的正确解决方案,因为它没有提到拒绝访问端口...
谢谢
答案1
发生这种情况是因为您的用户帐户没有访问 USB 串行端口的权限。
您可以通过运行sudo usermod -a -G dialout $USER
并解决此问题重新启动计算机. 此后,重新启动 Arduino IDE,重新选择端口并再次上传固件。
注意:一般来说,我建议从 Ubuntu 软件中安装“Arduino IDE”Snap,而不是从 Arduino 网站手动安装 Arduino IDE。Snap 应该会检查您是否具有正确的权限并说明如何解决问题。