关于树莓派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 即可