Pandaboard as Bluetooth Handsfree ( Headset)

616 views
Skip to first unread message

Aashish Patel

unread,
Mar 18, 2014, 2:24:35 AM3/18/14
to panda...@googlegroups.com
Hi,

Can I make my pandaboard running android kitkat (bluedroid stack) to behave as headset. Like I should be able to receive calls from my other mobile device and stream music etc.

I know by default android device will act as Audio Gateway role of hands free profile. 

So is there any way to implement/enable hands free role of Hands Free profile.

What changes I have to make in the stack/profile to enable this Hands Free profile?

Thanks in Advance.

LioricZ3 .

unread,
Mar 18, 2014, 3:07:19 PM3/18/14
to panda...@googlegroups.com
I have spent full 7 days trying to make a PandaBoard ES act as a (full featured) headset. While I don't use Android (and don't want to ever use it ;) ) I have setup everything in a custom Linux OS

Well, hopefully in Android it is easier, but It was a mess to just get it to a semi working state (A2DP, AVCRP, HFP profiles), I had to customize BlueZ, customize PulseAudio, customize Alsa and customize some bits of the Kernel, specially the shmem parts (at least ofono was compiled as default)

And after a lot (really a lot) modifications, I can get A2DP fully working with some special combinations (BlueZ 5, Pulse from git), but no HFP with this combination, PulseA (for BlueZ 5.x) doesn't register a HFP (SCO) audio
agent.

Then I can get a semi-working HFP with a totally different combination (and more modifications) and finally use Alsa directly (I don't want to use PulseA in my OS), but the SCO audio quality was not really usable. You need to route via HCI and no PCM (the TiWiBle module, in the current PandaBoard setup can't route via PCM), the voice sounds as if is sampled at twice the speed, but the SCO connection reports 8000Hz, and this results in audio played back at twice the speed. But then A2DP didn't work with this setup.

PBAP never worked on any of my tests, and a somewhat small subset of AVCRP did

To solve this we need access to the firmware, and TI and LSI have it under a lock.

After almost a week on this, I have started playing with HCI commands to change the TiWiBLE setup directly to see if the sound issue can be corrected, but I decided that this is taking more than what was allowed for setting bluetooth, and we just threw hardware at the problem (we replaced the odd TiWiBLE with a BC127) and in a couple of hours it was working nicely with more features than what you would ever need (including PBAP, SAP, SPP, source, sink modes and BLE support)

So, hopefully the Bluetooth stack in Android is more mature and stable, but BlueZ/PulseAudio/ofono is a no go on Linux (at least in the current state) and not really usable for production

Anyway if you are using BlueZ on Android and need any help, ask away I will try to help

Lioric


--
You received this message because you are subscribed to the Google Groups "pandaboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandaboard+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aashish Patel

unread,
Mar 19, 2014, 1:59:29 AM3/19/14
to panda...@googlegroups.com
Thanks for quick reply.

Problem is I have been asked to use kitkat only (which is not officially supported for pandaboard) and I cannot find any useful documentation on bluedroid. After a week of grinding through bluedroid source code I have come to the conclusion that we may have to completely replace the HFP interface in it(since its for Audio Gateway Role) with our own (Implementing Hands free role) for it to work as Hands free. 

Still going through HFP specs to find a workaround so that I can use the same code with some tweaks.

will update on developments.

jip...@gmail.com

unread,
May 21, 2014, 7:13:19 AM5/21/14
to panda...@googlegroups.com
Hi lioric, 
what kind of linux OS have you made? I am pulling my nuts down to make a fully workable telephony-music environment, using Pandaboard ES rev2, ubuntu 12.04 3.2.0 and blues 4.98, 
but I can not handle it with audio transfer between smartphone and Pandaboard.
a2dp works fine and AVRCP is still to do, what do you can suggest so far??

cheers
Xoce

NimeshChanchani

unread,
Jun 4, 2014, 5:28:41 AM6/4/14
to panda...@googlegroups.com, jip...@gmail.com
Even i need to Enable the A2DP and HFP sink on Android Kitkat , wondering if its better to use bluez in chrooted linux or extend the functionality of bluedroid,
 
i'm first investigating extetion of bluedroid.. but it seems like a mess with no documentation available ..i dont know to what extent the functionality is implemented ...moreover since bluetooth specifications mostly theoritical ( much unlike openmax) , i'm finding it very difficult to identify what parts of the functionality are implemented...
 
has anyone ventured on this path .. and if so would you be kind enough to share your experience and approach?

LioricZ3 .

unread,
Jun 4, 2014, 12:07:34 PM6/4/14
to panda...@googlegroups.com
> what kind of linux OS have you made?

Kernel 3.4.27
BusyBox based toolset
omap drm HW GPU
Qt 5 running on GPU frame buffer (EGL/DRM/KMS)

The rest is fully customized (think of android) with my own Graphics System (similar to what Surfaceflinger, Harware Composer et al are on droids)

and it boots in 1.6s ;)

>
a2dp works fine and AVRCP is still to do, what do you can suggest so far??

Actually, I have dropped the whole "Bluetooth Linux stack plus TiWiBLE", and switched to a IC embbeded BT stack solution (BC127) that is connected via UART to my system, so in a couple of hours after switching I had HFP A2DP AVRCP MAP SPP PBAP and BLE working nicely, with access to the phone book and even a variety of audio codecs with echo cancelling.

My suggestion after all the research that I did on Panda/Bluetooth is that Linux BT stack (Blue/ofono/PulseAudio) is not really a viable solution in its current state. Even after all the patching and mix and matching, one last issue remains: the quality of the audio, and this is not something that can be fixed without a soldering iron ;) as it is hardware related. The TiWiBLE is not wired to route SCO audio on PCM so you only have to route it via HCI (I don't remember it very well as it has been several months since I worked with the Panda BT ic, but I believe PCM is routed to the FM output or something similar)

Anyway if you have everything working on the software side, and only HFP audio (voice) is not being played, you need to route it via HCI

These commands are from memory, so please review them with the vendor specific cmd datasheet:

/usr/bin/hcitool cmd 0x3f 0x211

That reads the SCO channels configuration. It returns 3 blocks of hex values, you are interested in the second one (channel 0), something similar to:

XX XX XX XX    00 30 XX.... (channel0)   XX XX .... (channel1)

The first value of the channel (here 00) shows the SCO connection type:

00 -> PCM
01 -> HCI

You need to change this to HCI (01) for the voice to route to the host. Get the resulting channel configuration block, change the first byte to 01, remove the third byte and use the write SCO configuration cmd:

/usr/bin/hcitool cmd 0x3f 0x210   0x01 0x30 XX XX XX

I will try to find the vendor specific datasheet for the wl127, hopefully it is still somewhere in any of the disks, also I will search in the bash history of the panda to see if the actual commands are there and verify the correct values

Lioric




This gets the current connection settings, it returns

Aashish Patel

unread,
Jun 23, 2014, 2:37:27 AM6/23/14
to panda...@googlegroups.com
Hi Lioric,

Thanks for reply. 

Even we are thinking of dropping the idea of implementing HF role and A2DP sink on android(bluedroid stack). 
And looking for IC solutions with embedded BT stack. 

The one that you have mentioned BC127 seems good but only has support for HFP,A2DP and PBAP could not find any info on BLE profiles supported by it. 
So have you implemented MAP and other profiles ?
Is proper documention available for implementing a profile ? (Since I am newbie to BT technology) 
We would like to share data(objects) as future application.

Can you suggest any other IC modules?
Only module we found is PAN1026 (with Toshiba TC35661 and an embedded Controller)



On Tuesday, March 18, 2014 11:54:35 AM UTC+5:30, Aashish Patel wrote:

LioricZ3 .

unread,
Jun 25, 2014, 7:49:36 PM6/25/14
to panda...@googlegroups.com
The BC127 does support BLE (even IBeacon, in fact it has the most broad support of profiles and features from any Bluetooth ICs in MY research)

See the BlueCreations site for more details


> So have you implemented MAP and other profiles ?

Map is supported by default on Melody (the firmware) 5.x (I don't remember the exact version)

The firmware is closed so there is no way to implement what s not already there

> Can you suggest any other IC modules?

Not really, maybe try on some bluetooth or wireless forums

Maybe test some RovingNetworks IC, as it is considered to be good bluetooth radios



--

Ashish Patel

unread,
Nov 20, 2014, 6:10:58 PM11/20/14
to panda...@googlegroups.com, aashisha...@gmail.com
Latest android asop code 5.0.0 has bluetooth  Handsfree Profile (HF role) Bluetooth Interface included in it.
Has anyone tested it ?

fongz...@gmail.com

unread,
Apr 15, 2016, 3:21:14 AM4/15/16
to pandaboard, aashisha...@gmail.com
Hello Aashish,

        We are working on this Bluetooth Handsfree profile HS role. Did you got any breakthrough in achieving this for Android OS.
I checked with the Bluedroid sources and they have this profile but could not turn it on. If you have achieved this can you please share more info on this.

Thanks and Regards.
Fongz.
Reply all
Reply to author
Forward
0 new messages