TransWikia.com

Pi Zero W Bluetooth Connection Getting Dropped

Raspberry Pi Asked by Mark Estrada on December 31, 2021

I have a Rpi Zero W with headless setup and I am trying to connect my bluetooth speaker into my Raspberry Pi W.

I followed this Setup Bluetooth on Raspberry Pi

I followed these steps to be exact

1. sudo bluetoothctl
2. pairable on
3. scan on
4. scan off
5. agent on
6. pair xx:xx:xx:xx:xx:xx
7. trust xx:xx:xx:xx:xx:xx
8. connect xx:xx:xx:xx:xx:xx
9. info xx:xx:xx:xx:xx:xx
... will show the success again (some Information are displayed).
10. exit

The output is as followed:

When I began to pair, I got the following message, the connected becomes "yes"

[bluetooth]# pair FB:58:FA:29:14:20
Attempting to pair with FB:58:FA:29:14:20
[CHG] Device FB:58:FA:29:14:20 Connected: yes
[CHG] Device FB:58:FA:29:14:20 UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device FB:58:FA:29:14:20 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device FB:58:FA:29:14:20 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device FB:58:FA:29:14:20 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device FB:58:FA:29:14:20 ServicesResolved: yes
[CHG] Device FB:58:FA:29:14:20 Paired: yes
Pairing successful

I noticed that the prompt changed from [bluetooth] to the name of my Bluetooth Speaker [CS BT 20G]. After which I see that the Connected becomes "no"

[CS BT 20G]
[CHG] Device FB:58:FA:29:14:20 ServicesResolved: no
[CHG] Device FB:58:FA:29:14:20 Connected: no

I checked the paired-devices

[bluetooth]# paired-devices
Device FC:58:FA:29:14:20 MI BT 18I

and apply the trust

[bluetooth]# trust FB:58:FA:29:14:20
[CHG] Device FB:58:FA:29:14:20 Trusted: yes
Changing FB:58:FA:29:14:20 trust succeeded

but when I tried to connect, I am getting this

[bluetooth]# connect FC:58:FA:29:14:20
Attempting to connect to FB:58:FA:29:14:20
Failed to connect: org.bluez.Error.Failed

I ran info and I got these. Notice that the connected = "no"

[bluetooth]# info FC:58:FA:29:14:20
Device FC:58:FA:29:14:20 (public)
        Name: MI BT 18I
        Alias: MI BT 18I
        Class: 0x00260414
        Icon: audio-card
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: no
        LegacyPairing: no
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
[bluetooth]#

When I tried to play an mp3 music

omxplayer -o alsa example.mp3

I am not hearing anything. Not sure but why my connection is getting dropped by my rpi?

One Answer

Quite often when pairing has happened but there are issues connecting it is because there is a mismatch between the services offered at both ends of the connection.

With info you have shown what services are available on the remote device. If you do show then that will let you know what is available on the RPi. I would expect the following to be included on the RPi

        UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)

If that looks correct, then I would remove the pairing and try again with a different agent. The fact that you got no against ServicesResolved suggests their might have been an issue.

[CHG] Device FB:58:FA:29:14:20 ServicesResolved: no

Instead of using agent on, try using default-agent to see if that works better.

To get more debug information, there are a couple of other places you can look.

service bluetooth status

will display error messages from the Bluetooth Daemon at the bottom.

If that doesn't help, then have sudo btmon -t running in a separate terminal when you do the pair and connect. It might be hard to read the output of btmon but it could be useful information to add to your question.

Answered by ukBaz on December 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP