int LP PHY Loopback
- Create a struct iq_est and initialize to zero
- Initialize a "saved loop index" variable to -1
Call LP PHY Set TRSW Override with arguments (1,1)
Set bit 0x1 in PHY Register 0x43B
Clear bit 0x01 in PHY Register 0x43C
Set bit 0x800 in PHY Register 0x44C
Set bit 0x800 in PHY Register 0x44D
Set bit 0x8 in PHY Register 0x44C
Set bit 0x8 in PHY Register 0x44D
Write 0x80 to Radio Register 0x4F
Set bit 0x80 in PHY Register 0x44C
Set bit 0x80 in PHY Register 0x44D
- Loop 32 times with index starting at 0
Call LP PHY Set RX Gain by Index with the loop index as argument
Call LP PHY Run DDFS with (1,1,5,5,0) as arguments
Call LP PHY RX IQ Est with (1000,32,&iq_est) as arguments
- If the returned result is zero
- Continue
- Add the i_pwr member of iq_est to the q_pwr member and divide by 1000
If the result is > 4000 and < 10000
- Save the loop index
- Break from the loop
Call LP PHY Stop DDFS
- Return the saved loop index