ads1191 adc reading error using SPI bus

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ads1191 adc reading error using SPI bus

761 Views
analogicstechin
Contributor III

Hello ,

In our custom board(IMX6ULL) we used ads1191-16bit ADC SPI interface , The Driver for the same is being probed but when we read  ADC value the output is zero even though giving (2V to 3.3V for AIN(4th pin)) when reading from the userspace using IOCTL call .

dts declaration is,

&ecspi1 {
        status = "okay";
        pinctrl-names = "default";
        fsl,spi-num-chipselects = <1>;
        pinctrl-0 = <&ecspi1_pins>;
        ads1191dev@0 {
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&printer2t_pins_default>;
                compatible = "ads1191_ADC";
                reg = <0>;
                spi-max-frequency = <512000>;   /* 16M  */
        };
};

ecspi1_pins:ecspi1_pins_default {
                        fsl,pins = <
                                MX6UL_PAD_CSI_DATA07__ECSPI1_MISO       0x70a1
                                MX6UL_PAD_CSI_DATA06__ECSPI1_MOSI       0x79
                                MX6UL_PAD_CSI_DATA04__ECSPI1_SCLK       0x70a1
                        >;
                };

printer2t_pins_default: printer2t_pins {
                        fsl,pins = <
                                MX6UL_PAD_CSI_DATA05__GPIO4_IO26        0x79

                        >;

               };

Getting below dmesg while inserting the driver.....

Value Read... ff 00 00 00
Msb2Lsb ...   ff 00 00 00
 .......Ads1191 ID in INIT= 255
 .......Ads1191 ID = 255
Value Read... ff 00 00 00
Msb2Lsb ...   ff 00 00 00
.......Ads1191 ID = 255
Ads1191 ID Not Matched/Device not Detected
Ads1191 LOFF = 255
- Reg Read...

>>>>>>ads1191 detect success<<<<<<<

Getting below dmesg when calling ioctl function....

Division by zero in kernel.
CPU: 0 PID: 815 Comm: test33V2 Not tainted 4.1.15-2.0.1+gb63f3f5 #75
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
 [<80015d78>] (unwind_backtrace) from [<8001271c>] (show_stack+0x10/0x14)
 [<8001271c>] (show_stack) from [<8082d360>] (dump_stack+0x84/0xc4)
 [<8082d360>] (dump_stack) from [<802b1418>] (Ldiv0+0x8/0x10)
 [<802b1418>] (Ldiv0) from [<8063c12c>] (ads1191_user_ioctl+0x54/0x80)
 [<8063c12c>] (ads1191_user_ioctl) from [<800fb204>] (do_vfs_ioctl+0x3e8/0x608)
 [<800fb204>] (do_vfs_ioctl) from [<800fb458>] (SyS_ioctl+0x34/0x5c)
 [<800fb458>] (SyS_ioctl) from [<8000f480>] (ret_fast_syscall+0x0/0x3c)
 adcval value in ioctl=0

I am attaching driver ads1191.c , please go through them and the error log ,suggest me if any software and Hardware changes are required.

Labels (1)
0 Kudos
1 Reply

666 Views
igorpadykov
NXP Employee
NXP Employee

Hi Analogics Tech India Limited

from log: "Ads1191 ID Not Matched/Device not Detected"

so spi may not work at all or ads1191 not sends (or sends wrong) data,

one can test signals with oscilloscope and check hardware.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos