SCO between iPhone and hikey960

Hi,
I am tring to build a car radio like @doitright is doing in this thread.

When I test if the SCO link is established between my phone and hikey960, I use two phones, an android phone and an iphone.
If the senario is:
iphone <–phone call–>android phone<–BT–>hikey960
hikey960 can record my voice transmitted from iphone. I can play the recorded .wav correctly and hear my voice by iphone.

If the senario is:
android phone <–phone call–>iphone<–BT–>hikey960
I can record only noise.
Does anyone know what the root cause of this issue is?

Is it white noise ?

It would be interesting to check if any diff (android vs iphone) during HCI eSCO/SCO setup, you can sniff this with btmon.

@Loic, I don’t know if it is white noise. It sounds like pulses.
I have no idea about btmon. Does it run on hikey960? I can not find this command.

If you are running Android you can also sniff via Developer options, enabling Bluetooth HCI snoop log. This should generate a sdcard/btsnoop_hci.log.

Here is the log file. Any suggestion?
https://www.dropbox.com/s/t0btmrkg6aneof6/btsnoop_hci.log?dl=1

OK I see two different behaviors in your traces.

  • When connected to the 60:45… (I assume it’s your android phone), we firstly receive a eSCO connection error due to unsupported SCO AIR format, it looks like controller does not support mSBC (0x02) coding format, eSCO connection is rejected. Then device (60:45…) changes the codec to CVSD (0x01) and retries a connection with the new codec parameter, this time connection is accepted.
  • In iPhone case (40:9C), the first connection fails in the same way but the iPhone retries to connect with the same codec (mSBC) which makes the second attempt fail as well.

Note that mSBC is an optional codec which is linked to Wide Band Speech support, Wilink 8 supports WBS but this requests additional configuration on controller (HCI vendor commands) and host (I2S config) side.

The HFP specification says:

If wide band speech is supported, and the Initiator fails to establish an eSCO transport with the T1 settings (mSBC on eSCO link), the Initiator shall attempt to setup a Codec connection using the narrow band CVSD codec over eSCO.

So this make me feel that iPhone BT stack has a wrong behavior here.

Actually both devices firstly try to connect with mSBC codec because our stack reports it has supported:
AT+BAC=1,2

I suppose reporting only CVSD (1) as supported codec should fix the issue. This is probably configurable in the Android fluoride BT stack. I suggest to modify bta_hf_client_send_at_bac function in system/bt/hf_client/bta_hf_client_at.cc which unconditionally returns mSBC as supported:
- buf = “AT+BAC=1,2\r”;
+ buf = “AT+BAC=1\r”;

Let me know…

The TI documentation makes it extremely unclear what is necessary for enabling mSBC. swru442b makes no mention at all regarding mSBC, eSCO, or wideband audio. Might be the best place to ask would be TI’s forum http://e2e.ti.com/support/wireless_connectivity/wilink_wifi_bluetooth/f/307

I wonder if it might need something like HCI_VS_A3DP_Codec_Configuration (0xFD8E) in addition to the standard codec configuration? Description: “This command configures the PCM source type, SBC encoder, and SARC parameters.”

@Loic,
You are right, “AT+BAC=1\r” can solve the problem. Now I can record audio when use iphone to connect to hikey960.

@doitright,
I have posted the question about how to configure mSBC to TI forum.

I posted the question here
https://e2e.ti.com/support/wireless_connectivity/wilink_wifi_bluetooth/f/307/t/657233
There is a reply, and where is the init script of WL1837MOD?

There is not init script, this will be configured in the same way you already configured I2S (via HCI vendor command). I think @doitright used hcitool for configuring controller. You can also add the specific commands in the BT driver itself or in the user-space BT stack.

Their use of the term “init script” is a little bit confusing, but they are referring to the .bts file from here;
https://android.googlesource.com/device/linaro/hikey/+/master/bt-wifi-firmware-util/TIInit_11.8.32-pcm-960.bts

This file is nothing but a sequence of HCI commands that get sent to the device on initialization, so while not directly human readable, it is a script in the sense that it is a fixed sequence of instructions.

This is their tools package that includes “bts transform” for editing the bts file:
http://www.ti.com/tool/WILINK-BT_WIFI-WIRELESS_TOOLS

Note: Its a windows exe, but (shockingly) seems to work fine under Wine.

I downloaded the tools, but still have no idea how to configure mSBC :frowning:
After converting the .bts file, I still have no idea what’s the meaning of those numbers…

Those “numbers” are just vendor commands (like the one we use to set up the PCM). Look right close to the end of the file for PCM command, it even has a comment. Much of it is using commands for loading binary firmware. You don’t need to worry about those. There is no specific “section” where you would need to enable the mSBC. We just need to know the command for it and then can run it either from that script, or via mcap_tool + dut.