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: ADS124S08 linux driver

Part Number: ADS124S08

Hi!

I'm use linux driver for ads124s08. When i try to read value, driver return always 0, on all channels.

Mode details:

  1. Kernel 4.19
  2. ads124S08 driver https://github.com/torvalds/linux/blob/master/drivers/iio/adc/ti-ads124s08.c
  3. link to dts file https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/iio/adc/ti,ads124s08.yaml

My dts fragment:

&spi0 {
	#address-cells = <1>;
	#size-cells = <0>;

	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&spi0_pins>;

	adc@0 {
		compatible = "ti,ads124s06";
		reg = <0>;
		spi-max-frequency = <1000000>;
		spi-cpha;
		reset-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
	};

};

4. Command to read values

cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw

Please help me

  • Hi Alex,

    It is not clear what you are intending to send to the ADS124S08.  The first sequence sent is 0x42 0x00 0x00 which is a register to write to the INPMUX register with a value of 0 which is setting both MUXP and MUXN of the mux to the same input channel AIN0.  The next transmission is 0x01.  It is not clear the intention as this is not a valid command.  The next sequence is the RDATA command which appears to be appropriate, then followed by a string of NOPs.

    What is not clear is if the START pin is set high or if the START command has been issued.  The ADC will not start converting unless it is set to do so.  If the initial 0x01 byte was meant to be the START command, then the wrong value is being sent for the command.  Also, you must monitor DRDY to make sure that the conversion has completed prior to attempting to read the conversion result.

    Best regards,
    Bob B

  • Hi, Bob

    I'm modyfing the driver

    //#define ADS124S08_START_CONV 0x01
    //#define ADS124S08_STOP_CONV 0x00

    #define ADS124S08_START_CONV 0x08
    #define ADS124S08_STOP_CONV 0x0a

    START is low

    But, data conv is 0

  • Hi Alex,

    I did not write the driver, but I do now remember that there can be some confusion as to the stop and start defines.  I believe the 0x01 and 0x00 referred initially to hardware pins settings even though the SPI communication is used for sending the commands.  So the way you have it now would be correct.

    Keep in mind that you need to wait for the conversion to complete.  After the START command is issued, the conversion will not complete until DRDY transitions from a high to low state.  Depending on the data rate and filter mode selected, the time needed for the conversion data to be ready could be a great deal longer than you are giving.  Table 13 on page 42 of the datasheet gives the times to when the conversion will become available when using the low-latency filter.  The default data rate is 20sps and the default filter is low-latency.  So it will take longer than 56ms for the data to become available, so based on communication you are not waiting long enough.  If you have an open channel on your analyzer I would suggest monitoring the DRDY pin to see when it transitions following the START command.  Once it transitions you can read the result.

    One further note is that you need to make sure that you have a valid reference selected and applied to the ADC.

    Best regards,

    Bob B