Add LRCLK High width issue in TDM Topic is solved

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
Post Reply
susanyin0501
Active Member
Posts: 45
Joined: Thu Apr 20, 2017 9:00 am

Add LRCLK High width issue in TDM

Post by susanyin0501 »

Dear all,
In order to drive external DAC board, which required TDM16 (16 channels) LRCLK HIGH WIDTH more than one BCLK,
I'd tried to add LRCLK High width, change the following yellow code from 0x80000000 to 0xF0000000 (can add 3 BCLKs width) in audio.xc

but we can't loopback audio data from audio in 1 port to audio out 1 port on demo board(XCORE-200 MC AUDIO), ( if setting to p_lrclk <: 0x80000000; it can loopback).

if set to 0x80000000, please check work_well.png
set 0 0xf0000000 ,plese review work_wrong.png

would you please give us some suggestions about it?
what shall i do if want to meet this project requiremet?

Thanks!


#if (I2S_CHANS_ADC != 0)
index = 0;
/* Channels 0, 2, 4.. on each line */
#pragma loop unroll
for(int i = 0; i < I2S_CHANS_ADC; i += I2S_CHANS_PER_FRAME)
{
/* Manual IN instruction since compiler generates an extra setc per IN (bug #15256) */
unsigned sample;
asm volatile("in %0, res[%1]" : "=r"(sample) : "r"(p_i2s_adc[index++]));

if(buffIndex)
samplesIn_1[((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i] = bitrev(sample); // channels 1, 3, 5.. on each line.
else
samplesIn_0[((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i] = bitrev(sample); // channels 1, 3, 5.. on each line.

}

#ifdef SU1_ADC_ENABLE
{
unsigned x;
x = inuint(c_adc);
inct(c_adc);
asm volatile("stw %0, dp[g_adcVal]"::"r"(x));
}
#endif
#endif

#ifndef CODEC_MASTER
#ifdef I2S_MODE_TDM
if(frameCount == (I2S_CHANS_PER_FRAME-2))
// p_lrclk <: 0x80000000;
p_lrclk <: 0xc0000000;

else
p_lrclk <: 0x00000000;
#else
p_lrclk <: 0x7FFFFFFF;
#endif
#endif

index = 0;
#pragma xta endpoint "i2s_output_r"
#if (I2S_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT != 0)
/* Output "odd" channel to DAC (i.e. right) */
#pragma loop unroll
for(int i = 1; i < I2S_CHANS_DAC; i+=I2S_CHANS_PER_FRAME)
{
p_i2s_dac[index++] <: bitrev(samplesOut[frameCount + i]);
}
#endif

#ifndef CODEC_MASTER
doI2SClocks(divide);
#endif
Attachments
work_wrong.png
(205.1 KiB) Not downloaded yet
work_wrong.png
(205.1 KiB) Not downloaded yet
work_well.png
(295.29 KiB) Not downloaded yet
work_well.png
(295.29 KiB) Not downloaded yet


View Solution
susanyin0501
Active Member
Posts: 45
Joined: Thu Apr 20, 2017 9:00 am

Post by susanyin0501 »

this issue is caused by DAC can't decode audio data correctly, because TDM LRCLK high width is increased, but DAC can't configure it.
so change it to solved.
Post Reply