Adapting SW_USB_Audio to custom platform

Discussions about USB Audio on XMOS devices
youpko
Newbie
Posts: 1
Joined: Wed Aug 20, 2025 10:09 am

Adapting SW_USB_Audio to custom platform

Post by youpko »

I want to make an USB to TDM bridge with 4x Stereo-In/4x Stereo-Out.
I still had an xCore-200 Explorer dev kit in the back of the closet I decided to test my idea. But this is my first time using an XMOS device. as when I bought the dev kit things changed and never got around to play with it. The custom board will use one of the newer XMOS devices but didn't feel like spending money just to test the idea.

With the help of all the documentation I installed the toolchain vscode and the sw_usb_audio project. But the later doesn't have support for my dev kit of course as it has no audio hardware on board, but for me that is fine I just want I2S/TDM out to hook up to the logic analyzer.
So I started write my adaption by writing the custom .xn file and the xua_conf.h file to start simple I set 2 channels in and 2 channels out, and copied the relevant information from sw_usb_audio. Here I ran into an warning and issue.
While compiling this warning pops up:

Code: Select all

[ 76%] Building C object CMakeFiles/USB_UAC2-Interface.dir/E_/ProjectsIdea/xmos/lib_xud/lib_xud/src/user/client/XUD_EpFunctions.c.obj
E:/ProjectsIdea/xmos/lib_xud/lib_xud/src/user/client/XUD_EpFunctions.c:187:52: warning: incompatible integer to pointer conversion passing 'volatile unsigned int' to parameter of type 'unsigned char *' [-Wint-conversion]
        XUD_Result_t res = XUD_GetBuffer_Start(ep, ep->buffer);
                                                   ^~~~~~~~~~
E:/ProjectsIdea/xmos/lib_xud/lib_xud/src/user/client/XUD_EpFunctions.c:102:88: note: passing argument to parameter 'buffer' here
static inline XUD_Result_t XUD_GetBuffer_Start(volatile XUD_ep_info *ep, unsigned char buffer[])
                                                                                       ^
E:/ProjectsIdea/xmos/lib_xud/lib_xud/src/user/client/XUD_EpFunctions.c:584:32: warning: incompatible pointer to integer conversion passing 'volatile XUD_ep_info *' (aka 'volatile struct XUD_ep_info *') to parameter of type 'XUD_ep' (aka 'unsigned int') [-Wint-conversion]
    return XUD_SetBuffer_Start(ep, buffer, len);
                               ^~
E:/ProjectsIdea/xmos/lib_xud/lib_xud/src/user/client/XUD_EpFunctions.c:398:41: note: passing argument to parameter 'e' here
XUD_Result_t XUD_SetBuffer_Start(XUD_ep e, unsigned char buffer[], unsigned datalength)
                                        ^
E:/ProjectsIdea/xmos/lib_xud/lib_xud/src/user/client/XUD_EpFunctions.c:661:32: warning: incompatible pointer to integer conversion passing 'volatile XUD_ep_info *' (aka 'volatile struct XUD_ep_info *') to parameter of type 'XUD_ep' (aka 'unsigned int') [-Wint-conversion]
    return XUD_SetBuffer_Start(ep, (unsigned char *) addr, len);
                               ^~
E:/ProjectsIdea/xmos/lib_xud/lib_xud/src/user/client/XUD_EpFunctions.c:398:41: note: passing argument to parameter 'e' here
XUD_Result_t XUD_SetBuffer_Start(XUD_ep e, unsigned char buffer[], unsigned datalength)
                                        ^
E:/ProjectsIdea/xmos/lib_xud/lib_xud/src/user/client/XUD_EpFunctions.c:296:44: warning: unused function 'XUD_initialise_OUT_transfer' [-Wunused-function]
__attribute__((always_inline)) static void XUD_initialise_OUT_transfer(XUD_ep_info * ep, unsigned char buffer[])
                                           ^
E:/ProjectsIdea/xmos/lib_xud/lib_xud/src/user/client/XUD_EpFunctions.c:539:44: warning: unused function 'XUD_initialise_IN_transfer' [-Wunused-function]
__attribute__((always_inline)) static void XUD_initialise_IN_transfer(XUD_ep_info * ep, unsigned char buffer[], unsigned datalength)
                                           ^
5 warnings generated.
The issue has to do with DFU, I couldn't figure this out, but this has no priority for me now so I disabled DFU by setting XUA_DFU_EN to 0.

Code: Select all

[ 22%] Linking CXX executable E:/ProjectsIdea/xmos/USB_UAC2-Interface/bin/USB_UAC2-Interface.xe
flashlib_user.c: Error: Undefined reference to 'fl_connect'
flash_interface.c: Error: Undefined reference to 'fl_deleteImage'
flashlib_user.c: Warning: Undefined reference to 'fl_disconnect'
flash_interface.c: Error: Undefined reference to 'fl_endWriteImage'
flash_interface.c: Error: Undefined reference to 'fl_getFactoryImage'
flash_interface.c: Error: Undefined reference to 'fl_getNextBootImage'
flash_interface.c: Error: Undefined reference to 'fl_readImagePage'
flash_interface.c: Error: Undefined reference to 'fl_startImageAdd'
flash_interface.c: Error: Undefined reference to 'fl_startImageRead'
flash_interface.c: Error: Undefined reference to 'fl_writeImagePage'
After that I got the compiled binary and uploaded it to the device. And the Windows host recognizes sometimes and when it does stuff goes weird. I assume I made an error somewhere in my port. As you can see in the image below the "volume" bar to the right is missing in windows. But no errors pop up in the device manager. Test sound doesn't work.
mmc_TO7c5qKcny.png
This seemed very strange to me so I made a USB capture with Wireguard. There I noticed that the enumeration goes ok, initial setup seems to go ok as well, it goes haywire when the interface has to be set. As the Set Interface Request and the Response just keep going and going indefinitely until I pull the USB cable form the pc.

Code: Select all

No.	Time	Source	Destination	Protocol	Length	Info
19332	199.480680	5.9.1	host	USB			27	URB_INTERRUPT in
19333	811.175257	host	5.9.1	USB			27	URB_INTERRUPT in
19334	811.296192	5.9.1	host	USB			28	URB_INTERRUPT in
19335	811.296314	host	5.9.1	USB			27	URB_INTERRUPT in
19336	811.345751	host	5.64.0	USB			36	GET DESCRIPTOR Request DEVICE
19337	811.345830	5.64.0	host	USB			46	GET DESCRIPTOR Response DEVICE
19338	811.345854	host	5.64.0	USB			36	GET DESCRIPTOR Request CONFIGURATION
19339	811.345880	5.64.0	host	USB			37	GET DESCRIPTOR Response CONFIGURATION
19340	811.345890	host	5.64.0	USB			36	GET DESCRIPTOR Request CONFIGURATION
19341	811.345947	5.64.0	host	USB			343	GET DESCRIPTOR Response CONFIGURATION
19342	811.347045	host	5.64.0	USB			36	SET CONFIGURATION Request
19343	811.347155	5.64.0	host	USB			28	SET CONFIGURATION Response
19344	811.347186	host	5.64.0	USB			27	Unknown type 7f
19345	811.347188	5.64.0	host	USB			27	Unknown type 7f
19346	811.347190	host	5.64.0	USB			27	Unknown type 7f
19347	811.347191	5.64.0	host	USB			27	Unknown type 7f
19348	811.347524	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19349	811.347580	5.64.0	host	USB			32	GET DESCRIPTOR Response STRING
19350	811.347594	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19351	811.347625	5.64.0	host	USB			82	GET DESCRIPTOR Response STRING
19352	811.351810	host	5.64.0	USB			36	GET STATUS Request
19353	811.351853	5.64.0	host	USB			30	GET STATUS Response
19354	811.351903	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19355	811.351930	5.64.0	host	USB			32	GET DESCRIPTOR Response STRING
19356	811.351946	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19357	811.351985	5.64.0	host	USB			30	GET DESCRIPTOR Response STRING
19358	811.351994	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19359	811.352021	5.64.0	host	USB			82	GET DESCRIPTOR Response STRING
19360	811.352124	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19361	811.352156	5.64.0	host	USB			30	GET DESCRIPTOR Response STRING
19362	811.352166	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19363	811.352218	5.64.0	host	USB			82	GET DESCRIPTOR Response STRING
19364	811.352270	host	5.64.0	USBAUDIO	36	GET RANGE request
19365	811.352307	5.64.0	host	USBAUDIO	36	GET RANGE response
19366	811.352331	host	5.64.0	USBAUDIO	36	GET RANGE request
19367	811.352358	5.64.0	host	USBAUDIO	36	GET RANGE response
19368	811.352376	host	5.64.0	USBAUDIO	36	GET RANGE request
19369	811.352401	5.64.0	host	USBAUDIO	36	GET RANGE response
19370	811.352415	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19371	811.352448	5.64.0	host	USB			30	GET DESCRIPTOR Response STRING
19372	811.352457	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19373	811.352487	5.64.0	host	USB			82	GET DESCRIPTOR Response STRING
19374	811.352526	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19375	811.352560	5.64.0	host	USB			30	GET DESCRIPTOR Response STRING
19376	811.352572	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19377	811.352608	5.64.0	host	USB			82	GET DESCRIPTOR Response STRING
19378	811.352624	host	5.64.0	USBAUDIO	36	GET RANGE request
19379	811.352653	5.64.0	host	USBAUDIO	36	GET RANGE response
19380	811.352661	host	5.64.0	USBAUDIO	36	GET RANGE request
19381	811.352693	5.64.0	host	USBAUDIO	36	GET RANGE response
19382	811.352707	host	5.64.0	USBAUDIO	36	GET RANGE request
19383	811.352739	5.64.0	host	USBAUDIO	36	GET RANGE response
19384	811.352759	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19385	811.352791	5.64.0	host	USB			30	GET DESCRIPTOR Response STRING
19386	811.352801	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19387	811.352834	5.64.0	host	USB			68	GET DESCRIPTOR Response STRING
19388	811.352846	host	5.64.0	USBAUDIO	36	GET CUR CX_CLOCK_SELECTOR_CONTROL request
19389	811.352880	5.64.0	host	USBAUDIO	29	GET CUR CX_CLOCK_SELECTOR_CONTROL response
19390	811.352895	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19391	811.352925	5.64.0	host	USB			30	GET DESCRIPTOR Response STRING
19392	811.352937	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19393	811.352974	5.64.0	host	USB			68	GET DESCRIPTOR Response STRING
19394	811.352998	host	5.64.0	USBAUDIO	36	GET RANGE CS_SAM_FREQ_CONTROL request
19395	811.353043	5.64.0	host	USBAUDIO	102	GET RANGE CS_SAM_FREQ_CONTROL response
19396	811.353067	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19397	811.353102	5.64.0	host	USB			30	GET DESCRIPTOR Response STRING
19398	811.353114	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19399	811.353145	5.64.0	host	USB			82	GET DESCRIPTOR Response STRING
19400	811.353164	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19401	811.353205	5.64.0	host	USB			30	GET DESCRIPTOR Response STRING
19402	811.353214	host	5.64.0	USB			36	GET DESCRIPTOR Request STRING
19403	811.353247	5.64.0	host	USB			82	GET DESCRIPTOR Response STRING
19404	811.358965	host	5.64.0	USBAUDIO	36	GET CUR request
19405	811.359009	5.64.0	host	USBAUDIO	30	GET CUR response
19406	811.359737	host	5.64.0	USBAUDIO	36	GET CUR request
19407	811.359776	5.64.0	host	USBAUDIO	29	GET CUR response
19408	811.360486	host	5.64.0	USBAUDIO	36	GET CUR request
19409	811.360538	5.64.0	host	USBAUDIO	30	GET CUR response
19410	811.361248	host	5.64.0	USBAUDIO	36	GET CUR request
19411	811.361291	5.64.0	host	USBAUDIO	29	GET CUR response
19412	811.377209	host	5.64.0	USBAUDIO	36	GET CUR request
19413	811.377259	5.64.0	host	USBAUDIO	30	GET CUR response
19414	811.377997	host	5.64.0	USBAUDIO	36	GET CUR request
19415	811.378050	5.64.0	host	USBAUDIO	29	GET CUR response
19416	811.378695	host	5.64.0	USBAUDIO	36	GET CUR request
19417	811.378737	5.64.0	host	USBAUDIO	30	GET CUR response
19418	811.378922	host	5.64.0	USBAUDIO	36	GET CUR request
19419	811.378976	5.64.0	host	USBAUDIO	29	GET CUR response
19420	811.529240	host	5.64.0	USBAUDIO	36	GET CUR request
19421	811.529292	5.64.0	host	USBAUDIO	30	GET CUR response
19422	811.530061	host	5.64.0	USBAUDIO	36	GET CUR request
19423	811.530104	5.64.0	host	USBAUDIO	29	GET CUR response
19424	811.531180	host	5.64.0	USBAUDIO	36	GET CUR request
19425	811.531223	5.64.0	host	USBAUDIO	30	GET CUR response
19426	811.531564	host	5.64.0	USBAUDIO	36	GET CUR request
19427	811.531612	5.64.0	host	USBAUDIO	29	GET CUR response
19428	811.584217	host	5.64.0	USBAUDIO	36	GET CUR request
19429	811.584283	5.64.0	host	USBAUDIO	30	GET CUR response
19430	811.584378	host	5.64.0	USBAUDIO	36	GET CUR request
19431	811.584420	5.64.0	host	USBAUDIO	29	GET CUR response
19432	811.584502	host	5.64.0	USBAUDIO	36	GET CUR request
19433	811.584532	5.64.0	host	USBAUDIO	30	GET CUR response
19434	811.584616	host	5.64.0	USBAUDIO	36	GET CUR request
19435	811.584644	5.64.0	host	USBAUDIO	29	GET CUR response
19436	811.598886	host	5.64.0	USBAUDIO	36	GET CUR request
19437	811.598934	5.64.0	host	USBAUDIO	30	GET CUR response
19438	811.599018	host	5.64.0	USBAUDIO	36	GET CUR request
19439	811.599048	5.64.0	host	USBAUDIO	29	GET CUR response
19440	811.599134	host	5.64.0	USBAUDIO	36	GET CUR request
19441	811.599169	5.64.0	host	USBAUDIO	30	GET CUR response
19442	811.599281	host	5.64.0	USBAUDIO	36	GET CUR request
19443	811.599323	5.64.0	host	USBAUDIO	29	GET CUR response
19444	811.600100	host	5.64.0	USB			36	SET INTERFACE Request
19445	816.617042	5.64.0	host	USB			28	SET INTERFACE Response
19446	816.617091	host	5.64.0	USB			27	Unknown type 7f
19447	816.617094	5.64.0	host	USB			27	Unknown type 7f
19448	816.617106	host	5.64.0	USB	36	SET INTERFACE Request
19449	816.621660	5.64.0	host	USB	28	SET INTERFACE Response
19450	816.622342	host	5.64.0	USB	36	SET INTERFACE Request
19451	816.629732	5.64.0	host	USB	28	SET INTERFACE Response
19452	816.632564	host	5.64.0	USB	36	SET INTERFACE Request
19453	816.639934	5.64.0	host	USB	28	SET INTERFACE Response
19454	816.640341	host	5.64.0	USB	36	SET INTERFACE Request
19455	816.647703	5.64.0	host	USB	28	SET INTERFACE Response
19456	816.648137	host	5.64.0	USB	36	SET INTERFACE Request
19457	816.655483	5.64.0	host	USB	28	SET INTERFACE Response
19458	816.655878	host	5.64.0	USB	36	SET INTERFACE Request
19459	816.663224	5.64.0	host	USB	28	SET INTERFACE Response
19460	816.663641	host	5.64.0	USB	36	SET INTERFACE Request
19461	816.671002	5.64.0	host	USB	28	SET INTERFACE Response
19462	816.671387	host	5.64.0	USB	36	SET INTERFACE Request
19463	816.678773	5.64.0	host	USB	28	SET INTERFACE Response
19464	816.681042	host	5.64.0	USB	36	SET INTERFACE Request
19465	816.688464	5.64.0	host	USB	28	SET INTERFACE Response
19466	816.688912	host	5.64.0	USB	36	SET INTERFACE Request
19467	816.696334	5.64.0	host	USB	28	SET INTERFACE Response
19468	816.698083	host	5.64.0	USB	36	SET INTERFACE Request
19469	816.705475	5.64.0	host	USB	28	SET INTERFACE Response
19470	816.706035	host	5.64.0	USB	36	SET INTERFACE Request
19471	816.713497	5.64.0	host	USB	28	SET INTERFACE Response
19472	816.714187	host	5.64.0	USB	36	SET INTERFACE Request
19473	816.721548	5.64.0	host	USB	28	SET INTERFACE Response
19474	816.721953	host	5.64.0	USB	36	SET INTERFACE Request
19475	816.729360	5.64.0	host	USB	28	SET INTERFACE Response
19476	816.730029	host	5.64.0	USB	36	SET INTERFACE Request
19477	816.737431	5.64.0	host	USB	28	SET INTERFACE Response
19478	816.738124	host	5.64.0	USB	36	SET INTERFACE Request
19479	816.745455	5.64.0	host	USB	28	SET INTERFACE Response
19480	816.747545	host	5.64.0	USB	36	SET INTERFACE Request
19481	816.754882	5.64.0	host	USB	28	SET INTERFACE Response
19482	816.755658	host	5.64.0	USB	36	SET INTERFACE Request
19483	816.763017	5.64.0	host	USB	28	SET INTERFACE Response
19484	816.765793	host	5.64.0	USB	36	SET INTERFACE Request
19485	816.773350	5.64.0	host	USB	28	SET INTERFACE Response
19486	816.773951	host	5.64.0	USB	36	SET INTERFACE Request
19487	816.781323	5.64.0	host	USB	28	SET INTERFACE Response
19488	816.781718	host	5.64.0	USB	36	SET INTERFACE Request
19489	816.789090	5.64.0	host	USB	28	SET INTERFACE Response
19490	816.789484	host	5.64.0	USB	36	SET INTERFACE Request
19491	816.797023	5.64.0	host	USB	28	SET INTERFACE Response
19492	816.797445	host	5.64.0	USB	36	SET INTERFACE Request
19493	816.804788	5.64.0	host	USB	28	SET INTERFACE Response
19494	816.805191	host	5.64.0	USB	36	SET INTERFACE Request
19495	816.812568	5.64.0	host	USB	28	SET INTERFACE Response
19496	816.814810	host	5.64.0	USB	36	SET INTERFACE Request
19497	816.822622	5.64.0	host	USB	28	SET INTERFACE Response
19498	816.822670	host	5.64.0	USB	36	SET INTERFACE Request
19499	816.830498	5.64.0	host	USB	28	SET INTERFACE Response
19500	816.830741	host	5.64.0	USB	36	SET INTERFACE Request
19501	816.838658	5.64.0	host	USB	28	SET INTERFACE Response
19502	816.838741	host	5.64.0	USB	36	SET INTERFACE Request
19503	816.846534	5.64.0	host	USB	28	SET INTERFACE Response
19504	816.846890	host	5.64.0	USB	36	SET INTERFACE Request
19505	816.854749	5.64.0	host	USB	28	SET INTERFACE Response
19506	816.855060	host	5.64.0	USB	36	SET INTERFACE Request
19507	816.862821	5.64.0	host	USB	28	SET INTERFACE Response
19508	816.862874	host	5.64.0	USB	36	SET INTERFACE Request
19509	816.870630	5.64.0	host	USB	28	SET INTERFACE Response
19510	816.870866	host	5.64.0	USB	36	SET INTERFACE Request
19511	816.878631	5.64.0	host	USB	28	SET INTERFACE Response
19512	816.878674	host	5.64.0	USB	36	SET INTERFACE Request


The following file I have in my custom project:
CMakeLists.txt

Code: Select all

cmake_minimum_required(VERSION 3.21)
include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake)
project(USB_UAC2-Interface)

#set(APP_HW_TARGET XCORE-200-EXPLORER)
set(APP_HW_TARGET xcore-200.xn)


set(SW_USB_AUDIO_FLAGS ${EXTRA_BUILD_FLAGS} -O0
                                            -report
                                            -lquadflash
                                            -g
                                            -fxscope
                                            #-DBOARD_SUPPORT_BOARD=XK_AUDIO_216_MC_AB
                                            #-DADAT_TX_USE_SHARED_BUFF=1
                                            )


set(APP_INCLUDES src src/core src/extensions) 

set(APP_DEPENDENT_MODULES "lib_xua")
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/..)

XMOS_REGISTER_APP()
src/core/xcore-200.xn

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<Network xmlns="http://www.xmos.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xmos.com http://www.xmos.com">

    <Type>Board</Type>
    <Name>xCORE-200 Explorer Audio</Name>
    <Declarations>
        <Declaration>tileref tile[2]</Declaration>
        <Declaration>tileref usb_tile</Declaration>
    </Declarations>

    <Packages>
        <Package id="0" Type="XS2-UnA-512-TQ128">
            <Nodes>
                <Node Id="0" InPackageId="0" Type="XS2-L16A-512" Oscillator="24MHz" SystemFrequency="500MHz" referencefrequency="100MHz">
                    <Tile Number="0" Reference="tile[0]">
                        <!-- Audio Ports -->         
                        <Port Location="XS1_PORT_1A" Name="PORT_PLL_REF" />
                        <Port Location="XS1_PORT_1F" Name="PORT_MCLK_IN" />
                        <Port Location="XS1_PORT_1G" Name="PORT_I2S_LRCLK" />
                        <Port Location="XS1_PORT_1H" Name="PORT_I2S_BCLK" />
                        <Port Location="XS1_PORT_1M" Name="PORT_I2S_DAC0" />
                        <port Location="XS1_PORT_1N" Name="PORT_I2S_DAC1" />
                        <port Location="XS1_PORT_1O" Name="PORT_I2S_DAC2" />
                        <port Location="XS1_PORT_1P" Name="PORT_I2S_DAC3" />
                        <Port Location="XS1_PORT_1I" Name="PORT_I2S_ADC0" />
                        <Port Location="XS1_PORT_1J" Name="PORT_I2S_ADC1" />
                        <Port Location="XS1_PORT_1K" Name="PORT_I2S_ADC2" />
                        <Port Location="XS1_PORT_1L" Name="PORT_I2S_ADC3" />
                        <Port Location="XS1_PORT_4A" Name="PORT_I2C" />
                        <Port Location="XS1_PORT_1M" Name="PORT_DSD_DAC0" />
                        <port Location="XS1_PORT_1N" Name="PORT_DSD_DAC1" />
                        <Port Location="XS1_PORT_1G" Name="PORT_DSD_CLK" />
                        <Port Location="XS1_PORT_1E" Name="PORT_ADAT_OUT" />--> <!-- D: COAX E: OPT --> 
                        <Port Location="XS1_PORT_1D" Name="PORT_SPDIF_OUT" />--> <!-- D: COAX E: OPT -->
                    </Tile>
                    <Tile Number="1" Reference="tile[1]">
                        <Port Location="XS1_PORT_1H" Name="PORT_USB_TX_READYIN" />
                        <Port Location="XS1_PORT_1J" Name="PORT_USB_CLK" />
                        <Port Location="XS1_PORT_1K" Name="PORT_USB_TX_READYOUT" />
                        <Port Location="XS1_PORT_1I" Name="PORT_USB_RX_READY" />
                        <Port Location="XS1_PORT_1E" Name="PORT_USB_FLAG0" />
                        <Port Location="XS1_PORT_1F" Name="PORT_USB_FLAG1" />
                        <Port Location="XS1_PORT_1G" Name="PORT_USB_FLAG2" />
                        <Port Location="XS1_PORT_8A" Name="PORT_USB_TXD" />
                        <Port Location="XS1_PORT_8B" Name="PORT_USB_RXD" />

                        <!-- Ports for USB feedback calculation --> 
                        <Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT" />              
                        <Port Location="XS1_PORT_1L" Name="PORT_MCLK_IN_USB" />
                        <!-- Audio Ports -->
                        <Port Location="XS1_PORT_1M" Name="PORT_MIDI_IN" />
                        <Port Location="XS1_PORT_1N" Name="PORT_MIDI_OUT" />
                        <Port Location="XS1_PORT_1O" Name="PORT_ADAT_IN" />--> <!-- P: COAX O: OPT --> 
                        <Port Location="XS1_PORT_1P" Name="PORT_SPDIF_IN" />--> <!-- P: COAX O: OPT -->
                    </Tile>
                </Node>
                <Node Id="1" InPackageId="1" Type="periph:XS1-SU" Reference="usb_tile" Oscillator="24MHz">
                </Node>
            </Nodes>
            <Links>
                <Link Encoding="5wire">
                    <LinkEndpoint NodeId="0" Link="8" Delays="52clk,52clk" />
                    <LinkEndpoint NodeId="1" Link="XL0" Delays="1clk,1clk" />
                </Link>
            </Links>
        </Package>
    </Packages>

    <JTAGChain>
        <JTAGDevice NodeId="0" />
    </JTAGChain>

</Network>
src/core/xua_conf.h

Code: Select all

// Copyright 2012-2025 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
/**
 * @file       xua_conf.h
 * @brief      Defines relating to device configuration and customisation.
 *             For xCORE-200 Audio MC Board
 * @author     Ross Owen, XMOS Limited
 */
#ifndef _XUA_CONF_H_
#define _XUA_CONF_H_

#ifndef __ASSEMBLER__
#include <platform.h>
#endif
//#include "../../../shared/version.h"

/*
 * Device configuration option defines to override default defines found in lib_xua/api/xua_conf_default.h
 *
 * Build can be customised but changing and adding defines here
 *
 * Note, we check if they are already defined in Makefile
 */

/*** Defines relating to basic functionality ***/
/* Enable/Disable MIDI - Default is MIDI off */
#ifndef MIDI
#define MIDI               (0)
#endif

/* Enable/Disable S/PDIF output - Default is S/PDIF off */
#ifndef XUA_SPDIF_TX_EN
#define XUA_SPDIF_TX_EN	   (0)
#endif

/* Enable/Disable S/PDIF input - Default is S/PDIF off */
#ifndef XUA_SPDIF_RX_EN
#define XUA_SPDIF_RX_EN    (0)
#endif

/* Enable/Disable ADAT output - Default is ADAT off */
#ifndef XUA_ADAT_TX_EN
#define XUA_ADAT_TX_EN     (0)
#endif

/* Enable/Disable ADAT input - Default is ADAT off */
#ifndef XUA_ADAT_RX_EN
#define XUA_ADAT_RX_EN     (0)
#endif

/* Enable/Disable Mixing core(s) - Default is on */
#ifndef MIXER
#define MIXER              (0)
#endif

/* Set the number of mixes to perform - Default is 0 i.e mixing disabled */
#ifndef MAX_MIX_COUNT
#define MAX_MIX_COUNT      (0)
#endif

/* Audio Class version - Default is 2.0 */
#ifndef AUDIO_CLASS
#define AUDIO_CLASS        (2)
#endif

/*** Defines relating to channel counts ***/
/* Number of I2S channels to DACs*/
#ifndef I2S_CHANS_DAC
#define I2S_CHANS_DAC      (2)
#endif

/* Number of I2S channels from ADCs */
#ifndef I2S_CHANS_ADC
#define I2S_CHANS_ADC      (2)
#endif

/* Set TDM Mode */
// #ifndef XUA_PCM_FORMAT
// #define XUA_PCM_FORMAT     (XUA_PCM_FORMAT_TDM)
// #endif

/* Set TDM master/slave (xcore master / Codec Slave) */
// #ifndef CODEC_MASTER
// #define CODEC_MASTER       (0) 
// #endif

/* Set TDM word length */
// #ifndef XUA_I2S_N_BITS
// #define XUA_I2S_N_BITS     (32) 
// #endif

//#define OUTPUT_FORMAT_COUNT (1)
//#define INPUT_FORMAT_COUNT (1)

/* TODO: Fix DFU Linker error */
//#ifndef XUA_QUAD_SPI_FLASH
//#define XUA_QUAD_SPI_FLASH         (1) 
//#endif
#ifndef XUA_DFU_EN
#define XUA_DFU_EN         (0) 
#endif

/* Number of USB streaming channels - by default calculate by counting audio interfaces */
#ifndef NUM_USB_CHAN_IN
#define NUM_USB_CHAN_IN    (I2S_CHANS_ADC + 2*XUA_SPDIF_RX_EN + 8*XUA_ADAT_RX_EN)  /* Device to Host */
#endif

#ifndef NUM_USB_CHAN_OUT
#define NUM_USB_CHAN_OUT   (I2S_CHANS_DAC + 2*XUA_SPDIF_TX_EN + 8*XUA_ADAT_TX_EN)  /* Host to Device */
#endif

/*** Defines relating to channel arrangement/indices ***/
/* Channel index of S/PDIF Tx channels: separate channels after analogue channels (if they fit) */
#ifndef SPDIF_TX_INDEX
    #if (I2S_CHANS_DAC + 2*XUA_SPDIF_TX_EN) <= NUM_USB_CHAN_OUT
        #define SPDIF_TX_INDEX   (I2S_CHANS_DAC)
    #else
        #define SPDIF_TX_INDEX   (0)
    #endif
#endif

/* Channel index of S/PDIF Rx channels: separate channels after analogue channels */
#ifndef SPDIF_RX_INDEX
#define SPDIF_RX_INDEX     (I2S_CHANS_ADC)
#endif

/* Channel index of ADAT Tx channels: separate channels after S/PDIF channels (if they fit) */
#ifndef ADAT_TX_INDEX
    #define ADAT_TX_INDEX    (I2S_CHANS_DAC + 2*XUA_SPDIF_TX_EN)
#endif

/* Channel index of ADAT Rx channels: separate channels after S/PDIF channels */
#ifndef ADAT_RX_INDEX
#define ADAT_RX_INDEX      (I2S_CHANS_ADC + 2*XUA_SPDIF_RX_EN)
#endif

/*** Defines relating to audio frequencies ***/
/* Master clock defines (in Hz) */
#ifndef MCLK_441
#define MCLK_441           (256*44100)   /* 44.1, 88.2 etc */
#endif

#ifndef MCLK_48
#define MCLK_48            (256*48000)   /* 48, 96 etc */
#endif

/* Maximum frequency device runs at */
#ifndef MAX_FREQ
#define MAX_FREQ           (192000)
#endif

/*** Defines relating to feature placement regarding tiles ***/
#define AUDIO_IO_TILE      (0)
#define PLL_REF_TILE       (0)

#define XUD_TILE           (1)
#define MIDI_TILE          (1)

/*** Defines relating to USB descriptor strings and ID's ***/
#define VENDOR_ID          (0x20B1) /* XMOS VID */
#define PID_AUDIO_2        (0x000E) /* XK-AUDIO-216-MC USB Audio Reference Design PID */
#define PID_AUDIO_1        (0x000F) /* XK-AUDIO-216-MC USB Audio Reference Design PID */
#define PRODUCT_STR_A2     "XMOS xCORE-200 MC (UAC2.0)"
#define PRODUCT_STR_A1     "XMOS xCORE-200 MC (UAC1.0)"

#ifndef DFU_PID
#if (AUDIO_CLASS == 1)
#define DFU_PID             (0xD000 + PID_AUDIO_1)
#else
#define DFU_PID             (0xD000 + PID_AUDIO_2)
#endif
#endif

/* Board power source - Default is self-powered */
#ifndef XUA_POWERMODE
#define XUA_POWERMODE      XUA_POWERMODE_SELF
#endif

/* Enable/Disable example HID code - Default is off */
#ifndef HID_CONTROLS
#define HID_CONTROLS       (0)
#endif

#include "user_main.h"

#endif

I must have made a mistake somewhere but I can't seem to figure out where I went wrong.

I also have a question regarding lib_xua: Is there support the the Audio Control USB Interrupt Endpoint(Audio2.0.pdf section 3.16.1.2).
This would be useful for me as the XMOS device is gonna be a bridge to the audio processor and with that feature any volume/mute changes to any channel could be reported back to the USB Host. So I can keep the physical buttons in sync with USB host.
You do not have the required permissions to view the files attached to this post.