Sample Header Ad - 728x90

IIO Unable to refill buffer: Connection timed out (110) error when running iio_readdev

0 votes
1 answer
537 views
I have made a custom Linux image with Yocto for use with CN0540 and DE10-Nano. The manufacturer of the CN0540 (Analog Devices) provides an evaluation image for the board, which works without issue, however in my custom image which is using the same kernel fork (ADI Linux fork ), the same defconfig as far as I can tell (socfpga_adi_defconfig), and the same device tree (CN0540 dts ), and also the same HDL is loaded on the FPGA (CN0540 HDL ) I can't use the buffer from the ADC on the CN0540 (AD7768-1). I can read a single value from the ADC, either with libiio's iio_info command, or with the device file at sys/bus/iio/devices/iio:device0/in_voltage0_raw, but I can't read from the buffer of the device E.g iio_readdev ad7768-1 returns Unable to refill buffer: Connection timed out (110), or doing
> echo 1 > scan_elements/in_voltage0_en
> echo 1 > buffer/enable
> cat /dev/iio:device0 | hexdump
which causes the device to crash, unless I set the length of the buffer to 1 with echo 1 > buffer/length which causes the device to output
[  441.310599] rcu: INFO: rcu_sched self-detected stall on CPU
[  441.316258] rcu:     0-....: (2099 ticks this GP) idle=10f/1/0x40000002 softirq=2509/2509 fqs=1033
[  441.325163]  (t=2100 jiffies g=497 q=7)
[  441.329057] NMI backtrace for cpu 0
[  441.332592] CPU: 0 PID: 163 Comm: cat Not tainted 5.15.0-yocto-standard-adi #1
[  441.339927] Hardware name: Altera SOCFPGA
[  441.343988] Backtrace:
[  441.346453] [] (dump_backtrace) from [] (show_stack+0x20/0x24)
[  441.354073]  r7:c010edfc r6:00000000 r5:60070193 r4:c143b218
[  441.359801] [] (show_stack) from [] (dump_stack_lvl+0x48/0x54)
[  441.367360] [] (dump_stack_lvl) from [] (dump_stack+0x18/0x1c)
[  441.374907]  r5:00000000 r4:20070193
[  441.378525] [] (dump_stack) from [] (nmi_cpu_backtrace+0xe0/0x114)
[  441.386424] [] (nmi_cpu_backtrace) from [] (nmi_trigger_cpumask_backtrace+0xe8/0x134)
[  441.395965]  r7:c010edfc r6:c0e01ee4 r5:c170469c r4:00000000
[  441.401597] [] (nmi_trigger_cpumask_backtrace) from [] (arch_trigger_cpumask_backtrace+0x20/0x24)
[  441.412180]  r9:c1703f10 r8:c0e01ee0 r7:c1835438 r6:00000000 r5:c1703fa4 r4:c171e840
[  441.419886] [] (arch_trigger_cpumask_backtrace) from [] (rcu_dump_cpu_stacks+0x144/0x174)
[  441.429922] [] (rcu_dump_cpu_stacks) from [] (rcu_sched_clock_irq+0x6a8/0xa58)
[  441.438860]  r10:2e138000 r9:c1702d00 r8:c1693f40 r7:c18361a0 r6:00000000 r5:ef7cbf40
[  441.446784]  r4:c171e840
[  441.449304] [] (rcu_sched_clock_irq) from [] (update_process_times+0x98/0xc4)
[  441.458174]  r10:c1702d80 r9:c1702d40 r8:c184fd40 r7:2e138000 r6:c1702d00 r5:00000000
[  441.465969]  r4:ef7c5540
[  441.468524] [] (update_process_times) from [] (tick_sched_timer+0x88/0x2d8)
[  441.477198]  r7:c1ea9dc0 r6:00000066 r5:bf87a4da r4:ef7c6128
[  441.482830] [] (tick_sched_timer) from [] (__hrtimer_run_queues+0x1fc/0x36c)
[  441.491730]  r10:ef7c5e14 r9:ef7c6128 r8:20070193 r7:00000000 r6:c01b7458 r5:ef7c5dc0
[  441.499645]  r4:ef7c5e00
[  441.502183] [] (__hrtimer_run_queues) from [] (hrtimer_interrupt+0x13c/0x2c8)
[  441.511041]  r10:ef7c5e98 r9:ef7c5e70 r8:ef7c5e48 r7:ef7c5dcc r6:00000003 r5:20070193
[  441.518836]  r4:ef7c5dc0
[  441.521357] [] (hrtimer_interrupt) from [] (twd_handler+0x44/0x4c)
[  441.529394]  r10:c1ea8000 r9:c1ea9dc0 r8:f080210c r7:c1d08240 r6:00000018 r5:c17046b4
[  441.537301]  r4:00000001
[  441.539821] [] (twd_handler) from [] (handle_percpu_devid_irq+0x9c/0x200)
[  441.548321]  r5:c17046b4 r4:c1d09000
[  441.551888] [] (handle_percpu_devid_irq) from [] (handle_domain_irq+0x6c/0x88)
[  441.560961]  r7:0000001d r6:00000000 r5:00000000 r4:c1692a14
[  441.566593] [] (handle_domain_irq) from [] (gic_handle_irq+0x88/0x9c)
[  441.574767]  r7:c1692a20 r6:f0802100 r5:c177a344 r4:c17046b4
[  441.580494] [] (gic_handle_irq) from [] (__irq_svc+0x5c/0x78)
[  441.587952] Exception stack(0xc1ea9dc0 to 0xc1ea9e08)
[  441.593047] 9dc0: c28b3700 00000000 00000000 00000003 00001000 c28b3700 c2b47f40 befe9c04
[  441.601193] 9de0: c28b3774 befe9c04 c1ea8000 c1ea9e24 c1ea9e28 c1ea9e10 c0a95530 c0a949ac
[  441.609342] 9e00: 20070013 ffffffff
[  441.612863]  r9:c1ea8000 r8:c28b3774 r7:c1ea9df4 r6:ffffffff r5:20070013 r4:c0a949ac
[  441.620699] [] (iio_dma_buffer_dequeue) from [] (iio_dma_buffer_read+0x148/0x19c)
[  441.629894]  r5:c28b3700 r4:00001000
[  441.633452] [] (iio_dma_buffer_read) from [] (iio_buffer_read+0x178/0x228)
[  441.642168]  r10:c1ea8000 r9:befe9c04 r8:00001000 r7:00000400 r6:00000002 r5:c1e43000
[  441.649962]  r4:c28b3700
[  441.652483] [] (iio_buffer_read) from [] (iio_buffer_read_wrapper+0x2c/0x38)
[  441.661248]  r10:00000003 r9:c0954af8 r8:00001000 r7:00000001 r6:c1ea8000 r5:c1ea9f60
[  441.669050]  r4:c2b28540
[  441.671571] [] (iio_buffer_read_wrapper) from [] (vfs_read+0xc4/0x320)
[  441.679817] [] (vfs_read) from [] (ksys_read+0x74/0xec)
[  441.686766]  r10:00000003 r9:00000000 r8:00000000 r7:befe9c04 r6:c1ea8000 r5:c2b28540
[  441.694560]  r4:c2b28540
[  441.697081] [] (ksys_read) from [] (sys_read+0x18/0x1c)
[  441.704027]  r9:c1ea8000 r8:c0100244 r7:00000003 r6:b6f681a0 r5:befe9c04 r4:00001000
[  441.711733] [] (sys_read) from [] (ret_fast_syscall+0x0/0x48)
[  441.719310] Exception stack(0xc1ea9fa8 to 0xc1ea9ff0)
[  441.724344] 9fa0:                   00001000 befe9c04 00000003 befe9c04 00001000 00000000
[  441.732488] 9fc0: 00001000 befe9c04 b6f681a0 00000003 00000000 01000000 00000003 befe9c04
[  441.740769] 9fe0: 00000003 befe9bb8 b6e6070f b6de1ae6
and that output repeats every ~20 seconds. The device is supposed to send an interrupt to the OS when the buffer is ready, so I probed the DRDY pin (which is the pin for the interrupt) of the device with an MCU, and the pin never goes high. I also tried switching the libiio version I was using to the same as the evaluation image, 0.23 to 0.21 and the error when running iio_readdev ad7768-1 changed from Unable to refill buffer: Connection timed out (110) to
Unable to refill buffer: Connection timed out
ERROR: Error during buffer disable: No such file or directory
which I'm pretty sure is functionally the same error, so I changed the libiio version back to 0.23 I patched the device driver and libiio in an attempt to find the problem and found out that the problem line from calling iio_readdev ad7768-1 in libiio is this one ret = poll(pollfd, 2, timeout_rel);, and the problem function in the device driver seems to be this one hw_submit_block. What is causing the timed out error?
Asked by ThePumkinMelon (3 rep)
May 19, 2023, 08:03 PM
Last activity: Jul 24, 2023, 08:07 PM