This is an old revision of the document!
Atheros 802.11n chipsets include a built-in spectral analysis feature. AR92xx and AR93xx have the ability to report FFT data from the baseband under software controlled conditions, including:
To try it out, you can use the following commands to acquire samples for all channels which can be scanned:
echo chanscan > /sys/kernel/debug/ieee80211/phy0/ath9k/spectral_scan_ctl iw dev wlan0 scan cat /sys/kernel/debug/ieee80211/phy0/ath9k/spectral_scan0 > samples echo disable > /sys/kernel/debug/ieee80211/phy0/ath9k/spectral_scan_ctl
Spectral scan configuration parameters can be read and changed /sys/kernel/debug/ieee80211/phy0/ath9k/:
0 1 2 3 4 5 6 7 8 +---------------------------------------------------------------+ 0 | [7:0]: bin -28 magnitude (|i| + |q|) >> max_exp | +---------------------------------------------------------------+ 1 | [7:0]: bin -27 magnitude (|i| + |q|) >> max_exp | +---------------------------------------------------------------+ 2-54 | | +---------------------------------------------------------------+ 55 | [7:0]: bin 27 magnitude (|i| + |q|) >> max_exp | +---------------------------------------------------------------+ 56 | [7:0]: all_bins {max_magnite[1:0], bitmap_weight[5:0]} | +---------------------------------------------------------------+ 57 | [7:0]: all_bins {max_magnite[9:2]} | +---------------------------------------------------------------+ 58 | [7:0]: all_bins {max_index[5:0], max_magnite[11:10]} | +---------------------------------------------------------------+ 59 | [3:0] max_exp | +---------------------------------------------------------------+
0 1 2 3 4 5 6 7 8 +---------------------------------------------------------------+ 0 | [7:0]: bin -64 magnitude (|i| + |q|) >> max_exp | +---------------------------------------------------------------+ 1 | [7:0]: bin -63 magnitude (|i| + |q|) >> max_exp | +---------------------------------------------------------------+ 2-125 | | +---------------------------------------------------------------+ 127 | [7:0]: bin 63 magnitude (|i| + |q|) >> max_exp | +---------------------------------------------------------------+ 128 | [7:0]: lower_bins {max_magnite[1:0], bitmap_weight[5:0]} | +---------------------------------------------------------------+ 129 | [7:0]: lower_bins {max_magnite[9:2]} | +---------------------------------------------------------------+ 130 | [7:0]: lower_bins {max_index[5:0], max_magnite[11:10]} | +---------------------------------------------------------------+ 131 | [7:0]: upper_bins {max_magnite[1:0], bitmap_weight[5:0]} | +---------------------------------------------------------------+ 132 | [7:0]: upper_bins {max_magnite[9:2]} | +---------------------------------------------------------------+ 133 | [7:0]: upper_bins {max_index[5:0], max_magnite[11:10]} | +---------------------------------------------------------------+ 134 | [3:0] max_exp | +---------------------------------------------------------------+
Assuming the noise floor is equal to -96dbm(*) and the magnitude of each sample in a 20MHz bin equals the RSSI, the received signal strength of each FFT bin on HT20 channel can be computed as follow:
(*) nf can differ from -96dbm due to noise and spikes leading to a reduced reported RSSI
FFT samples gathered from Atheros NICs could be drawn using userspace programs:
(based on Adrian Chadd's documentation https://wiki.freebsd.org/dev/ath_hal%284%29/SpectralScan)