Hi,
So i have been trying to to establish SPI communication between AD7193 and Raspberry pi 3. I'm using the Yocto-rpi image for this purpose. This is procedure i followed but facing some issues:-
1. Enabled the ad7193 driver in menuconfig.
2. Added the patch file in the drivers/staging/iio/adc/ad7192.c for it to support device tree.
3.Created an overlay. dts file for this is /boot/dts/ as follows
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
fragment@0 {
target = <&spi0>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&spidev0>;
__overlay__ {
status = "disabled";
};
};
fragment@2 {
target = <&spidev1>;
__overlay__ {
status = "disabled";
};
};
fragment@3 {
target = <&gpio>;
__overlay__ {
ad7193_pins: ad7193_pins {
brcm,pins = <45>;
brcm,function = <0>;
brcm,pull = <0>;
};
};
};
fragment@4 {
target = <&spi0>;
__overlay__ {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
adc: ad7192@0{
compatible = "adi,ad7192";
reg = <0>;
pinctrl-names = "default";
pinctrl-0 = <&ad7193_pins>;
spi-max-frequency = <1000000>;
spi-cpha;
spi-cpol;
irq-gpio = <&gpio 45 0x2>; /* IRQF_TRIGGER_FALLING */
interrupts = <45 0>; /* high-to-low edge triggered */
interrupt-parent = <&gpio>;
adi,reference-voltage-mv = <3300>;
adi,clock-source-select = <2>;
adi,refin2-enable;
adi,unipolar-enable;
status = "okay";
};
};
};
};
4. Added this overlay.dts file to bb.append file and rebuild the kernel and enable the overlay file in /boot/config.txt in the target.
5. The driver is loaded but i keep getting setup failed and spi0.0 supply vcc not found, using dummy regulator
ad7192 spi0.0: setup failed
ad7192: probe of spi0.0 failed with error -5
I'm attaching the image below please let me know what i'm doing wrong.
Note:- I have connected AGND,CS,SCLK,Din,Dout/Rdy to the respective pins in raspberry pi 3.
Thanks in advance.
-SK