Post Go back to editing

ad7193 device tree with raspberry pi confiuration

Hey Guys,

So i have established communication with ad7193 using raspberry pi and device tree.This is my device tree parting fragment and options available in the ad7193

So I'm not sure how or where to configure or change gain in the options available or should i add in the device tree fragment to activate it and the bits assigned for the parameters as in adi,clock-source-select = /bits/ 8 <2> not sure what bits to assign for other parameters. So can someone tell me how to move forward with this issue?. Thanks in advance.


  • For general stuff about drivers you can check our wiki.

    Particularly for this one, you can look at AD7192 IIO High Precision ADC Linux Driver [Analog Devices Wiki] 

  • Hi,

    Cool i will look at that , I'm mainly unsure about how to configure or change gain parameters. There is no info given about that there. Can we change gain according to our requirement? Do i need to add that in the device tree and recompile the image?



  • I think that if you write to the in_voltage_scale file of the device [using the echo command], it should modify the gain.

    And the in_voltage_scale_available contains the available gain values.

    So, if you do cat in_voltage_scale_available you should get available gain parameters.

  • Hi,

    Thanks I'm able to change the values in in_voltage_scale as you mentioned but i'm unable to relate the decimal values represented  to the actual gain values which are 1,2,4,8,16,32,64 and 128 but the values there are as follows 0.000393390 0.000196690 0.000098340 0.000049170 0.000024580 0.000012290 0.000006140 0.000003070. How is the calculation done exactly ? ,and is there any documentation that can help me understand which parameters are related to which channels in the driver.



  • In the AD7192 driver, this is where it gets computed at driver init: linux/ad7192.c at master · analogdevicesinc/linux · GitHub 

    And you can search for scale_avail

    The in_voltage_scale contains the values that are multiplied to the raw voltage values that are measured.

    Each scale value should correspond to a gain value.

    Value 0.000393390   should use Gain 1,   0.000196690  Gain 2 and so on.

    Technically, you don't control directly which gain is selected.

    Instead, each multiplier [or scale] value which is selected, will also select the appropriate gain value.

    This looks like it was done like this, because this is how the kernel IIO framework is designed.

  • Hello,

    Thanks for the input. I was also hoping you could enlighten me whether these parameters   such as rejection filter, burnout-current , unipolar and bipolar etc.. which are being written on the device tree at start, can they be modified or changed at run time by enabling and disabling them because while i was trying this out with ADC-EVAL software i was able to change the parameters by writing into the register. So is it possible to configure them at run time or we have to build an image every time to change the parameters? If yes, how to implement it ?



  • Hi Alex,

    I have a doubt regarding the reading of differential channels. The  following channels in_voltage3-voltage4_raw(AIN3-AIN4),in_voltage5-voltage6_raw(AIN5-AIN6),in_voltage7-voltage8_raw(AIN7-AIN8) how to configure them as differential to read data from them?. I'm able to read data from channel 1-2 combo assuming that it has been activated by default along with all single ended channels. How to read from the above mentioned and how to enable them? Thanks in advance.


  • This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

    Thank you,
    EZ Admin