cancel
Showing results for 
Search instead for 
Did you mean: 

Help with ADS124S08 SPI ADC and its Linux driver

Lmoio.1
Senior

Hi, can someone help with ADS124S08 SPI ADC and its linux driver? I think the driver is correctly probed. I see /sys/devices/platform/soc/44004000.spi/spi_master/spi0/spi0.0/iio.device0/in_voltage0raw ...etc but it seems the device does not reply.

This is my device tree configuration:

&spi1 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&spi1_pins_a>;
	cs-gpios = <&gpioz 3 GPIO_ACTIVE_LOW>;
    #address-cells = <1>;
    #size-cells = <0>;
        adc@0 {
            compatible = "ti,ads124s08";
            reg = <0>; /* CS #0 */
            spi-max-frequency = <1000000>;
            spi-cpha;
            reset-gpios = <&gpioi 2 GPIO_ACTIVE_LOW>;
        };
};

First, i don't see the cs going low when i try to read the voltages. Should the driver do that?

Second, the driver ti-ads124s08.c itself seems a bit incoherent with the datasheet. it defines the start conversion command as in the datasheet but then never uses it and instead it uses a made-up command.

#define ADS124S08_CMD_START	0x08
#define ADS124S08_START_CONV	0x01
 
...
 
ret = ads124s_write_cmd(indio_dev, ADS124S08_START_CONV);
		if (ret) {
			dev_err(&priv->spi->dev, "Start conversions failed\n");
			goto out;
		}

 

1 ACCEPTED SOLUTION

Accepted Solutions
Lmoio.1
Senior

Hi @PatrickF​ 

i managed to make it work; linux driver is bugged and very basic and cannot handle the whole behaviour of the device. So i had to modify the driver to write specific registers.

Thanks

View solution in original post

3 REPLIES 3
PatrickF
ST Employee

Hi,

did you enabled the SPI1 kernel clock in the device tree ?

Located in the &rcc node, you should have something like :

st,pkcs = <
      ....
      CLK_SPI2S1_XXXX <== could be PLL4P, PLL4Q, CKPER or PLL3R
      ....
>;

could be checked in /sys/kernel/debug/clk/clk_summary by using such kind of command :

grep -E "clock|spi" /sys/kernel/debug/clk/clk_summary | sed 's,\s\+, ,g' | column -t

Regards,

Patrick

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Lmoio.1
Senior

Hi @PatrickF​ 

i managed to make it work; linux driver is bugged and very basic and cannot handle the whole behaviour of the device. So i had to modify the driver to write specific registers.

Thanks

Dear Lmoio,

 

Could you share with us the driver.

Thank you very much,

Best Regards,

Issam