Spectral Scan Support

| Driver | HAL | Supported Hardware | 802.11n support | Debugging |

The AR9280 and later NICs have the ability to report FFT data from the baseband under user-controlled conditions.

Overview

The PHY has the ability to report FFT summary information about the received wireless signal. This is useful for a variety of reasons - visualising the radio spectrum is one obvious benefit; others have used it to build interference classifiers.

The FFT summary includes:

It does not run in parallel with wireless transmission or reception - so either spectral scan FFT reporting can run, OR packet transmission/reception.

Configuration

The spectral scan HAL API allows for a few tweaks:

On the AR9280, an ss_count of 128 is interpreted as "never disable" returning samples. Otherwise, "ss_count" samples are returned, then the spectral scan mode is moved from active to stopped.

The athspectral tool in src/tools/tools/ath/ allows for command line control of the spectral scan code.

The latter (enable_at_reset) is useful for sampling during channel scanning.

For the 11n chips (AR9280 and later), chain 0 is used for spectral scan. So, the RSSI values for chain 0 (primary and extension) should be used. Don't use the combined RSSI value.

The RSSI value may be below 0 for very weak signals, so please keep this in mind. The hardware will return RSSI as a signed value.

Frame format

Spectral scan data is reported as a PHY error.

HT20:

Byte

Description

0

bin -28 magnitude[7:0] = (|i| + |q|) >> max_exp

1

bin -27 magnitude[7:0] = (|i| + |q|) >> max_exp

2 - 53 …

54

bin 26 magnitude[7:0] = (|i| + |q|) >> max_exp

55

bin 27 magnitude[7:0] = (|i| + |q|) >> max_exp

56

[7:0]: all bins {max_magnitude[1:0], bitmap_weight[5:0]}

57

[7:0]: all bins max_magnitude[9:2]

58

[7:0]: all bins {max_index[5:0], max_magnitude[11:10]}

59

[3:0]: max_exp (shift amount to size max bin to 8-bit unsigned)

HT40:

0

bin -64 magnitude[7:0] = (|i| + |q|) >> max_exp

1

bin -63 magnitude[7:0] = (|i| + |q|) >> max_exp

2 - 125 …

126

bin 62 magnitude[7:0] = (|i| + |q|) >> max_exp

127

bin 63 magnitude[7:0] = (|i| + |q|) >> max_exp

128

[7:0]: lower bins {max_magnitude[1:0], bitmap_weight[5:0]}

129

[7:0]: lower bins max_magnitude[9:2]

130

[7:0]: lower bins {max_index[5:0], max_magnitude[11:10]}

131

[7:0]: upper bins {max_magnitude[1:0], bitmap_weight[5:0]}

132

[7:0]: upper bins max_magnitude[9:2]

133

[7:0]: upper bins {max_index[5:0], max_magnitude[11:10]}

134

[3:0]: max_exp (shift amount to size max bin to 8-bit unsigned)

Calculating a dBm value from the reported magnitudes

The sum of all of the magnitudes in the sample should equal the reported RSSI. So to calculate a dBm value, the rough method is:

So do this programatically for a HT20 channel:

bin_sum = 10*log(sum[i=1..56](b(i)^2)

Where b(i) is the magnitude value in each bin, corrected by max_esp to give a true magnitude value;

Then the dBm value for each bin (i):

power(i) = noise_floor + RSSI + 10*log(b(i)^2) - bin_sum

And for HT40, you would do this over 64 bins for both lower and upper - using the appropriate RSSI from the RX descriptor. For HT40- channels, the extension channel is below the primary channel, so you would use lower=extension RSSI and upper=primary RSSI. For HT40+ channels, the extension channel is above the primary channel, so lower=primary RSSI, upper=extension RSSI.

Known Issues

dev/ath_hal(4)/SpectralScan (last edited 2013-01-30T23:41:45+0000 by AdrianChadd)