Audio 2.0: how to do >1 transfer per microframe?

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
Post Reply
redfart
Member++
Posts: 16
Joined: Tue Oct 04, 2016 11:27 pm

Audio 2.0: how to do >1 transfer per microframe?

Post by redfart »

Hi, I'm running xCore-200 MC AUDIO 2V0 kit, and the Thesycon driver 3.34 eval version. I'm basing my project around the app_usb_aud_xk_216_mc project.

USB 2.0 High Speed (USB AUDIO 2.0) permits a transfer of 1024 bytes max every microframe (125 uSec). Since USB 2.0 can handle 480Mb/sec, I should be able to double or triple the data rate. I see references to "multi-packet mode" in some white papers. My attempts to simply increase audio data over the limit (by upping channel counts and sample rates) isn't working. ASIO-compliant DAW programs (like Reaper) shout that they don't see an ASIO device connected if I'm running code at too high a data rate.

Thesycon tech support claims their driver already supports data rates above 1024Bytes/microframe


User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Post by larry »

As far as I know the Thesycon driver supports high bandwidth/multi packet endpoints, but this hasn't been extensively tested with XMOS devices
redfart
Member++
Posts: 16
Joined: Tue Oct 04, 2016 11:27 pm

Post by redfart »

Thanks, Larry. Any suggestions how I would go about implementing it? Merely upping my channel count and sample rate doesn't work. I presume the code handling each microframe would need to be modified. Not sure where the 1024-byte-per-uframe limit is written in.
redfart
Member++
Posts: 16
Joined: Tue Oct 04, 2016 11:27 pm

Post by redfart »

Wait, I may have found it. The descriptors.h file limits the maxpacketsize here:

#define HS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE (MAX_PACKET_SIZE_MULT_INPUT_1_HS * HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES)
#define HS_STREAM_FORMAT_INPUT_2_MAXPACKETSIZE (MAX_PACKET_SIZE_MULT_INPUT_1_HS * HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES)
#define HS_STREAM_FORMAT_INPUT_3_MAXPACKETSIZE (MAX_PACKET_SIZE_MULT_INPUT_1_HS * HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES)

#if (HS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE > 1024)
#warning HS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE > 1024
#undef HS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE
#define HS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE 1024
#endif

#if (HS_STREAM_FORMAT_INPUT_2_MAXPACKETSIZE > 1024)
#warning HS_STREAM_FORMAT_INPUT_2_MAXPACKETSIZE > 1024
#undef HS_STREAM_FORMAT_INPUT_2_MAXPACKETSIZE
#define HS_STREAM_FORMAT_INPUT_2_MAXPACKETSIZE 1024
#endif

#if (HS_STREAM_FORMAT_INPUT_3_MAXPACKETSIZE > 1024)
#warning HS_STREAM_FORMAT_INPUT_3_MAXPACKETSIZE > 1024
#undef HS_STREAM_FORMAT_INPUT_3_MAXPACKETSIZE
#define HS_STREAM_FORMAT_INPUT_3_MAXPACKETSIZE 1024
#endif

Removing the limit and rebuilding, I can at least run my 3rd-party apps and have them see the device, though they complain that I have made a "sample rate or device change request" when they connect. I'll have to get some HW together and confirm they are running audio.
User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Post by larry »

Main problem is that the low level USB code doesn't support multiple packets. So even if you up limits, correct descriptors and make all high level code work, the USB core won't expect a different DATA PID of the second and third packet and probably just drop them.
redfart
Member++
Posts: 16
Joined: Tue Oct 04, 2016 11:27 pm

Post by redfart »

Is that low-level code visible in the sample project?
User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Post by larry »

Unfortunately, this is the XUD module, where most core functions are in a binary library (libxud_x200.a)
redfart
Member++
Posts: 16
Joined: Tue Oct 04, 2016 11:27 pm

Post by redfart »

Is the lib_usb library not helpful? Or, the xud.h file?
User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Post by larry »

Is the lib_usb library not helpful? Or, the xud.h file?
My apologies, I didn't realise this has been made available. I also found a related thread:

http://www.xcore.com/forum/viewtopic.php?f=37&t=4512

If you look in Pid_Out where OUT transactions are handled, after the OUT token it goes straight into doRXData where it consumes exactly one data packet. Then we go back to main loop, expecting a new transaction. This logic needs to change so multiple packets work.

Similarly for IN, where we need to be able to send multiple packets after an IN token.
redfart
Member++
Posts: 16
Joined: Tue Oct 04, 2016 11:27 pm

Post by redfart »

>> "Pid_Out where OUT transactions are handled, after the OUT token it goes straight into doRXData..."

Is that found in XUD_Token_Out.S in the library?
Is the asm instruction set printed anywhere? (It's not in the chip datasheet.) I'm having trouble understanding this code.
That said, am I able to modify a library, or would XMOS need to supply a new one to me?

Thanks, I am VERY new at this! I was hoping to get by simply modifying the makefile build configurations, but now I realize I'm in the deep end.
Post Reply