XK-AUDIO-316-MC-AB and its word clock in

Discussions relating to the XK-EVK-XU316
hohoho
Member
Posts: 14
Joined: Tue Jun 02, 2020 3:40 pm

XK-AUDIO-316-MC-AB and its word clock in

Post by hohoho »

Hello,
I tried searching the forum, but I can't seem to find the exact example.
I am to connect external mic preamps/line outs (8 channels in and 8 channels out) via ADAT (both RX and TX).
There is a BNC connector for word clock on the preamps, and I want it to be master for XK-AUDIO-316-MC-AB's word clock in BNC connector.
Could someone guide me how to configure sw_usb_audio (and probably jumpers on the board, if needed) to achieve that? Do I need something extra other than enabling XUA_ADAT_TX_EN and XUA_ADAT_RX_EN?
Thanks.
User avatar
infiniteimprobability
Verified
XCore Legend
Posts: 1185
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

Hi there,

when running from an external clock source, the firmware needs to recover the clock and generate a master clock from that. The code that does that is here in lib_xua, which is the machinery behind sw_usb_audio.

This counts incoming samples at the sample rate and either provides a reference clock for the CS2100, or using the XUA_USE_SW_PLL define, the internal application PLL in the chip generates the master clock.

Whenever you have a digital input (SPDIF/ADAT) the whole system needs to be sync'ed to that. The clockgen code is enabled automatically whenever SPDIF or ADAT rx is enabled. Looking at clockgen.xc more closely, I can't see any hooks for the external word clock input and the XN file (which defines the port aliases) doesn't have an entry for XS1_PORT_1P which is the word clock port on the board.

So it looks like this feature is not supported in the current firmware. Apologies.

There are two options then.

1) Stick with clock recovery from the ADAT input. This should work well out of the box and will provide you with a good quality local clock which is phase locked to the incoming ADAT stream
2) Modify clockgen so that it works on the word clock input

2) should be doable - the line is a good place to start. An extra select case in this part of the code would be needed to trigger on the rising edge of the word clock (you can use a pinsneq and a level guard on the select case so that it just triggers on the edge) and you would need to disable time stamping on the other digital inputs, and timestamp on the WCLK instead.

However, if you already have the word clock in the optical input, I don't think this win you very much. I assume the word clock and ADAT sources are all phase locked anyway? They would have to be because there is only one master clock in lib_xua, without adding high quality ASRC (which would be possible - we have all of the code for that in lib_src) but that's a different story.

Let me know if you definitely want to extend the firmware to support WCLK in and I can give you some further pointers.
Engineer at XMOS
hohoho
Member
Posts: 14
Joined: Tue Jun 02, 2020 3:40 pm

Post by hohoho »

Not sure I want to dig that deep yet (perhaps some time later).
So far the preamp seems to be working fine with just the ADAT cables in/out.
I was just theorizing that it would probably be better to have one clock source to rule them all. But so far even without it, the result seems fine.
Thanks!