arduino - Arduino Pro Micro 未上传任何代码(avrdude:ser_open():无法打开设备“/dev/ttyACM0”:权限被拒绝)
问题描述
我尝试上传任何类型的草图(包括裸露的骨骼),但没有任何效果。其他人说这个错误是由于端口权限不足引起的,所以我做了其他几个人和 arduino 站点(用于 linux)的建议。
Sketch uses 3462 bytes (12%) 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.
Forcing reset using 1200bps open/close on port /dev/ttyACM0
PORTS {/dev/ttyACM0, /dev/ttyS4, } / {/dev/ttyACM0, /dev/ttyS4, } => {}
PORTS {/dev/ttyACM0, /dev/ttyS4, } / {/dev/ttyS4, } => {}
PORTS {/dev/ttyS4, } / {/dev/ttyACM0, /dev/ttyS4, } => {/dev/ttyACM0, }
Found upload port: /dev/ttyACM0
/home/kalin/Downloads/arduino-1.8.13/hardware/tools/avr/bin/avrdude -C/home/kalin/Downloads/arduino-1.8.13/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D -Uflash:w:/tmp/arduino_build_767551/sketch_feb05a.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/kalin/Downloads/arduino-1.8.13/hardware/tools/avr/etc/avrdude.conf"
User configuration file is "/home/kalin/.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.
从文档中:
打开终端并输入:
ls -l /dev/ttyACM* 你会得到类似的东西:
crw-rw---- 1 root dialout 188, 0 5 apr 23.01 ttyACM0 ACM 末尾的“0”可能是不同的数字,或者可能返回多个条目。我们需要的数据是“拨出”(是文件的组所有者)。
现在我们只需要将我们的用户添加到组中:
sudo usermod -a -G dialout $USER 然后:
sudo chmod a+rw /dev/ttyACM0 您需要注销并再次登录才能使此更改生效。
但是,每次我启动 arduino 时,权限都会被清除回原来的状态。如果我将 arduino 作为 sudo 运行,它可以工作,但我显然不需要这样做。
解决方案
我没有足够的经验知道要为 arduino 使用什么程序员,但问题是我使用的是“AVR ISP”,但是当我切换到“ArduinoISP”时,一切都完美地上传了。无需更改任何权限。
推荐阅读
- spring - 使用 springboot 应用程序进行数据迁移需要太多时间
- javascript - 数组中的特定单词
- java - JRuby 无法再创建 JFrame:Java 找不到 WGJPI
- javascript - 如何计算调用 $( '#el'' ).scrollTop( 1 ) 遍历 div 高度 759 的次数?
- centos - 使用 OpenVZ 限制每个容器的网络带宽
- c# - LINQ 仅对数字数据进行排序,但保持列表完整
- mysql - MySQL按同一列中的不同值分组
- css - 为什么默认字体粗细是 400?
- python - jupyter笔记本中的dtale显示
- amazon-web-services - 更新您的 Amazon RDS SSL/TLS 证书 - 我需要在 EC2 上执行任何操作吗