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: Problem with ADS124S08 as Three-Wire PT100 RTD Measurement Circuit and linux driver

Part Number: ADS124S08

Hello,

I'm trying to read the temperature of a PT100 using the ADS124s08 module with STM32MPU processor, but i cannot read any data.

I enabled the linux driver ti-ads124s08.c and saw that it created the 12 in_voltage_raw correctly.

However, the driver does not have the capability to set registers, so I added that part:

I modified the driver so that when reading in_voltage0_raw it sets the DAC1 to AIN0 and 1mA, single-shot mode.

I can read back the registers with the right value and i verified that the DAC channel outputs current.

My configuration is the following:

DATA REG (0x2) = 0x34 (single-shot mode)

REF REG (0x5) = 0x12 (internal ref on)

CURR REG 1 (0x6) = 0x7 (1 mA)

CURR REG 2 (0x7) = 0xD0 (dac2 off, dac1 chan 0)

As stated in other forum questions, the driver has an error in the start conversion command, so i changed that too.

When i try to read the data (in_voltage1_raw), the first time the module does not reply. If I issue a second read data command, i see that the module outputs values when i'm requesting to set the inmux channel.

It seems the read data is not in sync with my command.

root@stm32mp1:~# cat /sys/devices/platform/soc/44004000.spi/spi_master/spi0/spi0
.0/iio\:device0/in_voltage0_raw
[  579.350031] TI-ADS124: send wakeup cmd
[  579.351867] TI-ADS124: setting data register to one-shot mode
[  579.356227] TI-ADS124: data reg set to 52
[  579.359590] TI-ADS124: setting IDAC magnitude to 1mA
[  579.363703] TI-ADS124: IDACMAG reg set to 7
[  579.367043] TI-ADS124: setting internal voltage reference
[  579.372707] TI-ADS124: REF reg set to 18
[  579.376124] TI-ADS124: status reg = 128
[  579.379423] TI-ADS124: setting chan 0 to IDAC1
[  579.384144] TI-ADS124: DACMUX reg set to 208

When reading chan1, the sequence is the following:

set INMUX REG to 0x01.

send START CONV CMD.

send READ DATA CMD.

If I am using single-shot mode, read data command can be skipped?

Should i take in consideration DRDY pin?

  • Hi Lidia,

    Welcome to the E2E forum!  A couple of resources that may be helpful are A Basic Guide to RTD Measurements and Temperature Sensor Firmware for Precision ADCs.  Even though the firmware example is written for embedded C applications, the code flow should help you to determine the correct procedure to follow for setting up and making the RTD measurements.

    From your description it would appear that you are giving the START command and then immediately following issuing the read data (RDATA) command.  After issuing the START command you must wait for the conversion to complete before attempting to read the result.  The end of conversion is signaled by a high to low transition on DRDY. 

    Another method that can be used is to wait or delay a period of time after the START command is issued before attempting to read the data.  The amount of time to delay will depend on the data rate and digital filter selected in the register settings.  The length of time required is shown in Table 13 of the ADS124S08 datasheet for the low-latency filter and Table 15 for the sinc3 digital filter.

    Best regards,

    Bob B

  • Thank you Bob,

    I removed the RDATA command and kept only the 3 bytes read after a delay. It seems working fine now.

    I also modified the driver to set both positive and negative channel. The original linux driver was quite bogus, or at least not capable of doing RTD measurement!

    Regards

  • Hi Lidia,

    Glad to hear Bob's help got it working. For future reference, the Temperature Sensor Firmware for Precision ADCs has C code that shows how to configure the ADS124s08 with the tables and different configurations use the ADS124S08 EVM in RTD measurements with several configurations: 2-wire, 3-wire, and 4-wire. This code can be ported with some modifications to a linux system using your driver. In fact, it would be interesting to see the changes you have made to the linux driver. This driver is open source and you could submit a patch to the existing driver or submit it as a separate driver.

    As far as responding to a DRDY signal, the IIO drivers require registering the trigger. The GPIO tied to DRDY acts as the trigger that then calls the driver. Here is the documentation:

    https://www.kernel.org/doc/html/latest/driver-api/iio/triggers.html

    For reference, here is an example from STM's documentation to register its internal ADC 

    Best regards,
    Pedro