cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring external ADC (AD74413R) with STM32MP157F-DK2

rehan_shakoor
Associate II

Hello Everyone,

 

I am working on a custom board based on STM32MP157F-DK2.  Our custom board have two external ADC (AD74413R) connected to the main processor. I have changed the device tree added proper driver for the external ADC. While reading the files from iio folder, i am getting "Connection timeout error". Device tree and error message is shown below.

Device tree

&spi4 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi4_pins_b>;
pinctrl-1 = <&spi4_sleep_pins_b>;

//chip select -> PA10 for ext ADC0
cs-gpios = <&gpioa 10 GPIO_ACTIVE_LOW>;

//enable SPI4
status = "okay";

ad74413r@0 {
compatible = "adi,ad74413r";

//this is chip select address 0
reg = <0>;

//base address and register size
#address-cells = <1>;
#size-cells = <0>;

//max. frequency 10Mhz
spi-max-frequency = <10000000>;
spi-cpol;

//ADC_READY -> PA5
//alert pin - >PA4
interrupt-parent = <&gpioa>;
interrupts = <5 IRQ_TYPE_EDGE_FALLING>;

//add sense resistor
refin-supply = <&ad74413r_refin>;

//reset pin -> PA9
reset-gpios = <&gpioa 9 GPIO_ACTIVE_LOW>;

//this channel have the function of voltage input
channel@0 {
reg = <0>;
adi,ch-func = <CH_FUNC_VOLTAGE_INPUT>;
};
};
};

 

Error :

root@stm32mp1:/sys/bus/iio/devices/iio:device0# cat in_voltage0_raw
cat: in_voltage0_raw: Connection timed out

Regards

Rehan Shakoor

2 REPLIES 2
rehan_shakoor
Associate II

If I break-down the problem into smaller pieces, then first issue is with spi4.

spi4 interface is used to connect with external ADC, but when I see clock logs for spi4 in kernel debugs, then it is not enabled (see last column of below screen-shot)

rehan_shakoor_0-1711800911464.png

rehan_shakoor_1-1711800927879.png

First question is, is it required to be "hardware enable"?

Seconds question is how to enable this?

 

 

rehan_shakoor
Associate II

I tested the SPI4 interface (on which ADC is connected), which is working fine. I think the problem is with device tree. What changes should I make in device tree?