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: Unable to read internal temperature sensor

Part Number: ADS124S08


Hi,

Following the thread:

e2e.ti.com/.../2653786

With the schematic:

e2e.ti.com/.../RTD2W3Wx4.JPG

Trying to read the temperature off the internal diodes in the ADS124S08, at a loss what to do next, unable to read valid data.

What I am doing:

* Pull down RESET

* Release RESET

At this point, I can read the register contents, they match the default register values defined in the datasheet.

* Wait for RDY bit

* CLear FL_POR

* Enable the Temperature sensor (Reg 0x09)

* Enable PGA (Reg 0x03)

* Limit PGA gain to 4 (Reg 0x03)

* Send START OPCODE

* Set START Pin High

* Check DRDY

* Send RDATA OPCODE

* Read Data out

I get blank data at this point.

I can confirm the same data on the SPI bus (SCLK and MISO lines). Do I need to do anything more setup, to get valid data from the temperature sensor ?

Have gone through the datasheet, looking for specific setup for the temperature sensor. I couldn't find any.

Can someone please tell me what I am doing wrong ?

Code, reading the sensor:

void ads124xxx_reset(void)
{
	printf("* %s: ADC Reset\r", __func__);
	__ADC_RST_ENA();
	delay(5);
	__ADC_RST_REL();
	delay(5);
}

void ads124xxx_dump_regs(SPI_TypeDef *SPIx)
{
	uint16_t i, dat;

	printf(" ----------------- \r");
	printf(" Register Map\r");
	printf(" ----------------- \r");
	for (i = 0; i < 0x12; i++) {
		dat = ads124xxx_spi_regrd(SPI1, i);		/* Read register */
		printf(" Reg %02xh: %02xh\r", i, dat);
	}
	printf(" ----------------- \r");
}

void ads124xxx_init(SPI_TypeDef *SPIx)
{
	uint8_t tmp;

	printf("* %s: Initializing\r", __func__);
	while (ads124xxx_spi_regrd(SPI1, 0x01) & 0x40);		/* wait for RDY */

	tmp = ads124xxx_spi_regrd(SPI1, 0x01);
	ads124xxx_spi_regwr(SPI1, 0x01, (tmp & ~(1 << 6)));	/* clear FL_POR */

	/* Write all relevant ADC configuration here */
	/* Read back configuration and verify */
}


/**
 * Measure internal die temperature
 */
void ads124xxx_temp_sense(SPI_TypeDef *SPIx)
{
	uint8_t tmp;

	/**
	 * When measuring the internal temperature sensor,
	 * the analog inputs are disconnected from the ADC and the
	 * output voltage of the temperature sensor is routed
	 * to the ADC for measurement using the selected PGA gain,
	 * data rate, and voltage reference. If enabled, PGA gain
	 * must be limited to 4 for the temperature sensor measurement
	 * to remain within the allowed absolute input voltage range
	 * of the PGA.
	 */
	tmp = ads124xxx_spi_regrd(SPI1, 0x09);
	tmp |= (0x02 << 5);					/* Temperature sensor enabled */
	ads124xxx_spi_regwr(SPI1, 0x09, tmp);

	tmp = ads124xxx_spi_regrd(SPI1, 0x03);
	tmp |= (0x01 << 3);					/* PGA enabled */
	tmp |= 0x02;						/* limit PGA gain to 4 */
	ads124xxx_spi_regwr(SPI1, 0x03, tmp);

	ads124xxx_spi_cmd(SPI1, START_OPCODE_MASK);		/* START(0x08) conversion */
	GPIO_SetBits(GPIOC, GPIO_Pin_10);			/* START Pin enable */
	printf("* %s: ADC set to continuous conversion\r", __func__);
}

int main (void)
{
	SysTick_Config(SystemCoreClock / 1000);			/* SysTick event @1ms */
	gpio_setup();
	USART1_Init();						/* for IO redirection */
	spi_setup();

	printf("\r -----------------\r");
	printf(  " ADS124xxx Test\r");
	printf(  " -----------------\r");

	ads124xxx_reset();					/* RESET ADC */
	ads124xxx_dump_regs(SPI1);
	ads124xxx_init(SPI1);					/* START conversion */
	ads124xxx_temp_sense(SPI1);

	while (1) {
		GPIOB->ODR ^= GPIO_Pin_6;			/* Toggle LED */
		delay(500);
		ads124xxx_spi_datrd(SPI1);
	}
}

Thanks,

Manu

  • An error:  Incorrect link in the post,

    The updated schematic link is here. The referred one in the post is an older revision. Here's the final one:

    e2e.ti.com/.../R2.pdf

  • Hi Manu,

    You must have a valid reference voltage to make the conversion result.  It appears that you are using the default settings for the Reference Control register (0x05).  The default setting is to use the REF0 input pair which you have as unconnected in your schematic.  On page 78 of the ADS124S08 datasheet the configuration bits are shown for the reference.  The default setting is 0x10.  Try turning on and using the internal reference by writing the register contents as 0x1A.

    Best regards,

    Bob B

  • Hi Bob,

    You were spot on. Enabling the reference did the trick. Regarding the default setting is to REF0, I will try to keep in my head. Thanks!

    With the change,

    /**
     * Measure internal die temperature
     */
    void ads124xxx_temp_sense(SPI_TypeDef *SPIx)
    {
    	uint8_t tmp;
    
    	/**
    	 * You must have a valid reference voltage to make the conversion result.
    	 * e2e.ti.com/.../3090752
    	 * Try turning on and using the internal reference by writing 0x1A.
    	 */
    	ads124xxx_spi_regwr(SPI1, 0x05, 0x1a);
    
    	/**
    	 * When measuring the internal temperature sensor,
    	 * the analog inputs are disconnected from the ADC and the
    	 * output voltage of the temperature sensor is routed
    	 * to the ADC for measurement using the selected PGA gain,
    	 * data rate, and voltage reference. If enabled, PGA gain
    	 * must be limited to 4 for the temperature sensor measurement
    	 * to remain within the allowed absolute input voltage range
    	 * of the PGA.
    	 */
    	tmp = ads124xxx_spi_regrd(SPI1, 0x09);
    	tmp |= (0x02 << 5);					/* Temperature sensor enabled */
    	ads124xxx_spi_regwr(SPI1, 0x09, tmp);
    
    	tmp = ads124xxx_spi_regrd(SPI1, 0x03);
    	tmp |= (0x01 << 3);					/* PGA enabled */
    	tmp |= 0x02;						/* limit PGA gain to 4 */
    	ads124xxx_spi_regwr(SPI1, 0x03, tmp);
    
    	ads124xxx_spi_cmd(SPI1, START_OPCODE_MASK);		/* START(0x08) conversion */
    	GPIO_SetBits(GPIOC, GPIO_Pin_10);			/* START Pin enable */
    	printf("* %s: ADC set to continuous conversion\r", __func__);
    }
    

    I was able to see the change:

    but something went wrong, after that. I cant seem what though.. The reads just stopped

    checking everything as to what went wrong..

    Thanks,

    Manu

  • Hi Bob,

    That was some loose cables. Sigh!

    Best Regards,

    Manu

  • Hi Manu,

    I'm glad to hear that the fix was simple.  However the simplest of issues can be the hardest to diagnose.  

    Best regards,

    Bob B

  • Hi Bob,

    Especially, when one tinkers with code; you always suspect the code.

    But a lot of times the culprit had been something a bit too silly.

    I have a bit of trouble converting the data to centigrade. Have posted that one. I couldn't find an answer in the datasheet. Can you please help ?

    Thanks,

    Manu