树莓派Zero的ttyAMA0使用pi用户访问时拒绝访问(Permission denied)的解决办法(已在Zero上遇到并测试通过)

在树莓派3B上,/dev/ttyAMA0默认用于蓝牙。要启用串口,需从'/boot/cmdline.txt'中移除'console=serial0,115200',在'/boot/config.txt'末尾添加'enable_uart=1',然后重启。2019年的更新表明,还需要通过raspi-config配置以访问/dev/ttyS0,并注意确认选项。完成这些步骤后,用户将能够正常读写该串口。" 133626635,20015842,修复MySQL复制联机重做日志文件教程,"['数据库', 'mysql']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I'm also guessing that you are using a Pi 3B. On a Pi 3B, "/dev/ttyAMA0" is normally reserved for Bluetooth.

To use the Serial Port on the Pi 3B (or any model of Pi running updated Raspbian Jessie):

Remove the phrase "console=serial0,115200" from the file '/boot/cmdline.txt'. Note that this file must only contain 1 line, do not split the line when editing, or try to add comments. This prevents Linux sending boot messages to the Serial Port.

Add the line "enable_uart=1" to the end of the file '/boot/config.txt'. Ensure that this file does not contain any other commands referring to the uart. This takes care of all the background tasks needed to use the Serial Port on the Pi 3B.

Reboot.

Refer to your Serial Port in code as "/dev/serial0", that's serialZero, not serialOh!

No need to change groups or permissions from the defaults.

翻译:

(1)移除/boot/cmdline.txt中的console-serial,115200这一段

(2)在/boot/config.txt中添加enable_uar

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值