Post Go back to editing

Rx LPF gain not working in split gain table mode for AD9363

Category: Software
Product Number: AD9363

We are working with the split gain table mode for the AD9363 in order to get more control over the Rx analog gain settings.  We have been able to successfully control the LMT gains (LNA, TIA, and Mixer gains) and we see appropriate gains taking effect on our test input signals.  For some reason, we are not able to successfully control the LPF gain settings (we think we are setting them, we confirmed the settings by reading back the registers, but don't see it taking effect with a test signal).  No matter what we set the LPF gain value to, it has no effect on the signal.   I have included the steps we took.  Can anyone who has experience with this see anything wrong with our process?

Thanks in advance.

  1. We load a custom split gain table with the command “cat CustomSplitGainTable.txt > /sys/bus/iio/devices/iio:device0/gain_table_config”.  This is a modified version of the AD9361 standard gain table file but only contains the split table portion of the file.
  2. We enable manual gain mode with the command “echo manual > /sys/bus/iio/devices/iio:device0/in_voltage0_gain_control_mode”.
  3. We enable split table mode with the command “echo 1 > /sys/kernel/debug/iio/iio:device0/adi,split-gain-table-mode-enable”.
  4. We set the desired RX gain with the command “echo $SET_LMT_GAIN > /sys/bus/iio/devices/iio:device0/in_voltage0_hardwaregain”.
  5. We enable the digital gain with the command “iio_reg ad9361-phy 0xfb 0x04”.
  6. We set the digital gain to our desired value with the command “iio_reg ad9361-phy 0x10b $SET_DIGITAL_GAIN”.
  7. We set the LPF gain to our desired value with the command “iio_reg ad9361-phy 0x10a $SET_LPF_GAIN”.
  8. Both before and after the above steps, we dump the RX1 gain info with the command “cat /sys/kernel/debug/iio/iio:device0/gaininfo_rx1”.  The after value returned appears to show that both the LPF and Digital gain values were set.
Parents Reply Children
  • Thanks for the response.  Please see the results from the testing we did below.  Any further assistance would be much appreciated.

    We have tried the standard split gain table and see the same results. One thing we’ve noticed is we have to split the ad9361_std_gaintable file into a file containing just the 3 split tables (1 for each of the 3 frequency ranges) and another file containing just the 3 full tables. We got an error trying to load the entire file containing all 6 tables which I assume is due to the larger size.

    Something else we’ve noticed is the gain_table_config does not report the split table as being active until we start a collect. Is that expected behavior? It also seems that the LMT gain is not set to the value we’ve requested in /sys/bus/iio/devices/iio:device0/in_voltage0_hardwaregain until after the collect.

    This is prior to setting hardwaregain, LPF gain, and digital gain.

    Raw GainInfo: (71 76 0 0 0 0 0 0)
    Gain dB: 71
    LMT index: 76
    Digital Gain: 0
    LMT Gain: 0
    LPF Gain: 0
    LNA Index: 0
    TIA Index: 0
    Mixer Index: 0

    This is after setting hardwaregain, LPF gain, and digital gain. Both the LPF and digital gain values reflect what we’ve set them to but the LMT gain shows 0 instead of the 30 dB we requested.

    Raw GainInfo: (12 35 5 0 7 1 1 4)
    Gain dB: 12
    LMT index: 35
    Digital Gain: 5
    LMT Gain: 0
    LPF Gain: 7
    LNA Index: 1
    TIA Index: 1
    Mixer Index: 4

    And this is after a collect has been run. After the collect is the first time that gain_table_config shows the split table as being active. Now the LMT gain shows the 30 dB we requested.

    Raw GainInfo: (42 23 5 30 7 1 1 5)
    Gain dB: 42
    LMT index: 23
    Digital Gain: 5
    LMT Gain: 30
    LPF Gain: 7
    LNA Index: 1
    TIA Index: 1
    Mixer Index: 5

  • We got an error trying to load the entire file containing all 6 tables which I assume is due to the larger size.

    You can only load one gain table at a time into the gain table config as per the frequency of operation.

    Something else we’ve noticed is the gain_table_config does not report the split table as being active until we start a collect. Is that expected behavior? I

    No this is not expected behaviour. The split gain table should get loaded as soon as you load the table using the cat command. When the split gain table gets loaded successfully(check using cat gain_table_config), you should be able to change all the LMT LPF and digital gain using register writes successfully.

    cat /lib/firmware/ad9361_std_gaintable > gain_table_config

  • We’ve created a split gain table by extracting just the middle frequency range from the standard table to test with.  We’re able to load that and it appears to have loaded successfully when we use the command “head -n 1 /sys/bus/iio/devices/iio:device0/gain_table_config”.

     <gaintable AD9361 type=SPLIT dest=3 start=1300000000 end=4000000000>

     However we’re monitoring the system log by tailing it and we see the following message appear when the table was loaded.

     ad9361 spi0.0: ad9361_gt_tableindex: Failed to find suitable gain table (2400000000)

    Dec  1 18:12:07 (none) user.err kernel: ad9361 spi0.0: ad9361_gt_tableindex: Failed to find suitable gain table (2400000000)

    This is confusing as the frequency in the log message (2400000000) is within the range for the table we loaded.  Should we be concerned with this error message?  Is there an order things should be configured in to prevent these type of errors?  We’ve searched for example code which loads a split gain table but haven’t found anything which would show what order the configuration should occur in.  Is there example code available?

  • Can you send  the gain table that you are trying to load? Have you tried with default gain table? Are you getting the same error message("Failed to find suitable gain table (2400000000)") after loading the default gain table? 

  • Hi, I've attached how we are loading the gain table.  What would be VERY HELPFUL would be an example code snippet of how to properly load the split gain table.   Could you please provide one?  We are doing lots of trial and error which is very inefficient.

    We’re loading the split gain table (not sure how to attach, so listing follows below) which is just the split table portion for the mid-range frequencies extracted from the standard table.

     

    By trial and error, we discovered that we no longer see that error “Failed to find suitable gain table” by altering our order of configuration.  Here’s the order we’re currently doing things in.

     

    1. Enabling split table mode with the command “echo 1 > /sys/kernel/debug/iio/iio:device0/adi,split-gain-table-mode-enable”
    2. Enabling MGC with the command “echo manual > /sys/bus/iio/devices/iio:device0/in_voltage0_gain_control_mode”
    3. Loading the attached split gain table with the command “cat ad9361_split_gaintable_mid_range > /sys/bus/iio/devices/iio:device0/gain_table_config”
    4. Setting the hardware gain to 42 with the command “echo 42 > /sys/bus/iio/devices/iio:device0/in_voltage0_hardwaregain”
    5. Enabling the digital gain with the command “iio_reg ad9361-phy 0xfb 0x04”
    6. Setting the digital gain with the command “iio_reg ad9361-phy 0x10b $DIGITAL_GAIN”
    7. Setting the LPF gain with the command “iio_reg ad9361-phy 0x10a $LPF_GAIN”
    8. Then we start a sample collect which doesn’t seem to show the LPF gain having any effect on the signal

     

    We’ve noticed the following strange error message in the system log while running the collect.  Is this something which should concern us?

    ad9361 spi0.0: Calibration TIMEOUT (0x287, 0x2)

    This is the table we are loading:

    <list>

    <gaintable AD9361 type=SPLIT dest=3 start=1300000000 end=4000000000>
    -3, 0x00, 0x18, 0x20
    -3, 0x00, 0x18, 0x00
    -3, 0x00, 0x18, 0x00
    -3, 0x00, 0x18, 0x00
    -3, 0x00, 0x18, 0x00
    -3, 0x00, 0x18, 0x00
    -3, 0x00, 0x18, 0x00
    -3, 0x00, 0x18, 0x20
    0, 0x01, 0x18, 0x20
    6, 0x02, 0x18, 0x20
    12, 0x04, 0x18, 0x20
    18, 0x04, 0x38, 0x20
    19, 0x05, 0x38, 0x20
    20, 0x06, 0x38, 0x20
    21, 0x07, 0x38, 0x20
    22, 0x08, 0x38, 0x20
    23, 0x09, 0x38, 0x20
    24, 0x0A, 0x38, 0x20
    25, 0x0B, 0x38, 0x20
    26, 0x0C, 0x38, 0x20
    27, 0x0D, 0x38, 0x20
    28, 0x0E, 0x38, 0x20
    29, 0x0F, 0x38, 0x20
    30, 0x25, 0x38, 0x20
    31, 0x26, 0x38, 0x20
    32, 0x44, 0x38, 0x20
    33, 0x45, 0x38, 0x20
    34, 0x46, 0x38, 0x20
    35, 0x47, 0x38, 0x20
    36, 0x64, 0x38, 0x20
    37, 0x65, 0x38, 0x20
    38, 0x66, 0x38, 0x20
    39, 0x67, 0x38, 0x20
    40, 0x68, 0x38, 0x20
    41, 0x69, 0x38, 0x20
    42, 0x6A, 0x38, 0x20
    43, 0x6B, 0x38, 0x20
    44, 0x6C, 0x38, 0x20
    45, 0x6D, 0x38, 0x20
    46, 0x6E, 0x38, 0x20
    47, 0x6F, 0x38, 0x20
    </gaintable>

    </list>

  • We’ve noticed the following strange error message in the system log while running the collect.  Is this something which should concern us?

    ad9361 spi0.0: Calibration TIMEOUT (0x287, 0x2)

    This indicates that some of the callibrations are failing. Are you enabling tracking cals? Have you faced this error while initialization of the chip?

    Try with the below sequence:

    1. Enabling split table mode with the command “echo 1 > /sys/kernel/debug/iio/iio:device0/adi,split-gain-table-mode-enable”
    2. Loading the attached split gain table with the command “cat ad9361_split_gaintable_mid_range > /sys/bus/iio/devices/iio:device0/gain_table_config”
    3. Enabling MGC with the command “echo manual > /sys/bus/iio/devices/iio:device0/in_voltage0_gain_control_mode
    4. Setting the hardware gain to 42 with the command “echo 42 > /sys/bus/iio/devices/iio:device0/in_voltage0_hardwaregain”
    5. Read the hardware gain using cat in_voltage0_hardwaregain.
    6. Enabling the digital gain with the command echo 1 > /sys/kernel/debug/iio/iio\:device1/adi,gc-dig-gain-enable
    7. Setting the digital gain with the command “iio_reg ad9361-phy 0x10b $DIGITAL_GAIN”
    8. Setting the LPF gain with the command “iio_reg ad9361-phy 0x10a $LPF_GAIN
  • Thanks for the guidance.   We followed your sequence but unfortunately it didn't make a difference.
    We had to make a slight change from iio:device1 to iio:device0 to that initialization sequence for it to run. 
    That seems to use an IIO attribute to enable digital gain which we were trying to do with "iio_reg 0xfb 0x04" command.  Speaking of that command, we just noticed that we should probably have used the command "iio_reg 0xfb 0x05" to leave RX1 in manual gain control mode.  Correcting that didn't make a difference either.
     Since you mentioned we should make sure that we've got calibration tracking enabled, we checked the Rx Quadrature Calibration config 1 register which is the only obvious calibration tracking control we could find.  In that register, bit D0 is set to enable tracking mode for channel 1.  That seems to be the default setting since we have not explicitly set it. 
    # iio_reg ad9361-phy 0x169
    0xcd
    One last thing - we've also noticed that the "ad9361 spi0.0: Calibration TIMEOUT (0x287, 0x2)" error message is only printed the first time we run the script after rebooting the board so that error message might not be worth pursuing.
    Please let us know what else we can try to get this to work.
    Thanks
  • How are you ensuring that the LPF gain is not working? Can you readback the 0x0AA  and 0x0AEregisters for the LMT and the LPF gain index? Is it getting set correctly? What is the status of the register Use AGC for LMT/LPF Gain bit?

    Split table consists of two tables. Below lines shows about the functioning. Refer to the below link:

     AD9364 Rx gain control with split table  

  • Hi, here are the contents of registers 0xAA and 0xAE. We've got TX disabled and hadn't thought that setting the Tx Quadrature Calibration registers would be necessary. Please let us know if that assumption is not correct.

    # iio_reg ad9361-phy 0xaa
    0x25
    # iio_reg ad9361-phy 0xae
    0x0

    Here are the contents of register 0xFC (AGC Config3) which contains the Use AGC for LMT/LPF Gain bit. As you can see, that bit appears to be off. We would expect that since we're trying to use MGC. Please let us know if that doesn't seem correct for our use case.

    # iio_reg ad9361-phy 0xfc
    0x23


    We've been setting LPF gain via register 0x10A (Rx1 Manual LPF Gain). Reading it back reflects the value we set it to. It also reflects the value obtained with the command "cat /sys/kernel/debug/iio/iio:device0/gaininfo_rx1".

    # iio_reg ad9361-phy 0x10a
    0x4

    The way we've determined that LPF Gain must not be working is that when we change that setting, there is no effect on signal level that we measure coming through the receiver.  There is no effect at all for any LPF gain settings we tried (we tried many settings from min to max gain).

    Does the section about the LMT and ADC overloads you've shown apply if we're using MGC instead of AGC? We had assumed it didn't.

    If you could please provide a complete example of using the split gain table (with MGC), that would be best.

    Thanks

    John

  • We will test and get back on this