====== AR9130/AR9160 radar detection ====== ===== Overview ===== The AR9130/AR9160 radar reports include much more information than the previous generation. ===== PHY error frame format ===== The PHY error length is now (at least) three bytes, with the following information (for a frame 'n' bytes in length): * optional FFT payloads, if the pulse is long enough * byte n-3: Pulse length in the primary channel * byte n-2: Pulse length in the extension channel * byte n-1: flags Flags contains: * 0x01: Pulse in primary channel * 0x02: Pulse in extension channel * 0x04: "Early extension event" found (TBD: more explanation) The stronger of the RSSIs in the primary and extension channel should be used. ===== FFT information ===== An optional FFT report is available for frames which meet a certain set of parameters. This is primarily designed to assist in chirp detection, where a radar pulse moves in frequency over time. These pulses are normally detected as long pulses (45-90 uS). Each FFT sample corresponds to a 3.2uS window (40MHz/80MHz clock) or 2.9uS window (44MHz/88MHz clock). HT20: | Byte | Bit field | Description | | 0 | [3:0]: | bin -28 {bitmap, quantized magnitude[2:0]} | | | [7:4]: | bin -27 {bitmap, quantized magnitude[2:0]} | | 1 | [3:0]: | bin -26 {bitmap, quantized magnitude[2:0]} | | | [7:4]: | bin -25 {bitmap, quantized magnitude[2:0]} | | 2 - 25 | | ... | | 26 | [3:0]: | bin 24 {bitmap, quantized magnitude[2:0]} | | | [7:4]: | bin 25 {bitmap, quantized magnitude[2:0]} | | 27 | [3:0]: | bin 26 {bitmap, quantized magnitude[2:0]} | | | [7:4]: | bin 27 {bitmap, quantized magnitude[2:0]} | | 28 | [7:0]: | all bins {max_magnitude[1:0], bitmap_weight[5:0]} | | 29 | [7:0]: | all bins max_magnitude[9:2] | | 30 | [7:0]: | all bins {max_index[5:0], max_magnitude[11:10]} | Dynamic HT40 mode (regardless of whether the received data frames are HT20 or HT40; this is the mode the PHY is in): | Byte | Bitfield | Description | | 0 | [3:0]: | bin -64 {bitmap, quantized magnitude[2:0]} | | | [7:4]: | bin -63 {bitmap, quantized magnitude[2:0]} | | 1 | [3:0]: | bin -62 {bitmap, quantized magnitude[2:0]} | | | [7:4]: | bin -61 {bitmap, quantized magnitude[2:0]} | | 2 - 61 | | … | | 62 | [3:0]: | bin 60 {bitmap, quantized magnitude[2:0]} | | | [7:4]: | bin 61 {bitmap, quantized magnitude[2:0]} | | 63 | [3:0]: | bin 62 {bitmap, quantized magnitude[2:0]} | | | [7:4]: | bin 63 {bitmap, quantized magnitude[2:0]} | | 64 | [7:0]: | lower bins {max_magnitude[1:0], bitmap_weight[5:0]} | | 65 | [7:0]: | lower bins max_magnitude[9:2] | | 66 | [7:0]: | lower bins {max_index[5:0], max_magnitude[11:10]} | | 67 | [7:0]: | upper bins {max_magnitude[1:0], bitmap_weight[5:0]} | | 68 | [7:0]: | upper bins max_magnitude[9:2] | | 69 | [7:0]: | upper bins {max_index[5:0], max_magnitude[11:10]} | The radar FFT analysis provides a variety of information: * The max_magnitude is calculated, as the value of |I| + |Q| * the FFT bin index of the max_magnitude field is populated in max_index * for each bin, if the magitude is greater than a pre-programmed threshold (**TODO**: document this register field), the bit in the bitmap field is set; * the quantized magnitude is then calculated for all bins, calculated as floor(bin power * 8 / max_magnitude) ===== Notes / Limitations ===== * The FFT report data may be truncated if the incoming signal level drops before an FFT is completed. Thus, don't trust that the FFT data will be complete. * There are some known BB hangs with DFS on the AR9130/AR9160. The BB hang code in the ath_hal should detect it as a DFS BB hang and reset things. (TODO: check whether the chip needs to be "fixed" by going into another operational mode and bcak again, rather than just a straight reset.) * There are some corruption issues, where the MAC mis-classifies the larger PHY error frames as data frames and re-aligns some portion of the payload. This only affects frames with FFT payloads and not the short PHY error frames (3 bytes.)