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.

ADS124S08: Data read from ADS124s08 using mspm0g3507

Part Number: ADS124S08
Other Parts Discussed in Thread: MSPM0G3507,

Hi 

I am reading data from ads124s08 adc using mspm0g3507 . but value i am getting is not as expected. i have checked with dso and all waveforms are correct as per data sheet. i am attaching waveform file and also code let me know where i am doing wrong.

int main(void)
{
    SYSCFG_DL_init();    // init all gpio and spi with spi mode 1

    delay_cycles(70400);  //wait for POST operation

    delay_cycles(32000);  //required min 20ns we provide 1ms delay

    delay_cycles(160000);        // delay of min of 4096*tclk

    readRegs( ID_ADDR_MASK,19,Data); //reading default setting

    ADS124S08_Init();   // configuring adc

    readRegs_after( ID_ADDR_MASK,19,Data); //readbck new configuration

    DL_GPIO_setPins(GPIO_LEDS_START_PORT,GPIO_LEDS_START_PIN);  // pull start pin high to start convertion
    delay_cycles(224000);

    while(1)
    {
        if (!DL_GPIO_readPins(GPIO_LEDS_DRDY_ADC_PORT, GPIO_LEDS_DRDY_ADC_PIN))  // check of low transition of DRDY pin
        {
                DL_SPI_transmitData8(SPI_0_INST,RDATA_OPCODE_MASK);
                delay_cycles(32000);
                iData.adcValue1 = dataRead(&dStatus, &dData, &dCRC);
         }
       RTDRes = CodeToRes(&iData);
       RTDTemp = calculateTemperature(RTDRes);
    }
}

data read 100

uint32_t dataRead(uint32_t *dStatus, uint32_t *dData, uint32_t *dCRC)
{
    uint32_t xcrc;
    uint32_t xstatus;
    uint32_t iData;
    uint32_t Data_t;
    DL_GPIO_clearPins(GPIO_LEDS_CS0_PORT,GPIO_LEDS_CS0_PIN);

    if((registers_after[SYS_ADDR_MASK] & 0x01) == DATA_MODE_STATUS)
    {
        xstatus = xferWord(0x00);
        dStatus[0] = (uint8_t)xstatus;
    }

    // get the conversion data
    iData = xferWord(0x00);
    iData = (iData<<8) + xferWord(0x00);
    iData = (iData<<8) + xferWord(0x00);
    if((registers_after[SYS_ADDR_MASK] & 0x02) == DATA_MODE_CRC)
    {
        xcrc = xferWord(0x00);
        dCRC[0] = (uint8_t)xcrc;
    }
    DL_GPIO_setPins(GPIO_LEDS_CS0_PORT,GPIO_LEDS_CS0_PIN);
    Data_t = iData;
    return iData ;
}

transfer function:

uint32_t xferWord(uint32_t tx)
{
    uint32_t rx;
    /* Set up data for the next xmit */
    DL_SPI_transmitData32(SPI_0_INST,tx);
    /* Wait for data to appear */
   while(DL_SPI_isBusy(SPI_0_INST));
    rx= DL_SPI_receiveDataBlocking32(SPI_0_INST);
  //  rx= DL_SPI_receiveDataBlocking32(SPI_0_INST);
 //   rx= DL_SPI_receiveData32(SPI_0_INST);
    return rx;
}

Waveform:

  • Hi Mehul Dabholkar,

    It is not clear what your code shows relative to the scope shot.  So the expectation is better understood by you but you have not shared it.  Also, it would appear to be that you are making an RTD temperature sensor measurement.  One thing I can tell you is when you are reading the ADC data the output is binary 2's complement.  The value being transmitted by the ADC is negative, so there are two issues.  One is the iData variable is unsigned integer and the data returned is signed.  So you need to make sure that you are using the correct declarations and properly sign-extending the value from 24-bit to 32-bit.

    Second issue is the ADC value is negative.  If you are expecting positive values, then there is something incorrect in your configuration register settings.

    For me to be of more guidance I would need to know the configuration register settings you are using as well as seeing the schematic.

    Best regards,

    Bob B

  • Hi bob , issue has been resolved issue was with config register setting.