This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • TI Thinks Resolved

ADS1256: Not able to read and write the values to the configuration registers.

Prodigy 90 points

Replies: 15

Views: 1969

Part Number: ADS1256

hi.

I have ADS 1256 development board and trying to interface with STM32F446ZE using STM cube and SW4 (Eclipse based workspace). 

sometimes i'm able to read the default values from the configuration registers only when i write specific data to the any of the register. I meant after the write command is sent. if i write the data (with LSB bit 1 in it) then i will get the default register value in response to the read command.   if i write the data (with LSB bit 0 in it) then i will get the register value as 0x00 in response to the read command.  

Also i'm not able to write the registers with any values. Here i have attached the SPI communication details captured with logic analyzer.

6201.SPI.zip

Thanks,

Harsha 

  • In reply to Harsha B S:

    Hi Harsha,

    The large decimal values you are reading are actually negative numbers. For example "16772508" (decimal) is "FFED9C" (hex), which actually represents "-4708" when you sign-extend the 24-bit ADC code. When I convert your decimal codes into resistance values I get the following results...

    Overall, the results seem okay with perhaps some offset voltages affecting the shorted-input case...

    How do you have the OFC[2:0] registers configured when measuring the shorted-inputs? Make sure you that you either reset them to their default values, or else make sure the calibration coefficients are correct for those channels (for example, if you correct for a large offset on another channel and don't reprogram these registers for this channel you would get a large offset error).

    For reference, when I measure the short-circuited inputs on the ADS1256EVM-PDK, I get  results of about -270 Ohms @ 0.5 uA, -95 Ohms @ 2 uA, and -20 Ohms @ 10 uA.

    The error with the open-circuit case @ 10 uA is likely due to the input voltage clamping, otherwise 10 uA * 1.2 MOhm would be 12V. I still think with the inputs open there might be a leakage path for the current (with an approximate resistance of 1.2 MOhm). Are their any other components (other than the RC filters) on the ADC inputs that might account for this?

    Best regards,
    Chris

    Best regards,
    Chris Hall
    Applications Engineer | Precision ADCs


    Check out these helpful resources...
    TI Precision Data Converters | TI Precision Labs - ADCs | Analog Engineer's Calculator | Data Converters Learning Center | Selection Guide

     

  • In reply to Christopher Hall:

    Hi Christopher,

    Thank you for your reply.

    Yes. I wasn't considering that the ADC output is in 2's compliment form. Now i rectified this conversion process. It would be more helpful for me if you provide an efficient conversion code patch which i can implement to convert ADC bytes into voltage/integer value. 

    I have checked the schematics of the ADC development board and found that only RC circuit is connected to the inputs. (1 K ohm & 0.1uF)

    Newer measurement values are tabulated below.

    0.5uA SDCS

    2uA SDCS

    10uA SDCS

    ADC Value

    Voltage

    ADC Value

    Voltage

    ADC Value

    Voltage

    Open Circuit

    4892259

    2916mV

    6125239

    3650.9242mV

    7058076

    4206.93mV

    Short Circuit

    -4704

    -2.803V

    -1562

    -0.9310mV

    15339

    +9.142mV

    Shorted with 33k Resistor

    34262

    +20.42mV

    147885

    +88.1462mV

    756079

    +450.658mV

    These are the calibration coefficients.  I do perform self calibration after every reset. These values remains almost same (1 or 2 decimal changes)

    OFC0 : 160 Decimal

    OFC1: 253 Decimal

    OFC2: 255 Decimal

    FSC0: 025 Decimal

    FSC1: 167 Decimal

    FSC2: 073 Decimal

    "if you correct for a large offset on another channel and don't reprogram these registers for this channel you would get a large offset error"

    I did not understand what you had mentioned. Please explain this . Do we need to perform calibration for every channel? 

    Thanks&Regards,

    Harsha B S

  • In reply to Harsha B S:

    Hi Harsha,

    Harsha B S
    It would be more helpful for me if you provide an efficient conversion code patch which i can implement to convert ADC bytes into voltage/integer value. 

    I wrote a blog with some example code explaining how to the sign-extension in C. You can find it here: https://e2e.ti.com/blogs_/archives/b/precisionhub/archive/2016/04/01/it-s-in-the-math-how-to-convert-adc-code-to-a-voltage-part-1

    Since then, I still use this same method but I prefer to write the code more like the example below, as I believe this is a bit cleaner and less prone to errors...

    // Copyright (c) 2018 Texas Instruments Incorporated
    
    // Example read data function
    int32_t readData()
    {
    	uint8_t ADC_data[3];
    
    	// INSERT SPI COMMUNICATION HERE
    	// Collect data in ADC_data array
    	// where ADC_data[0] holds the MSB
    	// and ADC_data[2] holds the LSB
    
    	/* Return the 32-bit sign-extended conversion result */
    	int32_t signByte;
    	if (ADC_data[0] & 0x80u)	{ signByte = 0xFF000000; }
    	else						{ signByte = 0x00000000; }
    
    	int32_t upperByte	= ((int32_t) ADC_data[0] & 0xFF) << 16;
    	int32_t middleByte	= ((int32_t) ADC_data[1] & 0xFF) << 8;
    	int32_t lowerByte	= ((int32_t) ADC_data[2] & 0xFF) << 0;
    
    	return (signByte | upperByte | middleByte | lowerByte);
    }

    NOTE: This code snippet is taken out of the example code found at http://www.ti.com/product/ADS1261/toolssoftware

    Harsha B S
    I have checked the schematics of the ADC development board and found that only RC circuit is connected to the inputs. (1 K ohm & 0.1uF)

    OK. I don't think it is too big of an issue that your open circuit impedance is only 1.2 MOhms, especially since I only measure 5 MOhms on the EVM. However, if you want to be sure, you might try removing the capacitors and cleaning the PCB to double check that there isn't a parasitic leakage path.

    Harsha B S

    "if you correct for a large offset on another channel and don't reprogram these registers for this channel you would get a large offset error"

    I did not understand what you had mentioned. Please explain this . Do we need to perform calibration for every channel? 

    For best performance, yes, you would want to perform system calibration on every channel. Every channel is likely to have a unique offset and gain error, especially when you consider external effects from signal conditioning or filtering.

    However, if you are only performing self-calibration, then this probably not necessary. Self-calibration removes the majority of ADC errors (and only ADC errors), and so the calibration coefficients will likely be very similar for each channel.

    Best regards,
    Chris

    Best regards,
    Chris Hall
    Applications Engineer | Precision ADCs


    Check out these helpful resources...
    TI Precision Data Converters | TI Precision Labs - ADCs | Analog Engineer's Calculator | Data Converters Learning Center | Selection Guide

     

  • In reply to Christopher Hall:

    hi Christopher,

    Thanks for your reply.

    May i know how exactly offset and full scale register values affect the ADC reading value? 

    could please explain with an example ? or could you guide me where i can get these details ?

    For example, If the input voltage is 10mV and based on these register values how the ADC reading will be changing.

    Thanks & Regards,

    Harsha B S

  • In reply to Harsha B S:

    Hi Harsha,

    Check out the ADS1255-7 Design Calculator found on the "Tools & Software" tab on the ADS1256 product page and see if that helps. There is a "Calibration" tab that that show how to convert the OFC[2:0] and FSC[2:0] register values to "V" and "V/V" units.

    Best regards,
    Chris

    Best regards,
    Chris Hall
    Applications Engineer | Precision ADCs


    Check out these helpful resources...
    TI Precision Data Converters | TI Precision Labs - ADCs | Analog Engineer's Calculator | Data Converters Learning Center | Selection Guide

     

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.