Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLE problems on Raspberry Pi 3B+ and 4 #332

Closed
dhalbert opened this issue Oct 13, 2020 · 5 comments
Closed

BLE problems on Raspberry Pi 3B+ and 4 #332

dhalbert opened this issue Oct 13, 2020 · 5 comments
Assignees
Labels
Backend: BlueZ Issues and PRs relating to the BlueZ backend bug Something isn't working

Comments

@dhalbert
Copy link

dhalbert commented Oct 13, 2020

  • bleak version: 0.8.0
  • Python version: 3.7.3
  • Operating System: Raspberry Pi OS buster (completely up to date) on Raspberry Pi 3B+ and 4
  • BlueZ version (bluetoothctl -v) in case of Linux: 5.50

This is not a bleak problem per se, I believe.

I'm trying to get bleak to work on an RPi 4 (and 3B+). It works fine on an RPi Zero W and 3B, but swapping the SD card from the RPi Zero W into an RPi 4 or 3B+ (assuring that the OS setup is identical) gives this error when trying to do service discovery:

...
  File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 154, in connect
    await self.get_services()
  File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 384, in get_services
    raise BleakError("Services discovery error")

The properties value ServicesResolved never becomes True, which causes the error.

If anyone has gotten bleak to work on an RPi4, I'd love to hear what you had to do. I've scoured the RPi forums, etc., and haven't come up with any solution. The wifi/BLE adapter chip is supposed to be identical between the two boards. [EDIT: In fact, the wifi hardware changed between 3B and 3B+, though it's hard to find this out.] Thanks.

EDIT: Further testing shows it works on Pi0W and Pi3B, but not on Pi3B+ and Pi4B.

@dhalbert dhalbert changed the title BLE problems on Raspberry Pi 4 BLE problems on Raspberry Pi 3B+ and 4 Oct 13, 2020
@dhalbert
Copy link
Author

dhalbert commented Oct 13, 2020

This appears to be a bluez-firmware problem which manifests on more recent RPi's. Discussion here: adafruit/Adafruit_CircuitPython_BLE_BerryMed_Pulse_Oximeter#3 (comment)

This appears to be a bluez-firmware problem. As of this writing, the latest version is bluez-firmware-1.2-4+rpt5. I had to roll back to bluez-firmware-1.2-4+rpt2 to get this to work. I downloaded the .deb from http://archive.raspberrypi.org/debian/pool/main/b/bluez-firmware/bluez-firmware_1.2-4+rpt2_all.deb. Versions rpt3 and rpt4 didn't work. What seems like the same problem was reported here: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=285641&p=1728626, and that report rolled back to rpt2 also.

EDIT: bluez-firmware issue being tracked here: RPi-Distro/bluez-firmware#6

@hbldh
Copy link
Owner

hbldh commented Oct 20, 2020

This is a highly interesting find; thank you for documenting it! I will add a link to this issue on the new troubleshooting page in the docs (#330).

@dhalbert
Copy link
Author

Reopening this for your interest because there is new firmware under test at RPi-Distro/bluez-firmware#6. Unfortunately it does not work for me.

@dhalbert dhalbert reopened this Nov 20, 2020
@dhalbert
Copy link
Author

Reopening this for your interest because there is new firmware under test at RPi-Distro/bluez-firmware#6. Unfortunately it does not work for me.

Turns out for some reason I had to power cycle the board (not just reboot) in order to test the new firmware properly. It now does work for me, getting values from a pulse oximeter via our software on top of bleak.

@hbldh hbldh self-assigned this Dec 4, 2020
@hbldh hbldh added Backend: BlueZ Issues and PRs relating to the BlueZ backend bug Something isn't working labels Dec 4, 2020
@dhalbert
Copy link
Author

The bluez-firmware-1.2-4+rpt7 and rpt8 versions fix the problem mentioned. Use rpt8, which includes security fix not in rpt7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend: BlueZ Issues and PRs relating to the BlueZ backend bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants