2021-10-21 09:14 AM - last edited on 2024-07-07 03:23 PM by Tesla DeLorean
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; }
Solved! Go to Solution.
2021-10-27 09:02 AM
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
2021-10-27 08:52 AM
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
2021-10-27 09:02 AM
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
2024-07-07 02:11 PM
Dear Lmoio,
Could you share with us the driver.
Thank you very much,
Best Regards,
Issam