I have a cn0540 attached to a de10-nano with a custom Yocto image with libiio v0.23. When I run "iio_readdev ad7768-1" I get the error "Unable to refill buffer: Connection timed out (110)". From the other questions I've seen online about this problem, It seems to be caused by the interrupts not being set right in the device tree. However, the device tree I'm using is the de10-nano cn0540 one from the adi linux fork, so I don't think that is my problem. Because this is a custom Yocto build, I'm using the socfpga linux fork v5.13, this fork has outdated ad7768-1 drivers, so I patched them and related files. The list of files I've patched to be the version from the adi linux fork are:
ad7768-1.c buffer-dma.h buffer-dmaengine.h buffer_impl.h iio/consumer.h iio_core.h iio.h iio-opaque.h iio-triggered-buffer.c industrialio-buffer.c industrialio-buffer-cb.c industrialio-buffer-da.c industrialio-buffer-dmaengine.c industrialio-core.c industrialio-hw-consumer.c industrialio-trigger.c inkern.c irq.h spi-axi-spi-engine.c types.h uapi/types.h
I also have a kernel fragment which is:
CONFIG_IIO_BUFFER=y CONFIG_IIO_BUFFER_CB=y CONFIG_IIO_BUFFER_HW_CONSUMER=y CONFIG_IIO_BUFFER_DMA=y CONFIG_IIO_BUFFER_DMAENGINE=y CONFIG_IIO_KFIFO_BUF=y CONFIG_IIO_TRIGGERED_BUFFER=y CONFIG_IIO_TRIGGER=y CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 CONFIG_AD7768_1=y CONFIG_SPI_AXI_SPI_ENGINE=y CONFIG_DMA_VIRTUAL_CHANNELS=y CONFIG_AXI_DMAC=y CONFIG_IIO_INTERRUPT_TRIGGER=y CONFIG_IIO_SYSFS_TRIGGER=y
I still think my issue is related to interrupts because, when I run "cat proc/interrupts" before running "iio_readdev ad7768-1" I get:
CPU0 CPU1 24: 1996 1770 GIC-0 29 Edge twd 25: 0 0 GIC-0 199 Level timer0 26: 0 0 GIC-0 201 Level timer2 27: 0 0 GIC-0 202 Level timer3 28: 0 0 GIC-0 208 Level arm-pmu 29: 0 0 GIC-0 209 Level arm-pmu 30: 0 0 GIC-0 136 Level ffe01000.pdma 31: 29 0 GIC-0 137 Level ffe01000.pdma 32: 0 0 GIC-0 138 Level ffe01000.pdma 33: 0 0 GIC-0 139 Level ffe01000.pdma 34: 0 0 GIC-0 140 Level ffe01000.pdma 35: 0 0 GIC-0 141 Level ffe01000.pdma 36: 0 0 GIC-0 142 Level ffe01000.pdma 37: 0 0 GIC-0 143 Level ffe01000.pdma 38: 0 0 GIC-0 207 Level ff706000.fpgamgr 39: 0 0 GIC-0 152 Level eth0 40: 0 0 GIC-0 190 Level ffc04000.i2c 41: 0 0 GIC-0 191 Level ffc05000.i2c 43: 3000 0 GIC-0 171 Level dw-mci 46: 22 0 GIC-0 194 Level ttyS0 48: 0 0 GIC-0 160 Level ffb40000.usb, ffb40000.usb, dwc2_hsotg:usb1 49: 0 0 GIC-0 203 Edge ffd02000.watchdog 51: 0 0 GIC-0 79 Level ff280000.dma 52: 0 0 GIC-0 76 Level ff220000.rx-dma 53: 5 0 GIC-0 77 Level ff230000.spi IPI0: 0 0 CPU wakeup interrupts IPI1: 0 0 Timer broadcast interrupts IPI2: 24 25 Rescheduling interrupts IPI3: 397 701 Function call interrupts IPI4: 0 0 CPU stop interrupts IPI5: 0 0 IRQ work interrupts IPI6: 0 0 completion interrupts Err: 0and after I get:
CPU0 CPU1 24: 14146 13291 GIC-0 29 Edge twd 25: 0 0 GIC-0 199 Level timer0 26: 0 0 GIC-0 201 Level timer2 27: 0 0 GIC-0 202 Level timer3 28: 0 0 GIC-0 208 Level arm-pmu 29: 0 0 GIC-0 209 Level arm-pmu 30: 0 0 GIC-0 136 Level ffe01000.pdma 31: 65 0 GIC-0 137 Level ffe01000.pdma 32: 0 0 GIC-0 138 Level ffe01000.pdma 33: 0 0 GIC-0 139 Level ffe01000.pdma 34: 0 0 GIC-0 140 Level ffe01000.pdma 35: 0 0 GIC-0 141 Level ffe01000.pdma 36: 0 0 GIC-0 142 Level ffe01000.pdma 37: 0 0 GIC-0 143 Level ffe01000.pdma 38: 0 0 GIC-0 207 Level ff706000.fpgamgr 39: 0 0 GIC-0 152 Level eth0 40: 0 0 GIC-0 190 Level ffc04000.i2c 41: 0 0 GIC-0 191 Level ffc05000.i2c 43: 4314 0 GIC-0 171 Level dw-mci 46: 49 0 GIC-0 194 Level ttyS0 48: 0 0 GIC-0 160 Level ffb40000.usb, ffb40000.usb, dwc2_hsotg:usb1 49: 0 0 GIC-0 203 Edge ffd02000.watchdog 51: 0 0 GIC-0 79 Level ff280000.dma 52: 2 0 GIC-0 76 Level ff220000.rx-dma 53: 7 0 GIC-0 77 Level ff230000.spi IPI0: 0 0 CPU wakeup interrupts IPI1: 0 0 Timer broadcast interrupts IPI2: 27 26 Rescheduling interrupts IPI3: 439 1157 Function call interrupts IPI4: 0 0 CPU stop interrupts IPI5: 0 0 IRQ work interrupts IPI6: 0 0 completion interrupts Err: 0, I would expect the count for "ff280000.dma" to go up, but maybe I'm wrong in that assumption.
I am new to embedded linux, and even more so iio devices, and am very lost at solving this issue, any help would be appreciated. Thank you.