Antenna Diversity on the AR9285
The AR9285/AR9485 support a combination of classic antenna diversity and LNA diversity.
Registers involved
If AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV is on, but AR_PHY_9285_ANT_DIV_CTL is not, then only classic external antenna switch diversity is used. If they are both on, LNA diversity is used.
- AR_PHY_CCK_DETECT - AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV enables or disables diversity globally.
- AR_PHY_MULTICHAIN_GAIN_CTL - controls LNA diversity
- AR_PHY_9285_ANT_DIV_CTL - enable/disable LNA diversity
- AR_PHY_9285_FAST_DIV_BIAS - how much to bias the "main" antenna configuration by when selecting between main/alt LNA diversity
- AR_PHY_9285_ANT_DIV_MAIN_LNACONF - the main LNA configuration - 0=LNA1-LNA2, 1=LNA2, 2=LNA1, 3=LNA1+LNA2
- AR_PHY_9285_ANT_DIV_ALT_LNACONF - the alternate LNA configuration
- AR_DEF_ANTENNA - controls the default RX switch and RX LNA configuration
- Bit 1 - controls whether to default to the main (0) or alt (1) configuration
- Bit 0 - controls whether to default to RX antenna switch setting 0 or 1
Switch Table
The AR9285 has two switch table fields - one for the common table, one for the radio chain. There's only one radio chain though. Their defaults come from the EEPROM.
By default - if there's no external antenna switch - both tables are programmed with 0x0.
However, if there's an external antenna switch (eg for TX diversity, or for bluetooth coexistence) the antenna switch is going to need to be programmed with some values to drive the antenna switch appropriately.
The Switch Table and Bluetooth
In order to drive the antenna correctly, there needs to be an antenna switch sitting between the AR9285, the AR3011 bluetooth device and the external antenna. The switch is controlled by the MAC rather than by the bluetooth device, so correctly coexistence AND operation is required.
The AR3011 signals the MAC (via the 3-wire coexistence interface) that a Bluetooth transmission is about to occur and the AR9285 MAC decides whether to select the bluetooth antenna entry in the switch table or the 802.11 side.
The WB195 NIC doesn't store the bluetooth coexistence switch table values in EEPROM - those are all 0x0. So to use bluetooth, one needs to program the antenna switch registers appropriately. This is done via some hard-coded constants in ath_hal/ar9002/ar9285_btcoex.c:ar9285BTCoexAntennaDiversity().
Getting information about the settings used when receiving a frame
Since there's only two antennas on these devices, the third RSSI entry in the RX completion descriptor is re-used as an antenna and LNA configuration report.
So, instead of Primary channel RSSI for chain 2, this is what is reported:
Bit[7] |
LNA config used to receive frame (0->"Main" or 1->"Alternate") |
Bit[6] |
ext diversity antenna used to receive frame (0->ant1 or 1->ant2) |
Bit[5:4] |
LNA config used to receive frame |
Bit[3:2] |
LNA config used for "Main" |
Bit[1:0] |
LNA config used for "Alternate" |
And instead of Extension channel RSSI for chain 2, this is what is reported:
Bit[7] |
0, not used |
Bit[6] |
Fast diversity measurement executed on this frame? (0->no or 1->yes) |
Bit[5:4] |
output of BB switchtables: sw_0[1:0] |
Bit[3:0] |
output of BB switchtables: sw_com[3:0] |
Getting run-time statistics
The ath(4) driver maps the RX LNA configuration used to the legacy "receive antenna" statistic. You can see this by compiling/running athstats.
So:
- rx[0] is LNA1-LNA2
- rx[1] is LNA2
- rx[2] is LNA1
- rx[3] is LNA1+LNA2
What isn't yet described
- How does transmit diversity function with the external antenna switch and antenna switch tables? Does it work at all?