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.

CCS/ADS1220: How to use ADS1220 to read temperature ?

Part Number: ADS1220
Other Parts Discussed in Thread: MSP430F2132, , TIDA-00018, MSP-TS430PW28,

Tool/software: Code Composer Studio

Hi everyone, 

I want to know how to use ADS1220 with MSP430F2132 to read temperature. 

I use the example code TIDA-00018 and i try to write into ADS register and Read back. 

And i can't see my register datas. 

Here you have my code.

Thank for your help,

Anaelle  

MSP_ADC.zip

  • Hi Anaelle,

    Welcome to the forum! I don't see anything in the code that stands out to me as being an issue except you should make sure the delay is long enough between reset and communication.  This is discussed in section 8.5.3.1 in the ADS1220 datasheet.  So I would add some delay between ADS1220_Reset and the register configuration write.

    A good troubleshooting practice is to verify your communication with respect to CS, SCLK, DIN and DOUT to the ADS1220 with an oscilloscope or logic analyzer.  This will help in making sure your functions are working as desired and that the peripherals have been setup properly.  Unfortunately I can't help with code verification for your peripherals without your schematic.

    Best regards,

    Bob B

  • Thank Bob to reply me,

    For this project, I use ADS1220EVM for the ADS1220 module and the MSP-TS430PW28 for the MSP430F2132. I connect the UCB0SPI to ADS1220.

    Your right , my code work. I was not looking at the right place..

    However,  after check my write/read register, i want to measure my internal temperature sensor.

    I use the DRDY pin in interrupt mode to indicate availability of new conversion data. But I receive nothing from him.

    Let see my code.

    Regards,

    Anaelle

    0005.MSP_ADC.zip

  • Hi Anaelle,

    Have you probed your communication with an oscilloscope/logic analyzer to verify you are communicating properly? You should also be able to probe the DRDY signal and verify that the DRDY signal is active after sending the START command.  Have you done that or are you relying on just your code/debugger?  I'm very curious to know how you have determined DRDY is not working based on the while loop in your code.  Once you set ReadConversionData high, you never set it low again and it will ignore any further interrupt trigger.

    Best regards,

    Bob B

  • Thank Bob for your reply, 

    I have a problem of spi configuration.

    Looking at the data sheet I saw an inconsistency between the SPI configurations.

    For example, page 34 : 

    We recommend that you configure our spi in CPOL = 0, CPHA = 1 mod, whereas when looking at the signal timing further on page 37, the configuration should be CPOL = 0, CPHA = 0.

    After modifying this my adc worked perfectly.

    Best regards, 

    Anaelle

  • Hi Anaelle,

    Thanks for the update.  Just to clarify regarding the SPI interface, the original standard established by Motorola set up a series of clock polarities and phases where the data are changed or latched.  Using this standard notation, the mode used by the ADS1220 is mode 1 where the clock dwells low, and changes on the rising edge of SCLK and holds on the falling edge.   By this convention CPOL = 0, CPHA = 1.

    However, the MSP430 SPI peripheral uses a different method and the phase is actually the opposite from the original definition.  So when using MSP430 devices you have to be very careful that you are actually following the correct phase.  The MSP430 terminology is CKPL and CKPH.  CKPH is opposite of the description used in the original Motorola definition.  As far as I know, the MSP430 is the only micro peripheral that uses the inverted phase definition.

    Best regards,

    Bob B

  • Hi Bob,

    I understand more now :) 

    I have anothers question, i want to calcul this :

    Mesure = |Vsens (AIN1 – AIN2)| / Vref (AIN0-AIN3)

    How to recover the result of AIN0-AIN3 and AIN1-AIN2 ?

    I proceed like this and when i watch my VOUT data , the value changes every time and I do not get my 2V

    int  MSB;
    int  data;
    int  LSB;
    volatile unsigned char ReadConversionData = 0;
    unsigned int lpm_bits;
    static volatile unsigned char tempData[3];
    volatile long ADS1220code;
    long int bit24,bit32;
    float VOUT;
    
    void main (void)
    {
        WDTCTL = WDTPW | WDTHOLD;   // Stop watchdog timer
        __disable_interrupt ();
        config_clock ();
        portsInit ();
       // Configure the SPI components
        Setup_SPI_Master ();
       __enable_interrupt();
        // Reset the ADS1220
       ADS1220_Reset();
       __delay_cycles(CPU_CLK);
       while (1)
        {
             // Configure ADS1220 for tension reference
             Setup_ADS1220 (ADS1220_MUX_AIN0_AIN3, ADS1220_GAIN_1, ADS1220_USE_PGA,
                            ADS1220_DATA_RATE_600SPS,ADS1220_OP_MODE_NORMAL,ADS1220_CONVERSION_SINGLE_SHOT, ADS1220_TEMP_SENSOR_OFF, ADS1220_BURN_OUT_CURRENT_OFF,
                            ADS1220_FIR_NONE, ADS1220_VREF_INTERNAL, ADS1220_LOW_SIDE_POWER_CLOSE , ADS1220_IDAC_CURRENT_OFF,
                            ADS1220_IDAC1_DISABLED, ADS1220_IDAC2_DISABLED, ADS1220_DRDY_ON_DRDY_ONLY);
             __delay_cycles(CPU_CLK/10);
                    ReadConversionData = 0;
                    ADS1220_Start ();      
                    while (!ReadConversionData);   // Wait for Data Ready interrupt
                    ADS1220_Get_Conversion_Data((unsigned char *)tempData);
                    MSB=tempData[0];
                    data=tempData[1];
                    LSB=tempData[2];
                    bit24=MSB;         // Converting 3 bytes to a 24 bit int
                    bit24=(bit24<<8)|data;
                    bit24=(bit24<<8)|LSB;
                    bit24=(bit24<<8);
                    bit32=(bit24>>8);    // Converting 24 bit two's complement to 32 bit two's complement
    		VOUT=bit32;
                    LED_POUT |= LED_GREEN_BIT;
        }
    }

    Thank for your help, 

    Anaelle

  • Hi Anaelle,

    I'm not sure what you are intending to measure.  From your drawing and code you are attempting to measure AIN0 and AIN3 only.  As this is a single-ended input (referenced to AVSS) you need to disable and bypass the PGA.  This should help get a more stable reading.  However, there will be noise associated with the measurement and possibly noise in your voltage source.  The value returned will be the number of codes relative to the reference, and you are using the internal reference of 2.048V.  The calculation is shown on page 35 of the datasheet in section 8.5.2.

    Regarding the noise, you could easily see 1000 codes or more of variation from the converter alone.  See tables 3 and 4 on page 17 of the datasheet.

    Right now your code is repeatedly writing the same information to the ADS1220 registers, starting a conversion and reading the results.  You will need to change the mux to read another set of inputs, restart the conversion and then read the new results. 

    Best regards,

    Bob B