AnsweredAssumed Answered

IIO Oscilloscope through USB

Question asked by jpa44 on Jul 7, 2017
Latest reply on Jul 13, 2017 by pcercuei


I'm trying to run IIO Oscilloscope on a Linux PC connected to zedBoard with AD-FMCOMMS4. It works fine by network but I want to do it via USB.


I rebuild my kernell to support ConfigFS, FunctionFS, USB gadget mode.

I rebuild also my DTB to set USB dr_mode to OTG  and I follow :


# Mount the configfs folder. If it fails here, check that CONFIG_USB_CONFIGFS is enabled in the kernel.
mount configfs -t configfs /sys/kernel/config

# Create the ffs folder. If it fails here, check that CONFIG_USB_CONFIGFS_F_FS is enabled in the kernel.
mkdir /sys/kernel/config/usb_gadget/ffs

# Use your idVendor / idProduct here. Those are for Analog Devices ADALM-2000 (M2K) product.
echo 0x0456 > /sys/kernel/config/usb_gadget/ffs/idVendor
echo 0xb672 > /sys/kernel/config/usb_gadget/ffs/idProduct

# It is required to set the 'manufacturer', 'product' and 'serialnumber' strings for the 0x409 locale (en-US).
mkdir /sys/kernel/config/usb_gadget/ffs/strings/0x409
echo "Analog Devices Inc." > /sys/kernel/config/usb_gadget/ffs/strings/0x409/manufacturer
echo "M2K" > /sys/kernel/config/usb_gadget/ffs/strings/0x409/product
echo 00000000 > /sys/kernel/config/usb_gadget/ffs/strings/0x409/serialnumber

# We create a USB configuration that only features the FunctionFS function.
mkdir /sys/kernel/config/usb_gadget/ffs/functions/ffs.m2k_ffs
mkdir /sys/kernel/config/usb_gadget/ffs/configs/c.1
mkdir /sys/kernel/config/usb_gadget/ffs/configs/c.1/strings/0x409
echo "IIO" > /sys/kernel/config/usb_gadget/ffs/configs/c.1/strings/0x409/configuration
ln -s /sys/kernel/config/usb_gadget/ffs/functions/ffs.m2k_ffs /sys/kernel/config/usb_gadget/ffs/configs/c.1/ffs.m2k_ffs

# We create the FunctionFS mountpoint, and mount it
mkdir /dev/m2k_ffs
mount m2k_ffs -t functionfs /dev/m2k_ffs

# Start IIOD in network + USB mode, and use 7*2 endpoints.
/usr/sbin/iiod -F /dev/m2k_ffs -n 7

# At this point IIOD will start in the foreground.
# To enable the USB gadget mode, run the following command in a separate terminal:
# (Note: c_hdrc.0 is for the ZedBoard. Your UDC should be listed in /sys/class/udc/)
echo ci_hdrc.0 > /sys/kernel/config/usb_gad


On my PC, the command "iio_info -s" return:

Library version: 0.10 (git tag: 11b871b)
Compiled with backends: local xml ip usb serial
Available contexts:
0: 0456:b672 (Analog Devices Inc. M2K), serial=00000000 [usb:4.18.0]


When I launch the oscilloscop app with "osc -u usb:4.18.0"

All seems to be OK, but when I click on the "Capture" button, I have the following errors:

Error: Unable to create buffer: Connection timed out
Error while reading data: Connection timed out


How can I investigate to find where the problem comes from?