Hii All,

I am trying to hook up an External ADC device (ADC MCP3428) with NanoPC-T2 , below is the dts configuration for MCP3428.

in s5p4418-nanopi2-common.dtsi

step 1 : i2c4_gpio: i2c@4 {

compatible = "i2c-gpio";
gpios = <&gpio_c 7 0 /* SDA */
&gpio_c 8 0>; /* SCL */


i2c-gpio,delay-us = <10>;
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
};

i2c4_gpio: i2c@4 {

mcp3428@68 {

compatible = "microchip,mcp3428";
reg = <0x68>;
};

mcp3428@69 {

compatible = "microchip,mcp3428";
reg = <0x69>;

};
step 2 : After this i have compiled my device tree using make ARCH=arm CROSS_COMPILE=arm-cortexa9-linux-gnueabihf- dtbs

step 3 : i have enabled the kernel module support for the mcp3428 device which is under iio folder of linux source , I have compiled this as a module .

step 4 : Copied newly generated zImage , dtb file into /boot directory of sdcard.

step 5 : Copied the kernel module mcp3422.ko into rootfs partition of sdcard.

step 6 : Pin connections between NanoPC-T2 I2C And MCP3428

on 30 Pin GPIO connector of Nanopc-t2

Pin No . Pin Name Description
18 GPIOC7 SDA -----------------------------> MCP3428 SDA
19 GPIOC8 SCL ------------------------------> MCP3428 SCL
29 5v supply ------------------------------> MCP3428 VDD
30 GND ground ------------------------------> MCP3428 GND



step 7 : using i2cdetect tool i scanned i2c chip addresses using i2cdetect -y -r 4 and following are the results.

0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- 04 05 -- 07 08 09 0a 0b 0c 0d 0e --
10: 10 11 12 13 14 15 16 17 18 19 -- 1b -- 1d 1e --
20: 20 21 22 23 24 25 26 27 -- 29 2a 2b 2c 2d 2e 2f
30: -- -- -- -- -- -- -- -- 38 39 3a -- 3c -- 3e 3f
40: 40 41 42 -- 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 61 62 63 64 65 66 67 UU 69 6a 6b 6c 6d -- 6f
70: 70 71 72 73 74 75 76 77

step 8 : Before doing above step i have loaded the kernel module mcp3422.ko using insmod mcp3422.ko

step 9 : Result of i2cdetect -l gives the following.

root@NanoPC-T2:/sys# i2cdetect -l
i2c-0 i2c nexell-i2c I2C adapter
i2c-1 i2c nexell-i2c I2C adapter
i2c-2 i2c nexell-i2c I2C adapter
i2c-3 i2c c0000000.soc:i2c@3 I2C adapter
i2c-4 i2c c0000000.soc:i2c@4 I2C adapter

step 10 : ls /dev

i2c-0
i2c-1
i2c-2
i2c-3
i2c-4
iio:device1
iio:device2

step 11 : ls -l /sys/bus/i2c/devices/4-0068/iio:device1/ i have the following attributes

total 0
-r--r--r-- 1 root root 4096 Mar 10 12:01 dev
-rw-r--r-- 1 root root 4096 Mar 10 12:01 in_voltage0_raw
-rw-r--r-- 1 root root 4096 Mar 10 12:01 in_voltage0_scale
-rw-r--r-- 1 root root 4096 Mar 10 12:01 in_voltage1_raw
-rw-r--r-- 1 root root 4096 Mar 10 12:01 in_voltage1_scale
-rw-r--r-- 1 root root 4096 Mar 10 12:01 in_voltage2_raw
-rw-r--r-- 1 root root 4096 Mar 10 12:01 in_voltage2_scale
-rw-r--r-- 1 root root 4096 Mar 10 12:01 in_voltage3_raw
-rw-r--r-- 1 root root 4096 Mar 10 12:01 in_voltage3_scale
-rw-r--r-- 1 root root 4096 Mar 10 12:01 in_voltage_sampling_frequency
-r--r--r-- 1 root root 4096 Mar 10 12:01 in_voltage_scale_available
-r--r--r-- 1 root root 4096 Mar 10 12:01 name
-r--r--r-- 1 root root 4096 Mar 10 12:01 sampling_frequency_available
lrwxrwxrwx 1 root root 0 Mar 10 12:00 subsystem -> ../../../../../../../bus/iio
-rw-r--r-- 1 root root 4096 Mar 10 12:00 uevent

So i have connected +1.8v supply to channel 1 of MCP3428 when i try to cat in_volatge0_raw from the command line i am getting 0 v like as follows


$ cat in_voltage0_raw
0



May i know the reason where should i did wrong?????????




Regards,

Shubhakar Gowda P S