Audio Clipping while playing via Bluetooth on iMX8

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Audio Clipping while playing via Bluetooth on iMX8

834 Views
donjacobvellathottam
Contributor III
Hi,
I'm trying to bring up Bluetooth audio playback in my iMX8 board.
I've successfully connected the board with my phone via Bluetooth. 
However, while playing music on the phone, the audio through the speaker or earphones connected to the board is clipping. 
Interestingly, there is no clipping issue while the music file is directly played from the hardware using gstremer plugins.
 
I tried the solutions mentioned below, but nothing changed:
 
1. Moved the WiFi network to 5GHz so that there will be no interference.       
2. Changed the fragment size and the latency on PulseAudio output port, trying to compensate interference.
  
Before changing latency(output from :~# pactl list):
  Profiles:
a2dp_source: High Fidelity Capture (A2DP Source) (sinks: 0, sources: 1, priority: 20, available: yes)
headset_audio_gateway: Headset Audio Gateway (HSP) (sinks: 1, sources: 1, priority: 10, available: no)
handsfree_audio_gateway: Handsfree Audio Gateway (HFP) (sinks: 1, sources: 1, priority: 10, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: off
Ports:
phone-output: Phone (type: Phone, priority: 0, latency offset: 0 usec, availability unknown)
Part of profile(s): headset_audio_gateway, handsfree_audio_gateway
phone-input: Phone (type: Phone, priority: 0, latency offset: 0 usec, availability unknown)
Part of profile(s): a2dp_source, headset_audio_gateway, handsfree_audio_gateway
  
After changing latency:
  
  Profiles:
a2dp_source: High Fidelity Capture (A2DP Source) (sinks: 0, sources: 1, priority: 20, available: yes)
headset_audio_gateway: Headset Audio Gateway (HSP) (sinks: 1, sources: 1, priority: 10, available: no)
handsfree_audio_gateway: Handsfree Audio Gateway (HFP) (sinks: 1, sources: 1, priority: 10, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: a2dp_source
Ports:
phone-output: Phone (type: Phone, priority: 0, latency offset: 50000 usec, availability unknown)
Part of profile(s): headset_audio_gateway, handsfree_audio_gateway
phone-input: Phone (type: Phone, priority: 0, latency offset: 0 usec, available)
Part of profile(s): a2dp_source, headset_audio_gateway, handsfree_audio_gateway     
     
3. Tried setting ignore_dB=1 in /etc/pulse/default.pa:
/etc/pulse/default.pa
load-module module-udev-detect ignore_dB=1
4. Set the profile to a2dp
 
 
How can I tackle the issue. 
 
Thank you.
0 Kudos
Reply
5 Replies

810 Views
donjacobvellathottam
Contributor III

Hi @JorgeCas ,

Thank you for the reply.

I am using NxP iMX8QM MEK with NxP Linux 5.15.52 built using Yocto.

I've edited the recipes to use the package "Network Manager" instead of "Connection Manager".

The Wi-Fi/BT module is MuRata Type 1YM (Part Number:LBEE5XV1YM ).


To bring -up the module, connect the device and play audio I've done the following steps:


1) copied the "pcieuart8997_combo_v4.bin" file to "/lib/firmware/mrvl"

2) initiated rescan using the following commands

      cd /sys/bus/pci
      echo 1 > devices/0000\:01\:00.0/remove
      cd
      echo 1 > /sys/bus/pci/rescan

3) Loaded the wifi modules with

      modprobe moal mod_para=nxp/wifi_mod_para.conf

4) Enabled the bluetooth service

      # Enable Bluetooth service
      systemctl enable bluetooth.service

      # Start Bluetooth service
      systemctl start bluetooth.service

      # Attach Bluetooth device to a serial port
      hciattach ttyLP1 any 115200 flow

      # Bring up the Bluetooth interface
      hciconfig hci0 up


5) Started the pulse audio using

      pulseaudio --start

6) Connected my phone with bluetoothctl

0 Kudos
Reply

803 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Got it, thank you for the information.

Could you please try to use demo image or built it as imx-image-multimedia or imx-image-full? Refer to the user guide:

To run Bluetooth with BlueZ stack, execute the following commands:

hciattach <device> <type> 3000000 flow -b -t 120
hciconfig hci0 up
hciconfig hci0 piscan
hciconfig -a
hcitool dev

Do you have this issue if you are playing audio from the board?

Best regards.

0 Kudos
Reply

744 Views
donjacobvellathottam
Contributor III

Thank you for the reply,

Yes, I am using an image built with imx-image-full.

I've tried the suggested method, and this is what happened.

root@imx8qmmek:~# hciattach ttyLP1 any 3000000 flow -b -t 120
Setting TTY to N_HCI line discipline
Device setup complete
root@imx8qmmek:~# [   88.265219] Bluetooth: hci0: Frame reassembly failed (-84)
[   90.277165] Bluetooth: hci0: command 0x1003 tx timeout
[   92.293168] Bluetooth: hci0: command 0x1001 tx timeout
[   94.309167] Bluetooth: hci0: command 0x1009 tx timeout

root@imx8qmmek:~# hciconfig hci0 up
[  265.285159] Bluetooth: hci0: command 0x1003 tx timeout
[  267.301159] Bluetooth: hci0: command 0x1001 tx timeout
[  269.317173] Bluetooth: hci0: command 0x1009 tx timeout
Can't init device hci0: Connection timed out (110)
root@imx8qmmek:~#

 

Also, I don't have any issues when I am playing the audio directly from the board.

0 Kudos
Reply

718 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

It seems to be an issue on UART used.

You could try with:

hciattach /dev/ttymxc0 any 3000000 flow -b -t 120
or 
hciattach /dev/ttymxc0 any 115200 flow -b -t 120

Best regards.

0 Kudos
Reply

823 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello, I hope you are doing well.

Are you using our i.MX8QM MEK board?

What Wi-Fi/Bluetooth module are you using?

What OS version are you using?

Could you please share me the process are you using to bring-up the module, connect the device and play audio?

Best regards.

0 Kudos
Reply