Hi all, I made the mistake of whacking an AR9285 into an EEEPC I have here. It has one antenna. So, I thought, I'll just whack it onto the primary antenna as I know the AR9285 only transmits on the main antenna (the second antenna connector is only for receive.)
And it didn't work. Thus started the journey of "what the hell kind of weird crap is going on here." The TL;DR version - if you use an AR9285 or AR2427, please update to the latest -HEAD. The short version: It's a 1x1 chip. But it has two receive inputs - LNA1 and LNA2. LNA1 shares with TX and it's 3dB less sensitive than LNA2. So ideally you want to configure things so you receive on LNA2. There's also a receive antenna switch table and switch bit that can connect to an external antenna switch. If you don't have an AR9285 + bluetooth combo, you very likely don't have an antenna switch. So _normally_, this is what you have: * Antenna 1 / Main : connects to LNA1, is used for TX * Antenna 2 / Alt : connects to LNA2, is used for RX. Now if you're using a single-antenna device, that can only connect to LNA1. Next, there's how it's configured up. There's this thing called "LNA combining." Where the BB mixes the LNA signals in different ways. The four configurations are: * LNA1 only * LNA2 only * LNA1-LNA2 * LNA1+LNA2 Then there's two profiles - "main" and "alt." You configure "main" as the receive profile that the BB tries first. If it has time, it'll try the "alt" config and if that's better than main, it'll flip over to using this to receive the frame. These get programmed in by some settings in the EEPROM. Now - what happened: I naively thought that the driver code "just worked." It turns out that yes, the driver code just worked, except for setting AR_DEF_ANTENNA to 1 instead of the default (0). This meant the MAC would tell the PHY that it should just do receive on the alternate config. If you have a single antenna connected to LNA1 _and_ your NIC EEPROM settings default to "main = LNA1, alt=LNA2", it'll always receive on LNA2. This obviously would result in badness - you always receive on a non-connected antenna. So, I fixed that. It worked. But I wanted some better diagnostic/debugging tools. The first thing I did was to hack the receive path to log the LNA configuration used in the RX antenna field, rather than having it default to something useless. So now, athstats shows this: Antenna profile:  tx 6232 rx 17364  tx 0 rx 64685  tx 0 rx 9615 These map as following: rx0 = LNA1-LNA2 rx1 = LNA2 rx2 = LNA1 rx3 = LNA1+LNA2 rx4->rx7 is the same as rx0->rx3, but with the "external" RX antenna diversity switch set to '1'. So now, you can watch this live: adrian@lucy:~/work/freebsd/ath/head/src/sys/dev/ath]> athstats -o input,output,rxstbc,rx0,rx1,rx2,rx3,rx4,rx5,rx6,rx7,rssi 1 input output rxstbc ant0(rx) ant1(rx) ant2(rx) ant3(rx) ant4(rx) ant5(rx) ant6(rx) ant7(rx) rssi 95610 7740 8242 17364 68075 10171 0 0 0 0 0 26 59 2 0 0 53 6 0 0 0 0 0 35 50 2 0 0 46 4 0 0 0 0 0 35 66 2 0 0 60 6 0 0 0 0 0 38 60 0 0 0 56 4 0 0 0 0 0 33 .. Next, I wanted to log what the default settings were. That way if people come to me and say that their AR9285 behaves crappy, I at least have the information needed. Behold, from the attach code: [ath] AR9285 Main LNA config: LNA2 [ath] AR9285 Alt LNA config: LNA1 [ath] LNA diversity enabled, Diversity enabled [ath] Enabling diversity for Kite It will now tell you what the main/alternate configuration is specified in the EEPROM and whether diversity is enabled or disabled. After much discussion and research, I've discovered why - for laptops with one antenna, the only real guaranteed way to do this without hacking the driver is to default the EEPROM settings to _not_ enable diversity. Even if the NIC has two antenna connectors and you do hook up a separate antenna. So now this is all done and sorted out, I'm going to document how it all holds together, add some run time configuration twiddles for controlling the AR9285 antenna diversity parameters, and see about writing a tool to log/track the receive antenna configurations so people can tinker with things and figure out why things are performing badly or not. So what's this mean for you? If you have two antennas hooked up, good. If you have one antenna hooked up to the AR9285, the above _must_ say the main configuration is LNA1 if diversity is disabled. or it just won't work. If it says MAIN=LNA2 and diversity is disabled, it will _only_ receive on the second (alt) antenna, and thus you'll have crappy (no) receive performance. Phew! Adrian _______________________________________________ firstname.lastname@example.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-wireless To unsubscribe, send any mail to "freebsd-wireless-unsubscr...@freebsd.org"