Post Go back to editing

ADC data read from AD4111

Hi all,

I am facing the issue regarding ADC data read from the AD4111 device

Hardware setup:

  1. EVAL-AD4111/12SDZ Board
  2. PIC microcontroller
  3. The temperature sensor (4-20mA output) is connected to IIN0 and GND terminals of  EVAL-AD4111/12SDZ Board

Programming

  1. SPI mode 3
  2. SPI communication between EVAL-AD4111/12SDZ board and PIC micro is working
  3. I can read the device id (0x30DE)
  4. I can write and read the register values

AD4111 Configuration data used in the project

ADCMODE = 0x01 0x01 0x0C

IFMODE = 0x02 0x00 0x40

GPIOCON = 0x06 0x34 0x00

CH0[] = 0x10 0x91 0xE8

SETUPCON1 = 0x21 0x00 0x00

FILTCON0 = 0x28 0x0A 0x0A

GAIN0 = 0x38 0x00 0x00 0x00

I am not able to get the ADC data corresponding to the sensor input. The ADC data I am getting is around 0x6FDB38 for the entire input range 4mA to 20mA. Please check and let me know if I have missed any configurations.

I have shared the screenshots of device configuration write operation, device configuration read operation, Device id read operation and ADC data read operation for your reference

Thank you for your time

Amar

  • Hi, 

    Can you double check the register settings please. For example you displayed data for FILTCON0 and GAIN0 but you have used SETUPCON1. And one more thing, why is the GAIN0, all 0s? Did you write anything on this register, the default value must be 0x5XXXX0. Changing this will affect the gain error in your conversions. 

    Thanks,

    Jellenie

  • Hi JellenieR,

    Thanks for your reply,

    I have modified the register setting as per your suggestion, but am still not able to get the correct ADC values.

    ADCMODE = 0x01 0x01 0x0C

    IFMODE = 0x02 0x00 0x40

    GPIOCON = 0x06 0x34 0x00

    CH0 = 0x10 0x81 0xE8

    SETUPCON0 = 0x20 0x00 0x00

    FILTCON0 = 0x28 0x0A 0x0A

    I have attached the screenshots for your reference

    ADC data for 5mA current input

    ADC data for 8mA current input

    Thanks for your time

    Amar

  • Hi Amar, 

    I also noticed you have put a delay in the ADCMODE register, do you have external circuitry on this? Can you share your schematic please?

    Have you also followed the allowable common mode input range for current inputs? Looking at the output code, the equivalent current input is around 21mA. Is it possible for you to measure your actual input please with a current meter? This is just to ensure that the input are changing?

    Thanks,

    Jellenie

  • Hi Jellenie,

    Thanks for your replay,

    I also noticed you have put a delay in the ADCMODE register

    I have removed the delay but no change, the problem remains the same.

    do you have external circuitry on this?

    No

    Can you share your schematic please?

    please find the hardware setup block diagram for your reference

    Have you also followed the allowable common mode input range for current inputs?

    Yes, the sensor output is in the range of 4-20mA

    Looking at the output code, the equivalent current input is around 21mA.

    The ADC data shared in the previous reply was  5mA and 8mA respectively

    Is it possible for you to measure your actual input please with a current meter? This is just to ensure that the input are changing?

    I have measured the input current using  Fluke 117 multimeter, I checked with the input from 5mA to 12mA, but the output ADC value remains the same. please find the screenshots for your reference

    For Input 8mA

    For input 12mA

    please let me know if you need further information. 

    Thanks for your time

    Amar

  • Hi Amar,

    I was thinking if you can also measure the common mode voltage between IIN0+ to IIN0- (GND_ISO)?

    And can you also clarify the supply section? My understanding here is that you supply the EVAL-AD4111/12 using J7 (LK3 is A)?

    Regarding the scope shot, it is interesting that you are reading the data register when the RDY bit of the status is low. Please take note that when RDY bit is high it means that it is still awaiting new data conversion results. So you need to wait for RDY to go low before attempting to read data conversion. 

    Thanks,

    Jellenie

  • Hi Jellenie,

    Thanks for your reply,

    I was thinking if you can also measure the common mode voltage between IIN0+ to IIN0- (GND_ISO)?

    AD4111 register Configuration to measure common-mode voltage between IIN0+ to IIN0- (GND_ISO)

    ADCMODE = 0x01 0x00 0x0C

    IFMODE = 0x02 0x00 0x40

    GPIOCON = 0x06 0x00 0x00

    CH0 = 0x10 0x80 0x10

    SETUPCON1 = 0x20 0x03 0x00

    FILTCON0 = 0x28 0x0A 0x0A

    My observations are as follows

    1. When I am writing and reading to configuration registers in an infinite loop and reading the STATUS REGISTER
    • The RDY bit of STATUS REGISTER remains high for all the read operation
    • ADC data (0x8FD113) will remain the same for 0v to 8v input range

    Screenshots:

    Code:

    void main() 
    {
           Sys_config();
           Delay_1ms();
           Delay_1ms();
           Delay_1ms();
           Delay_1ms();
           Delay_1ms();
           Write_Reg();//Write to REGISTER
           
    while(1)
    { 
        
        while(cnt == 0x64) // Read/write the registers for every 100 count 
        {
            Write_Reg();//Write to REGISTER
            Delay_1ms();//1 ms delay
            Read_Id();   //Read device ID 
            Read_Reg();//Read the REGISTER valus
            cnt = 0;
        }
       
        cnt++;
       
        Delay_1ms();//1 ms delay
        Delay_1ms();//1 ms delay
        
        Read_StReg();//Read the STATUS REGISTER
        Data_Ready = (Staus_Reg_Data & 0XFF);
        if(!Data_Ready)// RDY = 0, ADC_ERROR = 0 , CRC_ERROR = 0, REG_ERROR = 0 and channel selected is CH0 = 0000h
        {
            
         Read_ADC_Data();//Read ADC Data
       
        }
        
        Read_StReg()
    {
        CS_SetLow();// Chip Select to LOW
        SPI1CON0bits.EN = 1;//Enable SPI
        SPIExchangeBlock(RdStReg,sizeof(RdStReg));//Data exchange
        SPI1CON0bits.EN = 0;//Disable SPI
        CS_SetHigh();// Chip Select to High
        Staus_Reg_Data = readDataStr[1];//Copy Status flag data
        
    }
    
    Read_ADC_Data()
    {
        CS_SetLow();// Chip Select to LOW
        SPI1CON0bits.EN = 1;//Enable SPI
        SPIExchangeBlock(RdDATA,sizeof(RdDATA));//Data exchange
        SPI1CON0bits.EN = 0;//Disable SPI
        CS_SetHigh();// Chip Select to High
    }
    

     

    2. When I am writing the configuration registers before the infinite loop, reading the REGISTERS and STATUS REGISTER

    • STATUS REGISTER will be 00H for all the read operations (RDY bit is Low)
    • The configuration REGISTERS values read from the ADC are different from what we have written

    ADC Data for 0v to 8v input

    Sl No

    IIN0+ to IIN0- (GND_ISO) Voltage

    ADC Value

    1

    0

    0x705056

    2

    1

    0x743D57

    3

    2

    0x77F24A

    4

    3

    0x7BFFDF

    5

    4

    0x7FE3F1

    6

    5

    0x83EA2B

    7

    6

    0x87CE5D

    8

    7

    0x8BCC9F

    9

    8

    0x8FE5A6

    Screenshots:

    2V input

    8V input

    Code:

    void main() 
    {
          Sys_config();
           Delay_1ms();
           Delay_1ms();
           Delay_1ms();
           Delay_1ms();
           Delay_1ms();
           
           Write_Reg();//Write to REGISTER
           
    while(1)
    { 
        
        while(cnt == 0x64) // Read the registers for every 100 count 
        {
            Read_Id(); //Read Device ID
            Read_Reg();// Read the registers 
            cnt = 0;
        }
       
        cnt++;
       
        Delay_1ms();//1 ms delay
        Delay_1ms();//1 ms delay
        
        Read_StReg();//Read the STATUS REGISTER
        Data_Ready = (Staus_Reg_Data & 0XFF);
        if(!Data_Ready)// RDY = 0, ADC_ERROR = 0 , CRC_ERROR = 0, REG_ERROR = 0 and channel selected is CH0 = 0000h
        {
            
         Read_ADC_Data();//Read ADC Data
       
        }
    
    

    And can you also clarify the supply section? My understanding here is that you supply the EVAL-AD4111/12 using J7 (LK3 is A)?

    Yes, for supply I am using J7(LK3 is in A position)

    Regarding the scope shot, it is interesting that you are reading the data register when the RDY bit of the status is low. Please take note that when RDY bit is high it means that it is still awaiting new data conversion results. So you need to wait for RDY to go low before attempting to read data conversion. 

    I have tried to get the ADC value with following register configuration

    AD4111 register Configuration as below

    ADCMODE = 0x01 0x00 0x0C

    IFMODE = 0x02 0x00 0x00

    GPIOCON = 0x06 0x00 0x00

    CH0 = 0x10 0x81 0xE8

    SETUPCON1 = 0x20 0x00 0x00

    FILTCON0 = 0x28 0x0A 0x0A

    My observations as follows

    1. When I am writing and reading to configuration registers in an infinite loop and reading the STATUS REGISTER
    • The RDY bit of STATUS REGISTER remains high for all the read operation

     

    Screenshots:

    Code:

    Code:
    while(1)
    {   
        while(cnt >= 0xff)
        {            
            Read_Reg();
            cnt = 0;
        }
        cnt++;  
        Delay_1ms();//1 ms delay
        Write_Reg();//Write to REGISTER
        Delay_1ms();//1 ms delay  
        Read_StReg();//Read the STATUS REGISTER
        Data_Ready = (Staus_Reg_Data & 0XFF);
        if(!Data_Ready)// RDY = 0, ADC_ERROR = 0 , CRC_ERROR = 0, REG_ERROR = 0 and channel selected is CH0 = 0000h
        { 
         	Read_ADC_Data();
        }
    
    Read_StReg()
    {
        CS_SetLow();// Chip Select to LOW
        SPI1CON0bits.EN = 1; //Enable SPI
        SPIExchangeBlock(RdStReg,sizeof(RdStReg));//Data exchange
        SPI1CON0bits.EN = 0;// Disable SPI
        CS_SetHigh();//Chip Select to High
        Staus_Reg_Data = readDataStr[1];//Copy the Status Register data
        
    }
    
    Read_ADC_Data()
    {
        CS_SetLow();// Chip Select to LOW
        SPI1CON0bits.EN = 1;//Enable SPI
        SPIExchangeBlock(RdDATA,sizeof(RdDATA));//Data exchange
        SPI1CON0bits.EN = 0;//Disable SPI
        CS_SetHigh();// Chip Select to High
    }
    

    2. When I am writing the configuration registers before the infinite loop, reading the REGISTERS and STATUS REGISTER

    • STATUS REGISTER will be 00H for all the read operations (RDY bit is Low)
    • The REGISTERS values read from the ADC are different from what we have written

     

    Screenshots:

    Code: 

    void main() 
    {
        
           Sys_config();
           Delay_1ms();
           Delay_1ms();
           Delay_1ms();
           Delay_1ms();
           Delay_1ms();
           
           Write_Reg();//Write to REGISTER
           
    while(1)
    { 
        
        while(cnt == 0x64) // Read the registers for every 100 count 
        {
                 
            Read_Reg();
            cnt = 0;
        }
       
        cnt++;
       
        Delay_1ms();//1 ms delay
        Delay_1ms();//1 ms delay
        
        Read_StReg();//Read the STATUS REGISTER
        Data_Ready = (Staus_Reg_Data & 0XFF);
        if(!Data_Ready)// RDY = 0, ADC_ERROR = 0 , CRC_ERROR = 0, REG_ERROR = 0 and channel selected is CH0 = 0000h
        {
            
         Read_ADC_Data();
       
        }
    

    My Questions:

    1. The REGISTER write operation can be called in any part of the program? Is it affects the data conversion operation?
    2. If you have any specific steps or flow related to write/read operations coding, pls let me know
    3. let me know the calibration steps

    Thanks for your time

    Amar

  • Hi Jellenie,

    I haven't get any response.

    Regards

    Amar

  • Hi Amar, 

    Apologies as I have missed this query. 

    Regarding your questions, 

    We have suggested configuration flow provided in page 23 of the datasheet. We also have example code that you can use as a reference. Please see links below. 

    AD717X No-OS Software Drivers [Analog Devices Wiki]

    AD717x/AD411x Mbed Example [Analog Devices Wiki]

    In terms of calibration, page 38 of the AD4111 (Rev. B) Datasheet also detailed the different calibration modes and procedure. I think the Mbed example code have a calibration demo feature that you can check. 

    Thanks,

    Jellenie