SPI1 and AD5592r

Hello,
I have a board with an AnalogDevices AD5592r connected to the BeagleBoneBlack on SPI1.

I have built Linux version 4.9.1 with the default configuration and edited the device tree file to add SPI1 support. HDMI is disabled.

I have configured the device tree overlay to enable the SPI1 port:

spi1_default: spi1_default {
pinctrl-single,pins = <
/* SPI 1 /
0x190 (PIN_INPUT | MUX_MODE3) /
mcasp0_aclkx.spi1_sclk /
0x194 (PIN_INPUT | MUX_MODE3) /
mcasp0_fsx.spi1_d0 /
0x198 (PIN_OUTPUT | MUX_MODE3) /
mcasp0_axr0.spi1_d1 /
0x19C (PIN_OUTPUT_PULLUP | MUX_MODE3) /
spi CS0 /
0x1B4 (PIN_OUTPUT_PULLUP | MUX_MODE7) /
spi CS1 */

;
};

Also added the device to the port:

&spi1 {
cs-gpios = <0>;
pinctrl-names = “default”;
pinctrl-0 = <&spi1_default>;
status = “okay”;

ad5592r@0 {

compatible = “adi,ad5592r”;
reg = <0>;
spi-max-frequency = <1000000>;
spi-cpol;

channel-modes = /bits/ 8 <
CH_MODE_DAC
CH_MODE_ADC
CH_MODE_DAC_AND_ADC
CH_MODE_DAC_AND_ADC
CH_MODE_ADC
CH_MODE_GPIO
CH_MODE_GPIO
CH_MODE_GPIO

;
};
};

This is all as defined on the AD Wiki:
https://wiki.analog.com/resources/tools-software/linux-drivers/iio-dac/ad5592r

The driver is coming up as I can see it loaded:

ad5592r 3001 0
ad5592r_base 5903 1 ad5592r

Using a bus monitor I can see that the BBB is trying to talk to the AD device but there is no response… has anyone out there successfully communicated with AD5592r over SPI1 ?

Really trying to understand what is going on here and what would make there be no response from the device when using the kernel driver.

Thanks
Marc

Hello,
I have a board with an AnalogDevices AD5592r connected to the BeagleBoneBlack on SPI1.

I have built Linux version 4.9.1 with the default configuration and edited the device tree file to add SPI1 support. HDMI is disabled.

I have configured the device tree overlay to enable the SPI1 port:

spi1_default: spi1_default {
pinctrl-single,pins = <
/* SPI 1 /
0x190 (PIN_INPUT | MUX_MODE3) /
mcasp0_aclkx.spi1_sclk /
0x194 (PIN_INPUT | MUX_MODE3) /
mcasp0_fsx.spi1_d0 /
0x198 (PIN_OUTPUT | MUX_MODE3) /
mcasp0_axr0.spi1_d1 /
0x19C (PIN_OUTPUT_PULLUP | MUX_MODE3) /
spi CS0 /
0x1B4 (PIN_OUTPUT_PULLUP | MUX_MODE7) /
spi CS1 */

;
};

Also added the device to the port:

&spi1 {
cs-gpios = <0>;
pinctrl-names = “default”;
pinctrl-0 = <&spi1_default>;
status = “okay”;

ad5592r@0 {

compatible = “adi,ad5592r”;
reg = <0>;
spi-max-frequency = <1000000>;
spi-cpol;

channel-modes = /bits/ 8 <
CH_MODE_DAC
CH_MODE_ADC
CH_MODE_DAC_AND_ADC
CH_MODE_DAC_AND_ADC
CH_MODE_ADC
CH_MODE_GPIO
CH_MODE_GPIO
CH_MODE_GPIO

;
};
};

This is all as defined on the AD Wiki:
https://wiki.analog.com/resources/tools-software/linux-drivers/iio-dac/ad5592r

The driver is coming up as I can see it loaded:

ad5592r 3001 0
ad5592r_base 5903 1 ad5592r

Using a bus monitor I can see that the BBB is trying to talk to the AD device but there is no response… has anyone out there successfully communicated with AD5592r over SPI1 ?

In that case, then you either have a wiring issue or the processor SPI settings don’t match the device phase/polarity. If your connections are as follows:
spi1_d1 → AD5592r SDI
spi1_d0 ← SDO
spi1_sclk → SCLK
and the until is powered, then I would expect a response. You might also check the SPI data and clock polarity settings.

Regards,
John

Marc:

It is my experience that half the AD parts expect bits on the SPI to be LSb first, the other half expect bits on the SPI bus to be MSb first, and the third half have a configuration bit that allows the part to respond to either bit order by configuration.

But you need to understand the default and maybe flip the first (or all) configuration words end-for-end.

So, figure out if you have the SPI clock phase set correctly.

Then figure out which way the SPI in your BBB sends bit order.

Then figure out what the part wants.

Then and only then, configure the part.
I note that this part needs to be configured correctly, before it will reply.

Read the data sheet on the part until you understand it, and find all the little “gotchas” in the spec.

Being an AD part, they will be there.

— Graham

Graham,
Thanks for the pointers, I have been over the schematics again and double checked the wiring and it is correct.
Also had a go at reading back the raw temperature from the device. A node is there in the iio device:
AD5592_SPI_read_trace.png

So the driver is communicating with the device and I can read back the temperature.

The part I now have to solve is why I’m not getting all the nodes for the IO configuration ?

https://wiki.analog.com/resources/tools-software/linux-drivers/iio-dac/ad5592r