Friday, June 14, 2013

Working on Bluetooth Coexistence

I decided to bite the bullet and start hacking on bluetooth coexistence on these Atheros NICs. It's a bit of a rabbit hole.

I'll write up a bit more documentation on this when I'm not overly tired, but the general overview is pretty simple: "It's all done in software."

The bluetooth and wifi stacks need to speak to each other to know when is an appropriate time to prefer wifi traffic or bluetooth traffic. When pairing, bluetooth should be preferred. When scanning, associating, authenticating and rekeying, wifi should be preferred. When different profiles are active (eg A2DP audio), the bluetooth traffic should be periodically given preference so the A2DP frames can go out reliably. This has to be controlled in software.

So to make this work well on FreeBSD, I'll have to teach the wifi and bluetooth stacks to interface with each other somehow so this can be synchronised.

I have basic (static) coexistence working with the AR9285+AR3011 combo NIC. That's now in -HEAD.

I'm working on basic (static) coexistence on the AR9485+AR3012 combo NIC, however my NIC has an older BT part which requires quite a bit of dancing to make work. I'll have to teach ath3kfw how to load the config and firmware image for the required NIC. It's going to take some time but it'll be worth it.

I was hoping that FreeBSD would have basic A2DP support but it currently doesn't. I'd love to see that happen as it'd simplify a lot of my development/testing - as I can then do audio stream testing both playing and recording audio, then stream that over wifi.

Oh well. Another day of hacking!


  1. hi adrian,
    Thanks for all hard work on ath drivers for FreeBSD. It's very good.

    I have a card (dual, AR9220 + AR 9223) and in my FreeBSD, in debug have the message:

    In FreeBSD 10 (current 16/03/2013) the problem is the same.
    I try to edit this files insert the region domain (i not computer programmer):

    But now i have this error:

    ieee80211_get_ratetable: no rate table for channel; freq 0 flags 0x0

    Where i can see this rate tables ?.

    Thank you very much.

  2. Hi!

    0x165 ? ok, I'll go look it up.

    The dual AR9220+AR9223 NIC - does it have a third chip on there (PCI bridge?) The combo NIC is a "special" one for a specific Atheros SoC reference design (PB47) which has a slightly modified PCI connector just for this particular purpose.

    Please file a PR with the above and tell me what the number is. I'll go hunting for that regulatory domain id and add it.



  3. hi,

    The PR is kern/179847 (

    Thanks for your great support!.