xCORE-200 MC Audio: TDM channels out of sequence on record

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
Post Reply
User avatar
ccrome
Active Member
Posts: 62
Joined: Wed Sep 23, 2015 1:15 am

xCORE-200 MC Audio: TDM channels out of sequence on record

Post by ccrome »

Hello,
I'm using the xCORE-200 MC audio board, with the configuration 2i16o16xxxxx_tdm8.
USB Software rev: 6.15.2.rc1.

I put the hardware into data loopback (by jumpering the center pins of J7 and J8 on the board), so that what gets played out is immediately looped back to the input.

When I play and record simultaneously, the data comes back in the incorrect frames. I.e. in one single frame, I get data from this frame, the previous frame, and the one prior to that. That is, I get data from say, frames 10, 11, and 12, all in the same recorded frame.

Like this:
In my case I found that I recorded this sequence (each row is a frame, each column is a channel):

Code: Select all

0x00000000 0x00000000 0x02000000 0x03000000 0x04000000 0x05000000 0x00000000 0x00000000 0x00000000 0x00000000 0x0a000000 0x0b000000 0x0c000000 0x0d000000 0x00000000 0x00000000
0x00000000 0x01000000 0x02000001 0x03000001 0x04000001 0x05000001 0x00000000 0x00000000 0x08000000 0x09000000 0x0a000001 0x0b000001 0x0c000001 0x0d000001 0x00000000 0x00000000
0x00000001 0x01000001 0x02000002 0x03000002 0x04000002 0x05000002 0x06000000 0x07000000 0x08000001 0x09000001 0x0a000002 0x0b000002 0x0c000002 0x0d000002 0x0e000000 0x0f000000
0x00000002 0x01000002 0x02000003 0x03000003 0x04000003 0x05000003 0x06000001 0x07000001 0x08000002 0x09000002 0x0a000003 0x0b000003 0x0c000003 0x0d000003 0x0e000001 0x0f000001
0x00000003 0x01000003 0x02000004 0x03000004 0x04000004 0x05000004 0x06000002 0x07000002 0x08000003 0x09000003 0x0a000004 0x0b000004 0x0c000004 0x0d000004 0x0e000002 0x0f000002
0x00000004 0x01000004 0x02000005 0x03000005 0x04000005 0x05000005 0x06000003 0x07000003 0x08000004 0x09000004 0x0a000005 0x0b000005 0x0c000005 0x0d000005 0x0e000003 0x0f000003
0x00000005 0x01000005 0x02000006 0x03000006 0x04000006 0x05000006 0x06000004 0x07000004 0x08000005 0x09000005 0x0a000006 0x0b000006 0x0c000006 0x0d000006 0x0e000004 0x0f000004
0x00000006 0x01000006 0x02000007 0x03000007 0x04000007 0x05000007 0x06000005 0x07000005 0x08000006 0x09000006 0x0a000007 0x0b000007 0x0c000007 0x0d000007 0x0e000005 0x0f000005
0x00000007 0x01000007 0x02000008 0x03000008 0x04000008 0x05000008 0x06000006 0x07000006 0x08000007 0x09000007 0x0a000008 0x0b000008 0x0c000008 0x0d000008 0x0e000006 0x0f000006
0x00000008 0x01000008 0x02000009 0x03000009 0x04000009 0x05000009 0x06000007 0x07000007 0x08000008 0x09000008 0x0a000009 0x0b000009 0x0c000009 0x0d000009 0x0e000007 0x0f000007
But the sequence should have been:

Code: Select all

0x00000000 0x01000000 0x02000000 0x03000000 0x04000000 0x05000000 0x06000000 0x07000000 0x08000000 0x09000000 0x0a000000 0x0b000000 0x0c000000 0x0d000000 0x0e000000 0x0f000000
0x00000001 0x01000001 0x02000001 0x03000001 0x04000001 0x05000001 0x06000001 0x07000001 0x08000001 0x09000001 0x0a000001 0x0b000001 0x0c000001 0x0d000001 0x0e000001 0x0f000001
0x00000002 0x01000002 0x02000002 0x03000002 0x04000002 0x05000002 0x06000002 0x07000002 0x08000002 0x09000002 0x0a000002 0x0b000002 0x0c000002 0x0d000002 0x0e000002 0x0f000002
0x00000003 0x01000003 0x02000003 0x03000003 0x04000003 0x05000003 0x06000003 0x07000003 0x08000003 0x09000003 0x0a000003 0x0b000003 0x0c000003 0x0d000003 0x0e000003 0x0f000003
0x00000004 0x01000004 0x02000004 0x03000004 0x04000004 0x05000004 0x06000004 0x07000004 0x08000004 0x09000004 0x0a000004 0x0b000004 0x0c000004 0x0d000004 0x0e000004 0x0f000004
0x00000005 0x01000005 0x02000005 0x03000005 0x04000005 0x05000005 0x06000005 0x07000005 0x08000005 0x09000005 0x0a000005 0x0b000005 0x0c000005 0x0d000005 0x0e000005 0x0f000005
0x00000006 0x01000006 0x02000006 0x03000006 0x04000006 0x05000006 0x06000006 0x07000006 0x08000006 0x09000006 0x0a000006 0x0b000006 0x0c000006 0x0d000006 0x0e000006 0x0f000006
0x00000007 0x01000007 0x02000007 0x03000007 0x04000007 0x05000007 0x06000007 0x07000007 0x08000007 0x09000007 0x0a000007 0x0b000007 0x0c000007 0x0d000007 0x0e000007 0x0f000007
0x00000008 0x01000008 0x02000008 0x03000008 0x04000008 0x05000008 0x06000008 0x07000008 0x08000008 0x09000008 0x0a000008 0x0b000008 0x0c000008 0x0d000008 0x0e000008 0x0f000008
0x00000009 0x01000009 0x02000009 0x03000009 0x04000009 0x05000009 0x06000009 0x07000009 0x08000009 0x09000009 0x0a000009 0x0b000009 0x0c000009 0x0d000009 0x0e000009 0x0f000009

How to reproduce:
1) Pull all jumpers from J7 and J8 of xCORE200 MC board.
2) connect the center pins of J7 to J8 (only 2 needed for 16 channels, but all 4 won't hurt).
3) Compile audio release 6.15.2, target is app_usb_aud_xk_216_mc 2i16o16xxxxx_tdm8, with a small modification to Makefile*
4) Connect to linux PC: and run aplay myramp.wav while recording simultaneously.
5) The captured data will be all zeros up until myramp is played. Then it will show out of order data arriving. Namely, channels 0, 1, 8, 9 are 1 frame behind, and channels 6, 7, 15, 16 are 2 frames behind

* The Makefile patch just adds the defines:
-DOUTPUT_VOLUME_CONTROL=0
-DINPUT_VOLUME_CONTROL=0
-DMIXER=0
to preserve all 32-bits of data.


The attached file includes all input and output data, as well as a program for generating the test sequence.

Has anybody else seen this problem? If you don't do a digital loopback test, it may be in your design and you may never catch it!

Thanks,
-Caleb


[update: I verified with an oscilloscope that the bits on the wire are correct, so this is not a problem with the playout channel, but rather it problem seems to be exclusive to the capture/record channel]
Attachments
xmos_sample_framing_bug.tar.gz
(1.6 MiB) Downloaded 330 times
xmos_sample_framing_bug.tar.gz
(1.6 MiB) Downloaded 330 times


User avatar
Ross
XCore Expert
Posts: 962
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

My understanding of what you are saying is that some channels see a single or double sample delay in TDM (master) mode?
User avatar
ccrome
Active Member
Posts: 62
Joined: Wed Sep 23, 2015 1:15 am

Post by ccrome »

Ross wrote:My understanding of what you are saying is that some channels see a single or double sample delay in TDM (master) mode?
Correct: for any give frame N:

Code: Select all

   channels 0, 1 contain data for frame N-1
   channels 2, 3, 4, 5 contain data for frame N
   channels 6, 7 contain data for frame N-2
and the pattern repeats for channels 8-15.
Channels 0-7 are on the first TDM wire, and 8-15 are on the second TDM wire, so it seems the same problem appears one time per TDM wire.

This is a problem on record only, not on playback. I verified that on the oscilloscope by simultaneously recording a .wav file and recording a bunch of samples on the scope. The data on the TDM bus is correct, but somehow the framing is messed up in the TDM recording pathway.

All channels are in the correct slot always, but the frame in which they appear is wrong.

If you can view the data on a wide monitor so the lines don't wrap, you can see for yourself what is happening.

Here is an example of what I see on the first 8 channels. Left column is recorded frame number, and each sample is labeled cXfY where X is the channel number, and Y is the frame number that the sample came from on the playout side.

Code: Select all

        c0    c1    c2    c3    c4    c5    c6    c7
010  c0f09 c1f09 c2f10 c3f10 c4f10 c5f10 c6f08 c7f08
011  c0f10 c1f10 c2f11 c3f11 c4f11 c5f11 c6f09 c7f09
012  c0f11 c1f11 c2f12 c3f12 c4f12 c5f12 c6f10 c7f10
013  c0f12 c1f12 c2f13 c3f13 c4f13 c5f13 c6f11 c7f11
-Caleb
pfitchen
Junior Member
Posts: 4
Joined: Mon Mar 25, 2019 8:42 pm

Post by pfitchen »

Hi,

I'm trying to deal with the same issue now. I'm wondering if this was solved?

Thanks!
User avatar
ccrome
Active Member
Posts: 62
Joined: Wed Sep 23, 2015 1:15 am

Post by ccrome »

pfitchen wrote:Hi,

I'm trying to deal with the same issue now. I'm wondering if this was solved?

Thanks!
I'm sure it was solved... Now I'm trying to recall how it was solved, and having a hard time remembering. I have been off that board for quite some time, so haven't been thinking about it.

I think my hack was to re-order the samples in audio.xc by creating a new buffer and just brute-force reordering the samples. Sorry I can't be of more direct help though.

-Caleb
Post Reply