微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 Raspbian Buster、Raspberry Pi 4 中重新启动时有时未加载蓝牙模块

如何解决在 Raspbian Buster、Raspberry Pi 4 中重新启动时有时未加载蓝牙模块

我在 Raspbian Buster、RaspBerry Pi 4 上编写了一个 bluez 应用程序。在某些重新启动时,蓝牙模块和服务未加载。

使用命令检查 bluetooth.service 时:$ sudo systemctl status bluetooth.service, 我明白了,Condition check resulted in Bluetooth service being skipped

我检查了 $ lsmod$ dmesg 日志的问题和非问题情况。

我在 lsmod 中发现的差异如下所示:

lsmod diff

我在 dmesg 日志中发现的差异如下所示:

dmesg diff

左侧是问题案例,右侧是非问题案例。

我该如何解决这个问题,让蓝牙始终如一地工作? 我正在使用 Raspbian Lite OS 2020-02-14

更新 1 [2021 年 2 月 3 日]:我检查了问题案例的 journalctl 日志,发现了这个:

Feb 03 11:52:18 pi btuart[373]: Failed to reset chip,invalid HCI event
Feb 03 11:52:18 pi btuart[373]: Can't initialize device: Success
Feb 03 11:52:18 pi btuart[373]: bcm43xx_init
Feb 03 11:52:18 pi systemd[1]: hciuart.service: Control process exited,code=exited,status=1/FAILURE
Feb 03 11:52:18 pi systemd[1]: hciuart.service: Failed with result 'exit-code'.
Feb 03 11:52:18 pi systemd[1]: Failed to start Configure Bluetooth Modems connected by UART.

更新 2 [2021 年 2 月 3 日]:我的 /boot/config.txt 内容

dtparam=i2c_arm=on

dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=25
dtoverlay=spi1-1cs

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
dtoverlay=vc4-fkms-v3d

disable_splash=1
enable_uart=1
max_usb_current=1

dtoverlay=uart2
dtoverlay=i2c-rtc,ds3231
gpu_mem=256

我的 cmdline.txt 内容

console=tty1 root=PARTUUID=738a4d67-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait logo.nologo vt.global_cursor_default=0 consoleblank=1 loglevel=1 quiet

解决方法

我的方向传感器已连接到 Raspberry Pi 4 的 UART2。在收到 @svin83 的建议后,我禁用了 UART2。之后我重新启动了 Pi 4 10 次,蓝牙一直正常工作。

我将传感器移至 Raspberry Pi 4 中的 I2C-3 总线。

根据文档UART Configuration,UART2 不应该干扰蓝牙功能,但事实证明确实如此。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。