Bluetooth : unable to connect bt headphone on colibri imx8x

Hello,

I’m currently testing the bluetooth feature on the colibri imx8x card to be able to provide audio ( with bt headphones or speaker ).

I have followed the tutorial on this link : Bluetooth (Linux) | Toradex Developer Center

But I am not able to connect to any device :

  • “bose QC35” bt headphone → unable to connect
  • “JBL” bt speaker → unable to connect
  • I tried also to connect to my smartphone → connect and disconnect.

The pairing works well for the three devices ( for the smartphone it asks a pin code → works well )
the trusting works well.

But when I connect the device, it connects/disconnects immediatly.

Here are the log of btmon :

When I try to connect, I have a log inside /var/log/messages :

May 20 06:50:57 colibri-imx8x daemon.err bluetoothd[696]: …/bluez-5.55/src/service.c:btd_service_connect() a2dp-sink profile connect failed for 04:52:C7:60:ED:A8: Protocol not available

something is missing but I don’t know what ?

Thanks for your help.

Hi @f.mazur

Thanks for writing to the Toradex Community!

Could you share the output of uname -a?
Have you done any changes to the kernel config? If yes, could you share these changes.

Thanks and best regards,
Jaski

Here is the configuration :

Linux kts5colibri 5.4.91-5.3.0-devel+git.82e97870feb6 #1 SMP PREEMPT Wed Apr 21 12:49:21 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

I have done no change except a patch on the device tree of the parallel rgb to support my ortustech screen

In the meantime, I have done some research and it appears that I need to have pulseaudio.

After rebuilding my image with the options :

DISTRO_FEATURES_append = " pulseaudio"
IMAGE_INSTALL_append = " packagegroup-imx-tools-audio"

pulseaudio (server) is integrated into my image. But there is no pulseaudio.service, I have to launch it manually with pulseaudio -D

But it don’t work, I need some extras package that are not installed :

  • pulseaudio-lib-bluez5-util_13.0-r0_aarch64-mx8.ipk
  • pulseaudio-module-bluetooth-discover_13.0-r0_aarch64-mx8.ipk
  • pulseaudio-module-bluetooth-policy_13.0-r0_aarch64-mx8.ipk
  • pulseaudio-module-bluez5-device_13.0-r0_aarch64-mx8.ipk
  • pulseaudio-module-bluez5-discover_13.0-r0_aarch64-mx8.ipk

I need also to change the configuration of the file /etc/pulse/default.pa and add and/or uncomment the following lines :

load-module module-bluetooth-discover
load-module module-alsa-sink

then , restart pulseaudio -D , and now the connection to the headphone works well !

The playback works well too, but only with gstreamer ( with a2dpsink ) and I was not able to find the correct pipeline so I played it with gst-play-1.0.

Now the different steps for me are :

  • integrate pulseaudio-server, the modules dependencies and the service files into my own colibri image
  • try to have connection/disconnection/reconnection automatic and not to have to connect manually the headphone
  • integrate the pairing/unpairing trusting/untrusting into our Qt application ( Qt/QML ). I know there is a qt backend based on bluez5 so I wonder it is possible ( the scan and discover already works well ).
  • and at last, find the correct pipeline for gstreamer

Regards,

F. MAZUR.

Hi
Thanks for the information. Could you check if this patch is integrated in your kernel?

Hello,

Apparently, the patch is not integrated :

148 CONFIG_BT=m
149 CONFIG_BT_RFCOMM=y
150 CONFIG_BT_RFCOMM_TTY=y

What is the purpose of this patch?
Why integrate BT_RFCOMM as a module instead of directly inside kernel ?

Good, could you integrate this patch and check if you get he connection?

Why integrate BT_RFCOMM as a module instead of directly inside kernel ?

If you integrate this in the kernel, then you would also need to put the firmware for the sdio wifi chip in the kernel which will make the kernel unnecessary big.

Best regards,
Jaski