## Start Noise Sampling Interrupt

- Save the current channel so we can check on the interrupt that the channel hasn't changed and the data is valid
- If this is an A PHY
Lock PHYRegisterLock

Lock RadioRegisterLock

Mask PHYRegister 0x7A with 0xF0FF

Read the value of RadioRegister 0x13

Unlock RadioRegisterLock

Unlock PHYRegisterLock

Write the value from RadioRegister 0x13 to SHM offset 0x6C

Write 0 to SHM offset 0x408

Write 0 to SHM offset 0x40A

Set bit 4 (0x10) in the Reg124BitField

## On the Interrupt

Read the 16 bit value from SHM offset 0x408 and split it into two 8 bit values

- If this is a G PHY
Read the 16 bit value from SHM offset 0x40A and split it into two 8 bit values

Read the 16 bit value from SHM offset 0x40C, convert this from the channel format written to the chip to the channel number

- If this is an A PHY
- Take the absolute value of the first 8 bit value
- If the second value bitwise AND'd with 1 is 0
- Start the Noise Sampling Interrupt again

- If the PHY Revision is 3 or greater
- Left shift the value by 2

- If the channel isn't the same as when we generated the noise sample return
Using each 8 bit value as an offset into the in memory NRSSILookupTable, then save the looked up value

- If we have not yet collected 8 samples, Start the Noise Sampling Interrupt again and return

## Evaluating the Noise

- Find the average of the samples multiply it by 125 and add 64, then divide by 128
Take the channel value read from SHM offset 0x40C divided by 128 AND'd by 0x1F

- If the adjusted channel value is 8 or greater, add 2 to the average, otherwise subtract 25
- If the adjusted channel value is 8, subtract 72 from the average, otherwise subtract 48
- The result is the noise level in dBm (probably)