bcm-v4 [Specification]

## Local Oscillator Feedthrough Measurement

The State Machine cycles through the available Local Oscillator states, trying to find the setting with the lowest feedthrough value.

A state diagram of the state machine's steps is available here: statemachine.pdf.

## State Value Multipliers

Starting values for the State Value Multiplier

 Criteria Value If Loopback Gain is enabled and the table isn't empty 3 Otherwise 1

## Measuring the Feedthrough of a LO State

Each transition of the state machine modifies the current LO Control I and Q values depending on the target state of that transition. The table of LO Control I and Q modifiers is given below. The I and Q delta values are multiplied by the State Value Multiplier before application to the I and Q values for the current state.

 State I Delta Q Delta 1 +1 +1 2 +1 0 3 +1 -1 4 0 -1 5 -1 -1 6 -1 0 7 -1 +1 8 0 +1

If the absolute value of either value in the control pair would cause it to be greater than 16, the transition may not be taken. Otherwise, the feedthrough value is measured by Adjusting the Local Oscillator with the I and Q values of the state to transition to, then Measure the Feedthrough. The transition that generates the smallest feedthrough value is taken. This repeats up to 24 times, or until no transition yields a smaller feedthrough value, and the new LO Control I and Q values are returned.

## Measuring the Feedthrough of a LO State - Details

This describes the process in a little more detail, including some workarounds and implementation details.

1. Start the Pass Counter at 0 Note that it's only cleared here at the start of measuring the feedthrough

2. If Loopback Gain is enabled and the table is empty, perform the following procedure up to 4 times, otherwise, perform it only once
1. Adjust the Local Oscillator with the current I and Q values

2. Measure the Feedthrough using the last TRSW_RX, LNA and PGA values found

3. If the table wasn't empty and the measured feedthrough value was less than 0x258
1. If the measured feedthrough value was 0x12C or higher
1. Add 0x6 to the Maximum RX Gain used to Measure the Gain Values

2. Otherwise
1. Add 0x3 to the Maximum RX Gain used to Measure the Gain Values

3. Measure the Feedthrough again, using the last TRSW_RX, LNA and PGA values found

4. Loop until the Pass Counter is 24
1. Loop over the each possible I and Q delta in this state
1. Multiply the I and Q delta by the state value multiplier, then add the result to the I and Q values of the current LO Control Value

2. If either of the LO Control Values I or Q isn't equal to the previous I or Q values and the absolute value of both the I and Q values are 16 or below

1. Adjust the Local Oscillator with the current I and Q values

2. Measure the Feedthrough using the last TRSW_RX, LNA and PGA values found

3. If the measured feedthrough is lower than previous results, we've found a new minimum
4. If this less than the 2nd time this whole procedure has been performed
1. If Loopback Gain is disabled or the table is empty
1. Break from the I and Q delta state testing loop
2. If the minimum LO Control I and Q values are equal to the previous minimum LO Control I and Q values

1. Break, the minimum was found
3. Increment the Pass Counter
5. If Loopback Gain is enabled and the minimum Feedthrough value is > 0x1194

1. Subtract 6 from the Maximum RX Gain value
6. If Loopback Gain is enabled and the minimum Feedthrough value is < 0x5DC

1. Add 3 to the Maximum RX Gain value
7. If this is the first time this whole procedure has been performed and Loopback Gain is enabled
1. If the minimum feedthrough value is 0x5DC or less
1. Use 1 as the State Value Multiplier from now on and skip the second pass through the whole procedure so the next pass through is the 3rd pass
2. Otherwise
1. Use 2 as the State Value Multiplier from now on
8. If this is the 3rd time this whole procedure has been performed and Loopback Gain is enabled
1. Use 1 as the State Value Multiplier from now on
9. Measure the Gains using the Maximum RX Gain Value (Use of TRSW_RX is enabled if Loopback Gain is enabled)

Exported/Archived from the wiki to HTML on 2016-10-27