USB descriptor

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
ratin3@gmail.com
Member++
Posts: 17
Joined: Fri Nov 15, 2024 2:40 am

USB descriptor

Post by ratin3@gmail.com »

I am using the XK-316-MC-AB USB audio board on Linux and I noticed there is a USB interface descriptor that gets sent from XMOS XCore.ai device which is categorized as "Device Firmware Update" - can that interface be used somehow to send a. *xe file to update the device FW (i.e. uploaded and burnt into the EEPROM)?

Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 254 Application Specific Interface
bInterfaceSubClass 1 Device Firmware Update
bInterfaceProtocol 1
iInterface 10
Device Firmware Upgrade Interface Descriptor:
bLength 9
bDescriptorType 33
bmAttributes 7
Will Not Detach
Manifestation Tolerant
Upload Supported
Download Supported
wDetachTimeout 250 milliseconds
wTransferSize 64 bytes
bcdDFUVersion 1.10
MaximLiadov
XCore Addict
Posts: 179
Joined: Mon Apr 16, 2018 9:14 am

Post by MaximLiadov »

1. First, you need to create a .bin file from the .xe. The xflash utility with the --upgrade key may help here. Use the -o key to save to a file.
2. Linux guide which works for me: https://www.xcore.com/viewtopic.php?p=30699#p30699
You do not have the required permissions to view the files attached to this post.
ratin3@gmail.com
Member++
Posts: 17
Joined: Fri Nov 15, 2024 2:40 am

Post by ratin3@gmail.com »

Hi Maxim, Thank you for your reply, I was able to build DFU loader but I am having issues converting .xe to a .bin:

~/XMOS/sw_usb_audio/app_usb_aud_xk_316_mc/bin/2AMi8o8xxxxxx$ xflash --noinq --factory-version 15.0 --upgrade 0x0530 app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.xe -o app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.bin
target-xn-v1328-d141c2a6:9 Error: XN11099 Package type "XS3-UnA-1024-TQ128" cannot be resolved to a package file.

I get the same error message when I run xflash to update the EEPROM directly over JTAG. But I dont see this error when I run the .xe using xrun. Any idea? xk-audio-316-mc.xn is the xn file that was used during build of app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.xe .
ratin3@gmail.com
Member++
Posts: 17
Joined: Fri Nov 15, 2024 2:40 am

Post by ratin3@gmail.com »

update:
I tried to specify the target with --target XS3-UnA-1024-TQ128 argument as suggested by the author in this post: https://www.xcore.com/viewtopic.php?t=6968 but still no luck
ratin3@gmail.com
Member++
Posts: 17
Joined: Fri Nov 15, 2024 2:40 am

Post by ratin3@gmail.com »

ratin3@gmail.com wrote: Thu Jan 23, 2025 1:08 am Hi Maxim, Thank you for your reply! I was able to build DFU loader but I am having issues converting .xe to a .bin:

~/XMOS/sw_usb_audio/app_usb_aud_xk_316_mc/bin/2AMi8o8xxxxxx$ xflash --noinq --factory-version 15.0 --upgrade 0x0530 app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.xe -o app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.bin
target-xn-v1328-d141c2a6:9 Error: XN11099 Package type "XS3-UnA-1024-TQ128" cannot be resolved to a package file.

I get the same error message when I run xflash to update the EEPROM directly over JTAG. But I dont see this error when I run the .xe using xrun. Any idea? xk-audio-316-mc.xn is the xn file that was used during build of app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.xe .
MaximLiadov
XCore Addict
Posts: 179
Joined: Mon Apr 16, 2018 9:14 am

Post by MaximLiadov »

It might be an installation/path issue?
https://www.xmos.com/documentation/XM-0 ... et-started
https://www.xmos.com/documentation/XM-0 ... -variables
You can try to add --verbose for a detailed log.
User avatar
fabriceo
XCore Addict
Posts: 246
Joined: Mon Jan 08, 2018 4:14 pm

Post by fabriceo »

Hi
I think the ""--target XS3-UnA-1024-TQ128" is fine, but you are launching xflash from the "bin" folder, so it is not "visible"
I would launch the xflash from the upper (application) folder and make sure the .xn file is visible in this folder, otherwise explicit after the --target
MaximLiadov
XCore Addict
Posts: 179
Joined: Mon Apr 16, 2018 9:14 am

Post by MaximLiadov »

For Linux, I would make sure to run this command once, as it was in the guide:
Open a Terminal window, change to the installation directory and enter the following command:
$ source SetEnv
ratin3@gmail.com
Member++
Posts: 17
Joined: Fri Nov 15, 2024 2:40 am

Post by ratin3@gmail.com »

I tried a few things. Sourcing SetEnv is always done.
I ran from app folder and specified the target file and it seems to go forward but complained about boot partition size:

$ xflash --noinq --target-file src/core/xk-audio-316-mc.xn bin/2AMi8o8xxxxxx/app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.xe -o app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.bin
Error: F03093 Cannot set boot partition size: no explicit boot partition size and no inquirer used.
By default the boot partition occupies the whole flash device but the flash device
size cannot be determined because the inquirer has been disabled. To fix this either
allow the inquirer to run (remove --noinq) or explicitly specify the boot partition size
with --boot-partition-size.

if I take out the --noinq option then it cant find the target (:

$ xflash --target-file src/core/xk-audio-316-mc.xn bin/2AMi8o8xxxxxx/app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.xe -o app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.bin
xcc: error: unknown target `XU316-1024-FB265-C32'
Supported targets:

Additional targets can be provided in the the directory %HOMEPATH%\.xmos\targets on Windows hosts and in the directory $HOME/.xmos/targets on Mac and Linux hosts.

Alternatively a target XN file may be supplied on the command line.
Error: F03010 Failed to compile second stage bootloader
ratin@ratin-ubuntu23:~/XMOS/sw_usb_audio/app_usb_aud_xk_316_mc$ xflash --noinq --target-file src/core/xk-audio-316-mc.xn bin/2AMi8o8xxxxxx/app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.xe -o app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.bin
Error: F03093 Cannot set boot partition size: no explicit boot partition size and no inquirer used.
By default the boot partition occupies the whole flash device but the flash device
size cannot be determined because the inquirer has been disabled. To fix this either
allow the inquirer to run (remove --noinq) or explicitly specify the boot partition size
with --boot-partition-size.

Even when a folder by that name exists in the targets folder
$pwd
/home/ratin/XMOS/XTC/15.3.0/targets/XU316-1024-FB265-C32
ratin3@gmail.com
Member++
Posts: 17
Joined: Fri Nov 15, 2024 2:40 am

Post by ratin3@gmail.com »

Update: I believe this program parses the args based on argument index and I stuck a --verbose option (it doesnt print extensive info like on Windows btw), it seems to parse the target file - but came up with the same error that boot partition size can't be set. I wanted to see what boot-partition-size I could explicitly set taking info from Windows side but this info does not get printed unfortunately.

/XMOS/sw_usb_audio/app_usb_aud_xk_316_mc$ xflash --verbose --noinq --target-file src/core/xk-audio-316-mc.xn bin/2AMi8o8xxxxxx/app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.xe -o app_usb_aud_xk_316_mc_2AMi8o8xxxxxx.bin
XFlash_Application found _start :80000 on Node 0
XFlash_Application found _DoSyscall :87690 on Node 0
XFlash_Application found _DoException :800c4 on Node 0
XFlash_Application found _start :80000 on Node 0
XFlash_Application found _DoSyscall :81f28 on Node 0
XFlash_Application found _DoException :800c4 on Node 0
XFlash::DoXFlash
XFlash::DoImageProgramming
XFlash::GetDeviceInfo
XFlash_DeviceInfo::GetDeviceInfo_User
Error: F03093 Cannot set boot partition size: no explicit boot partition size and no inquirer used.
By default the boot partition occupies the whole flash device but the flash device
size cannot be determined because the inquirer has been disabled. To fix this either
allow the inquirer to run (remove --noinq) or explicitly specify the boot partition size
with --boot-partition-size.