Changing input audio format on XS1-U8A

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
genap
Experienced Member
Posts: 99
Joined: Sat Aug 31, 2013 11:23 pm

Changing input audio format on XS1-U8A

Post by genap »

I have an old design where the XS1-U8A is connected to the TDM8 audio codec.
Codec is configured for TDM8, left justified output format in hardware mode, so I can't change it.
XMOS is configured as TDM8 slave. As far as I understand, the only XMOS input format for TDM is I2S (1 bit delay) and can't be configured for left justified by settings.
Is there a way to modify XMOS code for left justified input format, and if possible, how can I do it?

Will appreciate any input.
Thank you.
mmar
XCore Addict
Posts: 131
Joined: Fri Jul 05, 2013 5:55 pm

Post by mmar »

and if possible, how can I do it? Yes and rewrite this part code ... audio.xc
genap
Experienced Member
Posts: 99
Joined: Sat Aug 31, 2013 11:23 pm

Post by genap »

Thank you mmar,
well, I understand that the audio.xc should be modified, but can't clearly identify what I need to modify in order to read codec data starting from the first bit clock instead of second in the XMOS slave TDM8 mode. :(
mmar
XCore Addict
Posts: 131
Joined: Fri Jul 05, 2013 5:55 pm

Post by mmar »

Slave code isnt perfect in demo code for understanding som examples
#else /* ifndef CODEC_MASTER */

/* Wait for LRCLK edge (in I2S LRCLK = 0 is left, TDM rising edge is start of frame) */
p_lrclk when pinseq(0) :> void;
p_lrclk when pinseq(1) :> void;
p_lrclk when pinseq(0) :> void;
p_lrclk when pinseq(1) :> void;
#ifdef I2S_MODE_TDM
p_lrclk when pinseq(0) :> void;
p_lrclk when pinseq(1) :> void @ tmp;
#else
p_lrclk when pinseq(0) :> void @ tmp;
#endif

tmp += (I2S_CHANS_PER_FRAME * 32) - 32 + 1 ;
/* E.g. 2 * 32 - 32 + 1 = 33 for stereo */
/* E..g 8 * 32 - 32 + 1 = 225 for 8 chan TDM */


This :> void @ tmp stores edge clock info and all next calculation for tmp create control between I2S and left or right justified...
genap
Experienced Member
Posts: 99
Joined: Sat Aug 31, 2013 11:23 pm

Post by genap »

Thank you!
I looked at that direction, but it's hard to understand how it works.
I'll give it a try.
mmar
XCore Addict
Posts: 131
Joined: Fri Jul 05, 2013 5:55 pm

Post by mmar »

From example source seems as TDM is too shifted 1bit , but if you need no shift simply remove +1