What is the purpose of the Auto Filter checkbox in the AD936X tab in iio oscilloscope ?

The tip strip mentions "Load a pre-generated filter and optimize ADC/DAC sample rates". I guess it's using one of the four possible filter in set_bb_rate(), but I'm a bit surprised this checkbox is not checked by default when no custom filter has been created.

This is exactly what happens after I start a Simulink model calling the AD936X receiver block...the "filter FIR configuration" is set to 'none' and 'Auto Filter' is left unchecked.
In addition, the and checkboxes are not visible until I select a .ftr in the filter FIR Configuration...making it a bit confusing to understand what filter is actually in use.

Since I'm sampling at a rate < 2.083MSPS, RX FIR filter must be turned on and its decimation factor must be 4. Since I get data out of the device, I know filter is turned on, but the iio oscilloscope GUI doesn't seem to reflect this. Trying to fully understand what's going on to troubleshoot an AGC Fast Attack issue that seems to be related to an incorrect RX FIR Filter settings.

  • 0
    •  Analog Employees 
    on Nov 27, 2020 7:37 AM 3 months ago

    Hi Gerald,

    Auto filter function was introduced exactly as you said to support sampling rates < 4M. It was introduced with this commit: commit/0463f20eea

    If Auto Filter is enabled it will reach this line in IIO oscilloscope fmcomms2.c#L357 and actually all the "magic" is performed in ad9361_set_bb_rate function from libad9361-iio.

    The table with precomputed filters seected based on baseband rate can be seen here: ad9361_baseband_auto_rate.c

  • Thanks ! 
    It answers my question. The only point that remains a bit unclear is to know if this checkbox should appear as "checked" when a default filter has been loaded behind the scene by the filter design MATLAB function ?

    The screenshot I attach is what I see when I open iio oscilloscope after running a Simulink model calling the AD936X RX block. Reading registers back mentions a FIR 128,4 is in use and I was expecting the Auto Filter checkbox status to be  read from a register (or iio_attr) to reflect the actual status of the device.

    So that, when you look at the attached screenshot, the device seems to appear as NOT having a filter loaded AND NOT using the Auto Filter. This is where the confusion comes from.

    Same thing after I select a .ftr file AND the "Disable All" checkbox is checked...What are the filter setting in use when using this configuration ? (I still get data out of the device, so that decimating filters must be active !)

    Does my question make sense ? Is there somethinh obvious I have missed ?

    Thanks again !

  • +1
    •  Analog Employees 
    on Nov 30, 2020 7:08 PM 2 months ago in reply to Gerald

    There is no way for IIO-Scope to know the difference between the "Auto Filter" and a generic filter if an application like MATLAB is configuring the transceiver without IIO-Scope's knowledge. If you wanted to be sure you would have to read out the registers for the taps and compare them to those in the "Auto Filter". You are basically observing this state where a filter is loaded but IIO-Scope does not know the source since it didn't load it.

    If IIO-Scope reads back a clock rate less than 2.083 MS/s the part is using a filter. The driver prevents you from operating the part without one loaded at these rates.


  • Thanks for your message, 

    I'll read coefficients back to make sure.

    Since filter coefficients are indirectly addressable, I hoped I could avoid writing a routine to loop through the 128x2 (LSB-MSB) registers...

    The point I was trying to clarify is the need or not, to send a "trigger" to activate the filter. The reason why I thought it could be the case is mainly because I observed the iio scope re-initialized to "Disable All" when loading a .ftr, and user has to explicitly enable RX/TX FIR Filtering from the user interface.

  • Thinking about it twice after reading your reply, I'm wondering what could prevent iioscope to read-back filter coefficients registers, compare with the default coefficients and automatically check the 'Auto Filter' checkbox if the 2 sets are equal ?
    It would allow the user interface to provide a clear and unambiguous picture of the current situation, no ?
    Is there something I'm missing, here ?

  • Thinking about it twice after reading your reply, I'm wondering what could prevent iioscope to read-back filter coefficients registers, compare with the default coefficients and automatically check the 'Auto Filter' checkbox if the 2 sets are equal ?
    It would allow the user interface to provide a clear and unambiguous picture of the current situation, no ?
    Is there something I'm missing, here ?

  • 0
    •  Analog Employees 
    on Dec 1, 2020 8:06 PM 2 months ago in reply to Gerald

    I'm trying to understand the use case here. If you want to have a specific configuration you can perform the necessary actions from both MATLAB or IIO-Scope to put the part in that mode.

    Is the part not loading the expected configuration?


  • The use case is quite simple : one of our MATLAB/Simulink user is using our hardware support package and trying to use the fast attack AGC.

    Since the fast attack doesn't seem to work as expected using the default values, we had to dig into the lower level details, and that's were iio oscilloscope comes into the picture. It allows us to quickly check the register values and also interactively modify the configuration (load a filter, disable FIR filter, adjust AGC settings)

    For now, as you mention, I suspect the part not loading the expected configuration and I'm trying to make sure all parameters are as expected (FIR filter coefficients, FIR gain, TX/RX FIR Filter enable, ...)

    Our design requires a relatively low sample rate (<1MSPS) and as you mentioned earlier FIR Filter must be turned on. But when doing so, AGC Fast attack doesn't work as expected.

    We could get AGC to work after increasing the sample rate and disabling the RX FIR Filter...but this approach has negative side effects and cannot be used in production so that we need to figure out how to make fast attack work with Auto filter (or custom filter, if needed) when FIR Filter in ON and sample rate is below 2.083 MSPS

    The attached MAT file (needs to be renamed as .mat) can be used to illustrate the issue. (2 CW bursts of different amplitude)

    Sample rate has been set to 1.228800 MSPS and default filter is used. Center frequency is around 400 MHz. When playing this file on TX1A and looping back on RX1A, I cannot get the AGC fast attack to perform as expected when using the default settings (using the MATLAB HSP image). Creating a custom filter (.ftr) may help on my Zedboard + FMCOMMS but we observe a different behavior on an ADI-RF-SOM platform

    The following screenshots illustrates what I get on my Zedboard + FMCOMMS platform using the stimulus in the attached mat file :

    Manual Gain :

    Fast Attack - AutoFilter

    Fast Attack - Custom Filter

    Custom Filter seems to make the AGC fast attack to work as expected (all other parameters being equal)...but the ADI RF SOM doesn't seem to give results as good as those.

    I really would like to better understand relationship between RX FIR Filter and AGC behavior...from what I observe, there is obviously a difference when using AutoFilter or a custom filter created using the ADI Filter Wizard.

    Would be very interested to see if you can replicate this behavior ?

    Thanks again for all the insights, very appreciated !


  • 0
    •  Analog Employees 
    on Dec 1, 2020 9:14 PM 2 months ago in reply to Gerald

    I cannot really comment about how the HSP loads filter settings for its generic "Auto" filters since I cannot see the source. I know there was some weirdness in the past. I would recommend starting there and comparing the sequencing of calls if you have doubts about loading filters.

    Can you give me some detail about the differences between the RF-SOM and FMComms? Are you using the HSP for both? Are you using FMComms2 or 3?


  • A quick update about this issue...

    I received an RF SOM + BOB carrier board from our user and have been installing an ADI's image. (vs. MATLAB HSP provided image)

    I could get the fast AGC to work as expected in these conditions and we will be running additional tests to isolate the root cause of the problem. I'll run side by side comparisons (Zedboard vs. RF SOM) whenever possible to better understand differences we could observe on these 2 platforms. My plan is as follow :

    • Compare behaviors when using MATLAB HSP
    • Compare behaviors when running ADI's image

    For now, I'd like to thank you again for your support. We were not expecting to make such a deep dive into the AD9361 and your help is greatly appreciated.