xmos / sw_usb_audio

XMOS USB Audio reference design
Other
32 stars 17 forks source link

No output signal on an analogue channel pair #110

Closed danielpieczko closed 1 year ago

danielpieczko commented 1 year ago

I have seen regular failures where a pair of analogue channels doesn't output a signal. We have probably been seeing this for a long time but assumed it was just "bad cables"; however that doesn't seem to be the case.

To reproduce, I just xrun the xk_316_mc config 2AMi10o10xssxxx over and over; about one in twenty times, one channel pair has no output signal at 192kHz. The problematic pair of channels can vary. In this case, I am generating different sines on each of the eight channels using xsig, and detecting it with the sw_audio_analyzer app running on a connected xcore-200 board.

When in this state:

I've captured the USB traffic from the MacOS host to the device and can see all eight analogue channels of output data being sent, so I don't think the issue is on the host. I also can't see any differences/errors in the way the captures begin before we start playing audio. Here's a zip with a working case and one where there was no signal on channels 0 and 1: usb-traces.zip

danielpieczko commented 1 year ago

Have not been able to reproduce this with the same config on the 216 board.

danielpieczko commented 1 year ago

Also haven't been able to provoke any similar problems on the 316 board on the input direction.

xross commented 1 year ago

In the failed state the "Clock is invalid" error bit is set in the relevant DAC. In addition the PLL is marked as unlocked.

The data sheet implies that if LRCK and BCLK missing for a while DAC goes into standby, of course this will occur on a sample-rate change. There is a register for setting clock missing detection period - defaults to approx 1 second (can be set to up to approx 8 seconds)

We can increase this time. We can also set the DAC to ignore errors, however, we probably need to implement a bit more of a DAC friendly sequence when changing SR but the documentation for the DAC is not ideal.

xross commented 1 year ago

The decision has been made to to setup the DAC manually rather than rely on its auto-detect mode. This will hopefully solve this issue and is also the recommended usage for quality reasons (since auto-detect mode uses the internal PLL)