Page 1 of 1

DFU fails - "Error claiming interface 0", in Ubuntu 18.04

Posted: Tue Nov 26, 2019 2:46 pm
by nestor_lee
Hi XMOS experts,

I'm testing the DFU function using a XK-VF3100-C43 kit.
I followed the procedures as follows:

1. Download USB Audio 2.0 software from this webpage https://www.xmos.com/software/usb-audio

2. Extract the usb-audio software into my workspace: ~/workspace, and use the project

~/workspace/package/sw_usb_audio-615rc1/sw_usb_audio for testing.
After compiling, got following .xe files:

~/workspace/package/sw_usb_audio-615rc1/sw_usb_audio/app_usb_aud_mic_array/bin$ tree
.
├── 1i8o2
│   └── app_usb_aud_mic_array_1i8o2.xe
└── 2i8o2
└── app_usb_aud_mic_array_2i8o2.xe

3. Use 2i8o2/app_usb_aud_mic_array_2i8o2.xe as factory image, since its PID is 0x8( and if flashing 1i8o2/app_usb_aud_mic_array_1i8o2.xe in to demo board, got the VID = 0x20b1, PID = 0x9 . While the xmosdfu tool could not find devices if PID = 0x9).

So I type
~/workspace/package/sw_usb_audio-615rc1/sw_usb_audio/app_usb_aud_mic_array/bin$ xflash --boot-partition-size 0x30000 --factory ./2i8o2/app_usb_aud_mic_array_2i8o2.xe
to flash the firmware.
And, to generate the newfirmware to be flashed via DFU, by typing
~/workspace/package/sw_usb_audio-615rc1/sw_usb_audio/app_usb_aud_mic_array/bin$ xflash --factory-version 14.3 --upgrade 1 ./1i8o2/app_usb_aud_mic_array_1i8o2.xe -o ./1i8o2/newfirmware.bin

So now that I got the newfirmware.bin
.
├── 1i8o2
│   ├── app_usb_aud_mic_array_1i8o2.xe
│   └── newfirmware.bin
└── 2i8o2
└── app_usb_aud_mic_array_2i8o2.xe

4. Change directory to
~/workspace/package/sw_usb_audio-615rc1/sc_usb_audio/module_dfu/host/xmos_dfu_linux$

and follow the instructions in this thread(https://www.xcore.com/viewtopic.php?f=47&t=4025)
After installing usblib, I can build the xmosdfu tool by typing

~/workspace/package/sw_usb_audio-615rc1/sc_usb_audio/module_dfu/host/xmos_dfu_linux$ g++ -g -o xmosdfu xmosdfu.cpp `pkg-config --libs --cflags libusb-1.0`

~/workspace/package/sw_usb_audio-615rc1/sc_usb_audio/module_dfu/host/xmos_dfu_linux$ ls
Makefile.linux Readme.txt xmosdfu xmosdfu.cpp

5. First check the usb devices

~/workspace/package/sw_usb_audio-615rc1/sc_usb_audio/module_dfu/host/xmos_dfu_linux$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 007: ID 2386:310f
Bus 001 Device 005: ID 8087:0aa7 Intel Corp.
Bus 001 Device 066: ID 20b1:0008 XMOS Ltd
Bus 001 Device 003: ID 04f2:b56d Chicony Electronics Co., Ltd
Bus 001 Device 052: ID 20b1:f7d4 XMOS Ltd
Bus 001 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

We can find the target XMOS device here
Bus 001 Device 066: ID 20b1:0008 XMOS Ltd

6. xmosdfu needs to be run as root, if not, will get "Could not find/open device" error(https://www.xcore.com/viewtopic.php?f=47&t=7691).
So I type

~/workspace/package/sw_usb_audio-615rc1/sc_usb_audio/module_dfu/host/xmos_dfu_linux$ sudo ./xmosdfu --download ~/workspace/package/sw_usb_audio-615rc1/sw_usb_audio/app_usb_aud_mic_array/bin/1i8o2/newfirmware.bin
[sudo] password for nestor:
VID = 0x1d6b, PID = 0x3, BCDDevice: 0x415
VID = 0x2386, PID = 0x310f, BCDDevice: 0x0
VID = 0x8087, PID = 0xaa7, BCDDevice: 0x1
VID = 0x20b1, PID = 0x8, BCDDevice: 0x6f2
XMOS DFU application started - Interface 3 claimed
Detaching device from application mode.
Waiting for device to restart and enter DFU mode...
VID = 0x1d6b, PID = 0x3, BCDDevice: 0x415
VID = 0x2386, PID = 0x310f, BCDDevice: 0x0
VID = 0x8087, PID = 0xaa7, BCDDevice: 0x1
VID = 0x20b1, PID = 0x8, BCDDevice: 0x6f2
Error claiming interface 0
Another program or driver has claimed the interface

I've been told that the Interface will bechanged to 0 as device restart to DFU mode.
But I don't know why it stuck (perhaps in interface 3?).
I've tried to unplug and re-plug the USB cable, but it does no help.

Please give a hand.
Thanks.

Re: DFU fails - "Error claiming interface 0", in Ubuntu 18.04

Posted: Wed Nov 27, 2019 2:01 am
by mon2
Hi. Not sure about the "Error claiming interface 0" but do review the following related thread:

https://www.xcore.com/viewtopic.php?f=8 ... 390#p36390

and post your results.

Re: DFU fails - "Error claiming interface 0", in Ubuntu 18.04

Posted: Wed Nov 27, 2019 3:36 am
by nestor_lee
mon2 wrote: Wed Nov 27, 2019 2:01 am Hi. Not sure about the "Error claiming interface 0" but do review the following related thread:

https://www.xcore.com/viewtopic.php?f=8 ... 390#p36390

and post your results.
Hi.

I used the files from the link you shared.
but I got the same results.

~/workspace/package/sw_usb_audio-615rc1/sc_usb_audio/module_dfu/host/xmos_dfu_linux$ sudo ./xmosdfu --download ~/workspace/package/sw_usb_audio-615rc1/sw_usb_audio/app_usb_aud_mic_array/bin/1i8o2/newfirmware.bin
VID = 0x1d6b, PID = 0x3, BCDDevice: 0x415
VID = 0x2386, PID = 0x310f, BCDDevice: 0x0
VID = 0x8087, PID = 0xaa7, BCDDevice: 0x1
VID = 0x20b1, PID = 0x8, BCDDevice: 0x6f2
XMOS DFU application started - Interface 3 claimed
Detaching device from application mode.
Waiting for device to restart and enter DFU mode...
VID = 0x1d6b, PID = 0x3, BCDDevice: 0x415
VID = 0x2386, PID = 0x310f, BCDDevice: 0x0
VID = 0x8087, PID = 0xaa7, BCDDevice: 0x1
VID = 0x20b1, PID = 0x8, BCDDevice: 0x6f2
Error claiming interface 0
Another program or driver has claimed the interface

Re: DFU fails - "Error claiming interface 0", in Ubuntu 18.04

Posted: Wed Nov 27, 2019 3:14 pm
by mon2
Hi. Please confirm that you are using the latest stable version of libusb. The 1.0.0 is older release so that may be an issue.

Re: DFU fails - "Error claiming interface 0", in Ubuntu 18.04

Posted: Wed Nov 27, 2019 9:08 pm
by rgilio
I've seen the interface issue before when I was running XTIME Composer alongside attempting DFU in the past. Make sure that you are not actively trying to run the debugger or have any other type of connection to the XMOS device when trying to perform DFU.

The "Another program or driver has claimed the interface" issue means something else currently is using the USB connection on the device.

(Edit) Forgot to mention that I'm also running Ubuntu 18.04