AnsweredAssumed Answered

Help generate linear ramp at known sample rate

Question asked by klhett on Sep 28, 2011
Latest reply on Oct 6, 2011 by Mitesh

In order to understand how the SPORT transmit function works with DMA and SPDIF output, I am trying to produce a simple linear ramp that should ramp from 0 to 48000 over a 1 second period.

 

I am using a ADSP21489 EzKit eval board.  The SPIDF output is connected to the SPDIF input of a AudioPrecision analyzer.

When the program runs, I do see a ramp on the analyzer, however the period and peak value of the ramp is not what I expect.

The SPDIF output of the 21489 is running at 48 kHz sample rate.  I have measured this on the analyzer as well.

 

Below is the core part of my test program:

-------------------------------

int TxBlock_A0[96000];

 

// generate a simple ramp
int stepSize = 1;
int integrator = 0;
int i;
int j = 0;
for(i=0; i < 48000; i++)
{
     TxBlock_A0[j] = integrator;
     TxBlock_A0[j+1] = integrator;
     integrator += stepSize;
     j += 2;
}
// Configure SPORT1 for output mode
*pSPCTL1 = (SPTRAN | OPMODE | SLEN32 | SPEN_A | SCHEN_A | SDEN_A);
------------------------------------
Since the SPDIF output is running at 48 kHz and the TxBlock_A0 buffer has 48000 interleaved samples, I would expect that the ramp period would be 1 sec, however is is about 1/3 sec.
Here is a picture of the signal as viewed on the analyzer.
SpdifRampOutput.png
Also, I am using chained DMA in order to make the output repeat.
Here is the DMA setup code I'm using.
---------------------
int TCB_TxBlock_A0[4] = { 0, sizeof(TxBlock_A0), 1, 0};
TCB_TxBlock_A0[0] = (unsigned int) &TCB_TxBlock_A0[3] - OFFSET;
TCB_TxBlock_A0[3] = (unsigned int) &TxBlock_A0[0] - OFFSET;
---------------------
I have set the SLEN parameter of the SPORT to 32 because I've seen this in other example code, however, I don't understand exactly what this parameter controls.  In the 21489 hardware reference manual (page 13-10), it looks like the SPDIF transmitter expects the audio payload data to be shifted towards the MSB and that the lowest byte controls the channel status bits.  However, in the data that I'm sending to the SPORT, which then outputs it's data to the SPDIF transmitter, that this may not be hapening(or this is part of the problem) because I am seeing the ramp start from data value 0.  If the lowest byte was used as the channel status bits, then I would expect that the ramp would start at a value above zero.
Any help or ideas are greatly appreciated.
Thanks,
Kristopher

Outcomes