【无标题】

关于树莓派4b 在使用rx 串口读取数据报错问题

报错内容为 device disconnect or multiple 什么的忘记了

主要参考官网 https://www.raspberrypi.com/documentation/computers/configuration.html#secondary-uart 对串口的设置,网上很多都是树莓派3的设置,针对4都是有问题的, 首先在4里面是看不到serial1 这个串口的, 如果想要,可以在/boot/fireware/config.txt 进行设置,在最后一行增加
dtparam=krnbt=off
还需要注意的是,在配置里面需要参考官网,关闭

By default, the primary UART is assigned to the Linux console. If you wish to use the primary UART for other purposes, you must reconfigure Raspberry Pi OS. This can be done by using raspi-config:

Start raspi-config: sudo raspi-config

Select option 3 - Interface Options

Select option P6 - Serial Port

At the prompt Would you like a login shell to be accessible over serial?, answer 'No'

At the prompt Would you like the serial port hardware to be enabled?, answer 'Yes'

Exit raspi-config and reboot the Raspberry Pi for changes to take effect

login shell to be accessible over serial 如果设置为yes,会阶段性占用rx口,这时候如果你想要用rx 来读取串口数据,就会报错。设置为no 即可

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值