Post Go back to editing

Error while setting values to DAC in CN0554

Category: Software
Product Number: EVAL-CN0554-RPIZ
Software Version: pyadi-iio 0.0.16, pylibiio 0.23.1

I am getting the following error when I write to the DAC in EVAL-CN0554-RP1Z connected to RPi 4B via the GPIO ports. I am able to connect to the device and read ADC values. 

Command issued:  cn_obj.volt = vset[2 * a].   [from the cn0554_example.py]

ERROR: READ LINE: -32

Traceback (most recent call last):

  File "/home/analog/Downloads/cn0554_example.py", line 46, in <module>

    cn_obj.volt = vset[2 * a]

  File "/home/analog/.local/lib/python3.9/site-packages/adi/ltc2688.py", line 96, in volt

    self.raw = int(((val / self.scale) - self.offset) * (ltc2688.vref / 4.096))

  File "/home/analog/.local/lib/python3.9/site-packages/adi/ltc2688.py", line 45, in scale

    return self._get_iio_attr(self.name, "scale", True, self._ctrl)

  File "/home/analog/.local/lib/python3.9/site-packages/adi/attribute.py", line 127, in _get_iio_attr

    self._get_iio_attr_str(channel_name, attr_name, output, _ctrl)

  File "/home/analog/.local/lib/python3.9/site-packages/adi/attribute.py", line 122, in _get_iio_attr_str

    return channel.attrs[attr_name].value

  File "/usr/local/lib/python3.9/dist-packages/iio.py", line 711, in <lambda>

    lambda self: self._read(),

  File "/usr/local/lib/python3.9/dist-packages/iio.py", line 740, in _read

    _c_read_attr(self._channel, self._name_ascii, buf, len(buf))

  File "/usr/local/lib/python3.9/dist-packages/iio.py", line 62, in _check_negative

    raise OSError(-result, _strerror(-result))

BrokenPipeError: [Errno 32] Broken pipe

Some information regarding the setup

I am on Kuiper linux 

analog@analog:~/Downloads $ 

Linux analog 5.10.63-v7l+ #1 SMP Fri Mar 10 16:35:58 UTC 2023 armv7l GNU/Linux

Highly appreciate any help in this regards

Thanking you

Krishna

  • After some searches, I had put in a dev rule to change the permissions. Now the /dev/iio:device and the linked director spi0.1 are owned by iio. Still no luck. osc says, need root permission to change registers and python codes give permission errors. 

    analog@analog:~ $ ls -al /sys/devices/platform/soc/fe204000.spi/spi_master/spi0/

    total 0

    drwxr-xr-x 6 root root    0 Nov 24 11:36 .

    drwxr-xr-x 3 root root    0 Nov 24 11:36 ..

    lrwxrwxrwx 1 root root    0 Nov 24 11:39 device -> ../../../fe204000.spi

    lrwxrwxrwx 1 root root    0 Nov 24 11:39 of_node -> ../../../../../../firmware/devicetree/base/soc/spi@7e204000

    drwxr-xr-x 2 root root    0 Nov 24 11:36 power

    drwxr-xr-x 6 root root    0 Nov 24 11:36 spi0.0

    drwxrwxr-x 5 root iio     0 Nov 24 11:36 spi0.1

    drwxr-xr-x 2 root root    0 Nov 24 11:36 statistics

    lrwxrwxrwx 1 root root    0 Nov 24 11:36 subsystem -> ../../../../../../class/spi_master

    -rw-r--r-- 1 root root 4096 Nov 24 11:36 uevent

  • Can you go to the IIO device under /sys/bus/iio/devices/iio:deviceX and check and control the attributes from there.

    What error do you get?

    -Michael