IMX8MPLUS HFP Bluetooth Profile Usecase

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

IMX8MPLUS HFP Bluetooth Profile Usecase

1,622 Views
fasilyousaf
Contributor I

Hi,

I have interfaced an IW612 based Bluetooth module from Murata with the IMX8MPLUS EVK. My goal is to validate some Bluetooth use cases. So far, I have been able to do the following:

  1. Connect one smartphone and two Bluetooth headsets simultaneously.
  2. Stream audio from the smartphone to either one or both headsets simultaneously using the A2DP protocol.

However, I am unable to validate phone calls using the HFP profile. I want to be able to route the phone calls to the smartphone to the headsets via the IMX8MPLUS EVK. I can set either the smartphone or the headsets to HFP profile based on the order of pairing. But I am not able to set both of them to HFP profile simultaneously. When I run the command `pactl list cards`  only one of the above has the HFP profile availability shown as "YES".

Smartphone: handsfree_head_unit: Handsfree Head Unit (HFP) (sinks: 1, sources: 1, priority: 30, available: yes)

Headset: handsfree_audio_gateway: Handsfree Audio Gateway (HFP) (sinks: 1, sources: 1, priority: 10, available: no)

Is it possible to connect both smartphone and headset with HFP profile using a singe BT module at the same time? Or do I need to connect two BT modules for this to work?

Labels (1)
0 Kudos
13 Replies

914 Views
surya45
Contributor II

Hi i'm working on HFP profile bringup on imx8mp Phytec board using android11 platform. here i am using wm8960 external audio codec. and realtek rtl8822b bt chip connected via USB interface.

surya45_0-1706682468068.png

 

here i have tested A2DP source and sink modes. by using WM8960 dts node mentioned below.

wm8960-audio-card {
compatible = "simple-audio-card";
simple-audio-card,name = "wm8960-audio";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&dailink_master>;
simple-audio-card,frame-master = <&dailink_master>;
simple-audio-card,mclk-fs = <32>;
simple-audio-card,hp-det = <2 0>;simple-audio-card,widgets =
"Microphone", "Mic Jack",
"Line", "Line In",
"Line", "Line Out",
"Speaker", "Speaker",
"Headphone", "Headphone Jack";
simple-audio-card,routing =
"Headphone Jack", "HP_L",
"Headphone Jack", "HP_R",
"Speaker", "SPK_LP",
"Speaker", "SPK_LN",
"LINPUT1", "Mic Jack",
"LINPUT3", "Mic Jack",
"RINPUT1", "Mic Jack",
"RINPUT2", "Mic Jack";
status = "okay";
dailink_master: simple-audio-card,cpu {
sound-dai = <&sai2>;
};
simple-audio-card,codec {
sound-dai = <&codec>;
system-clock-frequency = <12288000>;
};
};
reg_audio_pwr: regulator-audio-pwr {
compatible = "regulator-fixed";
regulator-name = "audio-pwr";
regulator-min-microvolt = <3300000>;regulator-max-microvolt = <3300000>;
gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
enable-active-high;
regulator-always-on;
status = "okay";
};

which created sound cards

Hi i'm working on HFP profile bringup on imx8mp Phytec board using android11 platform. here i am using wm8960 external audio codec. and realtek rtl8822b bt chip connected via USB interface.

here i have tested A2DP source and sink modes. by using WM8960 dts node mentioned below.

wm8960-audio-card {
compatible = "simple-audio-card";
simple-audio-card,name = "wm8960-audio";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&dailink_master>;
simple-audio-card,frame-master = <&dailink_master>;
simple-audio-card,mclk-fs = <32>;
simple-audio-card,hp-det = <2 0>;simple-audio-card,widgets =
"Microphone", "Mic Jack",
"Line", "Line In",
"Line", "Line Out",
"Speaker", "Speaker",
"Headphone", "Headphone Jack";
simple-audio-card,routing =
"Headphone Jack", "HP_L",
"Headphone Jack", "HP_R",
"Speaker", "SPK_LP",
"Speaker", "SPK_LN",
"LINPUT1", "Mic Jack",
"LINPUT3", "Mic Jack",
"RINPUT1", "Mic Jack",
"RINPUT2", "Mic Jack";
status = "okay";
dailink_master: simple-audio-card,cpu {
sound-dai = <&sai2>;
};
simple-audio-card,codec {
sound-dai = <&codec>;
system-clock-frequency = <12288000>;
};
};
reg_audio_pwr: regulator-audio-pwr {
compatible = "regulator-fixed";
regulator-name = "audio-pwr";
regulator-min-microvolt = <3300000>;regulator-max-microvolt = <3300000>;
gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
enable-active-high;
regulator-always-on;
status = "okay";
};

which created sound cards but those cards are not supporting hfp 

so i added btsco node in dts

bt_sco_codec: bt_sco_codec {
#sound-dai-cells = <1>;
compatible = "linux,bt-sco";
};

sound-bt-sco {
compatible = "simple-audio-card";
simple-audio-card,name = "bt-sco-audio";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-inversion;
simple-audio-card,frame-master = <&btcpu>;
simple-audio-card,bitclock-master = <&btcpu>;

btcpu: simple-audio-card,cpu {
sound-dai = <&sai2>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <16>;
};

simple-audio-card,codec {
sound-dai = <&bt_sco_codec 1>;
};
};

which created sound cards that can support hfp but sco task creation is failed can you help here?

01-30 10:47:47.130 376 439 D audio_hw_primary: HFP DEBUG: card list: 0
01-30 10:47:47.130 376 439 D audio_hw_primary: HFP DEBUG: support hfp: 1
01-30 10:47:47.130 376 439 D audio_hw_primary: HFP DEBUG: card list: 0
01-30 10:47:47.130 376 439 D audio_hw_primary: HFP DEBUG: support hfp: 1
01-30 10:47:47.130 376 439 D audio_hw_primary: get_card_for_hfp: card: 0
01-30 10:47:47.130 376 439 I audio_hw_primary: set pcm_config_sco_in.period_size to 64
01-30 10:47:47.130 376 439 I audio_hw_primary: open sco for read, card 0, port 0
01-30 10:47:47.130 376 439 I audio_hw_primary: rate 16000, channel 1, period_size 0x40, period_count 8
01-30 10:47:47.135 376 439 I audio_hw_primary: after pcm open, rate 16000, channel 1, period_size 0x40, period_count 8
01-30 10:47:47.139 376 439 I audio_hw_primary: create_resampler rsmpl_sco_rx, in rate 16000, out rate 48000
01-30 10:47:47.141 376 439 W libc : pthread_create sched_setscheduler(1, {3}) call failed: Operation not permitted
01-30 10:47:47.141 376 439 I audio_hw_primary: sco_rx_task create ret 0, tid_sco_rx -207371840
01-30 10:47:47.141 376 2411 I audio_hw_primary: enter sco_rx_task, pcm_sco_rx frames 64, szie 128
01-30 10:47:47.141 376 439 I audio_hw_primary: prepare bt tx task
01-30 10:47:47.141 376 2411 I audio_hw_primary: sco_rx_task: primary output is standy, open it
01-30 10:47:47.141 376 439 D audio_hw_primary: HFP DEBUG: card list: 0
01-30 10:47:47.141 376 2411 I audio_hw_primary: start_output_stream: primary: 1, out: 0xf40c6730, device: 2, address: , mode: 0, flags 0x2
01-30 10:47:47.141 376 439 D audio_hw_primary: HFP DEBUG: support hfp: 1
01-30 10:47:47.141 376 2411 I audio_hw_primary: select_output_device(), headphone 0 ,headset 0 ,speaker 2
01-30 10:47:47.141 376 2411 D audio_hw_primary: start_output_stream: pcm_open: out->device: 2, card: -1, pcm_device_id: 0, rate: 48000, channel: 2, format: 0, period_size: 0xc0, flag: 9
01-30 10:47:47.141 376 2411 E audio_hw_primary: start_output_stream: Invalid PCM card id: -1
01-30 10:47:47.141 376 439 D audio_hw_primary: HFP DEBUG: card list: 0
01-30 10:47:47.141 376 2411 E audio_hw_primary: sco_rx_task: start_output_stream failed, ret -22
01-30 10:47:47.141 376 2411 E audio_hw_primary: sco_rx_task, out_pcm is null
01-30 10:47:47.141 376 2411 I audio_hw_primary: leave sco_rx_task
01-30 10:47:47.141 376 439 D audio_hw_primary: HFP DEBUG: support hfp: 1
01-30 10:47:47.141 376 439 D audio_hw_primary: get_card_for_hfp: card: 0
01-30 10:47:47.141 376 439 I audio_hw_primary: open sco for write, card 0, port 0
01-30 10:47:47.141 376 439 I audio_hw_primary: rate 16000, channel 1, period_size 0xc0
01-30 10:47:47.145 554 554 I Telecom : TelecomSystem: CallerInfoAsyncQuery.startQuery number=*** cookie=(...->CS.crCo->H.CS.crCo->H.CS.crCo.pICR)->CSW.hCCC->CILH.sL->CILH.sL(cab/cast)@E-E-AEw: (...-w
01-30 10:47:47.146 554 622 I Telecom : Event: RecordEntry TC@1: CAPABILITY_CHANGE, Current: [[ sup_hld mut]], Removed [[]], Added [[ sup_hld mut]]: (...->CS.crCo->H.CS.crCo->H.CS.crCo.pICR)->CSW.hCCw
01-30 10:47:47.146 554 622 I Telecom : CallsManager: setCallState NEW -> DIALING, call: [Call id=TC@1, state=NEW, tpac=ComponentInfo{com.android.bluetooth/com.android.bluetooth.hfpclient.connserv.Hfw
01-30 10:47:47.147 554 622 I Telecom : Event: RecordEntry TC@1: SET_DIALING, successful unknown call: (...->CS.crCo->H.CS.crCo->H.CS.crCo.pICR)->CSW.hCCC(cab/cast)@E-E-AEw
01-30 10:47:47.148 554 622 I Telecom : CallsManager: onSuccessfulUnknownCall for call [Call id=TC@1, state=DIALING, tpac=ComponentInfo{com.android.bluetooth/com.android.bluetooth.hfpclient.connserv.w
01-30 10:47:47.149 376 439 W audio_hw_primary: open mic, card -1, port 0
01-30 10:47:47.149 376 439 W audio_hw_primary: rate 48000, channel 1, period_size 0x240
01-30 10:47:47.149 376 439 E audio_hw_primary: cannot open pcm_cap: cannot open device '/dev/snd/pcmC4294967295D0c': No such file or directory
01-30 10:47:47.149 376 439 I audio_hw_primary: sco_task_create, ret -1

 

 

 

 

0 Kudos

1,582 Views
Suraj_Vagoli
Contributor I

Hi Team,

We are validating AzureWave AW-CM276MA (NXP 88W8997) HFP BT feature on IMX8MP EVK. We followed UM11490 doc sec 5.3 Hands-free profile (HFP) but we could not able to switch the voice call(audio) to imx8mp evk headset jack. Could you please share the proper procedure to validate HFP on imx8mp evk?

0 Kudos

1,576 Views
fasilyousaf
Contributor I

Hi,

I have followed the same document and was able to get the HFP call use case working properly through headphone jack. What is the configuration you are using for module-loopback command?

0 Kudos

1,534 Views
Suraj_Vagoli
Contributor I

Could you please share the command which you had tried for routing

0 Kudos

1,567 Views
Suraj_Vagoli
Contributor I

Hi , Thanks for the reply. We are referring sec 5.3 Hands-free profile (HFP) from UM11490 doc.

We have not tested with the headset jack. We are using BT headset as a sink device. Could you please share the steps which you referred to get the HFP working with headset jack?

0 Kudos

1,551 Views
fasilyousaf
Contributor I

When you mentioned headphone jack, I thought you meant wired headsets. I am also having issues with BT headsets. I am getting only one side audio.

0 Kudos

1,548 Views
Suraj_Vagoli
Contributor I

Hi I had tried with the headset jack also but still not able to get it working. Please have a look on audio routing

root@imx8mpevk:~# pacmd list-sinks | egrep '(index|name):'
index: 0
name: <alsa_output.platform-sound-bt-sco.mono-fallback>
index: 1
name: <alsa_output.platform-sound-hdmi.stereo-fallback>
index: 2
name: <alsa_output.platform-sound-wm8960.stereo-fallback>
* index: 3
name: <alsa_output.platform-sound-xcvr.iec958-stereo>
root@imx8mpevk:~# pacmd set-default-sink 2
root@imx8mpevk:~#
root@imx8mpevk:~#
root@imx8mpevk:~#
root@imx8mpevk:~# pacmd list-sources | egrep '(index|name):'
index: 0
name: <alsa_output.platform-sound-bt-sco.mono-fallback.monitor>
index: 1
name: <alsa_input.platform-sound-bt-sco.mono-fallback>
index: 2
name: <alsa_output.platform-sound-hdmi.stereo-fallback.monitor>
index: 3
name: <alsa_input.platform-sound-micfil.stereo-fallback>
index: 4
name: <alsa_output.platform-sound-wm8960.stereo-fallback.monitor>
index: 5
name: <alsa_input.platform-sound-wm8960.stereo-fallback>
index: 6
name: <alsa_output.platform-sound-xcvr.iec958-stereo.monitor>
* index: 7
name: <alsa_input.platform-sound-xcvr.iec958-stereo>

root@imx8mpevk:~# pacmd set-default-source 5

root@imx8mpevk:~# pactl load-module module-loopback latency_msec=1 source=alsa_input.platform-sound-bt-sco.mono-fallback sink=alsa_output.platform-sound-wm8960.stereo-fallback
W: [pulseaudio] module-loopback.c: Configured latency of 1.00 ms is smaller than minimum latency, using minimum instead
W: [pulseaudio] module-loopback.c: Cannot set requested sink latency of 19.51 ms, adjusting to 99.95 ms
W: [pulseaudio] module-loopback.c: Cannot set requested source latency of 19.50 ms, adjusting to 99.94 ms
26

root@imx8mpevk:~# pactl load-module module-loopback latency_msec=1 source=alsa_input.platform-sound-wm8960.stereo-fallback sink=alsa_output.platform-sound-bt-sco.mono-fallback
W: [pulseaudio] module-loopback.c: Configured latency of 1.00 ms is smaller than minimum latency, using minimum instead
W: [pulseaudio] module-loopback.c: Cannot set requested sink latency of 19.49 ms, adjusting to 99.94 ms
W: [pulseaudio] module-loopback.c: Cannot set requested source latency of 19.50 ms, adjusting to 99.95 ms
27

0 Kudos

1,546 Views
Suraj_Vagoli
Contributor I

PFA logs

0 Kudos

1,579 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

I already create one case to our WIFI engineer, they will deal with it and give you update then.

Wish you have a nice day

1,604 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

Which version BSP are you using?

0 Kudos

1,566 Views
Suraj_Vagoli
Contributor I
we are using LF_v5.15.32-2.0.0_images_IMX8MPEVK
0 Kudos

1,577 Views
fasilyousaf
Contributor I

Hi,

We are using kernel version 6.1.36+g04b05c5527e9.

0 Kudos

1,525 Views
Suraj_Vagoli
Contributor I

Same issue we are facing on this kernel version too. Please have a look

 

0 Kudos