Barry
08-31-2003, 09:34 PM
Hi,
I was wondering if you could help me sort out a problem I'm having
with my EDMA transfer. I'm working with the C6711DSK and the AIC23EVM
Codec.
The problem is that when I use EDMA transfering, I'm losing every
second input and output sample. I have the sample rate set as 88200Hz,
but when I output a 1k signal, I get a 500Hz signal. When I input a
1kHz signal to the codec, I get 500 samples per cycle.
The problem is not related to the McBSP becuase I dont lose any
samples when I pole, instead of the EDMA transfer.
The AIC23 accepts the right and left channel as a 32 bit frame. In
otherwords the left and right channels are 16 bits each.
Another think I've noticed is that the right channel is clipped. If 1
output a signal with the maximum possible applitude, 1 Volts RMS, it
is clipped somewhere above and below 1 and -1 volts respectfully. This
does not happen to the left channel, and does not happen to either
channel when I use polling instead of EDMA transferring.
This is how I'm setting up the EDMA -
/* Config Structures */
EDMA_Config DSS_edmaMcbspRx = {
0x207D0000, /* Option */
0x30000000, /* Source Address - Numeric */
0x00000000, /* Transfer Counter - Numeric */
0x00000000, /* Destination Address - Numeric */
0x00000002, /* Index register - Numeric */
0x00000000 /* Element Count Reload and Link Address */
};
EDMA_Config DSS_edmaMcbspTx = {
0x431C0000, /* Option */
0x00000000, /* Source Address - Numeric */
0x00000000, /* Transfer Counter - Numeric */
0x30000000, /* Destination Address - Numeric */
0x00000002, /* Index register - Numeric */
0x00000000 /* Element Count Reload and Link Address */
};
I think the best thing is if I link to the code I'm using (.txt = .c)
-
http://baz.perlmonk.org/main.txt - contains main
http://baz.perlmonk.org/dss.txt - pipe interface to the serial port
audio
http://baz.perlmonk.org/dss_dsk6711.txt
http://baz.perlmonk.org/dss_edmacisr.txt - EDMA ISR
the cdb file -
http://baz.perlmonk.org/audio.cdb
The AIC23 Codec uses MCBSP 1 for control and MCBSP 0 for data
transfer. I've tried setting differenct sample rates on the AIC23, but
the EDMA transfer always seems to half my number of samples.
Can anyone see what I'm doing wrong, I've been stuck at this for a
while and I'd really like to get it fixed. Thanks for your help.
Barry.
When polling, I output a sine wave with the following -
for(i=0;i<80;i++)
sig[i] = cos(w(1102.5)*i/(Float)(SR));
EDMA_RSET(EER, 0x0000); /* Disable all events */
EDMA_RSET(ECR, 0xffff); /* Clear all pending events */
EDMA_RSET(CIER, 0x0000); /* Disable all events to Interrupt */
EDMA_RSET(CIPR, 0xffff); /* Clear all pending Queued EDMA ints */
MCBSP_RSETH(DSS_hMcbsp1, SPCR, 0x02001000);
MCBSP_RSETH(DSS_hMcbsp1, SPCR, 0x02C01000);
MCBSP_RSETH(DSS_hMcbsp1, SPCR, 0x02C11000);
MCBSP_RSETH(DSS_hMcbsp0, SPCR, 0x02010001);
initRegs();
for(;;)
for(i=0;i<80;i++)
{
f1=sig[i];
f2=sig[i];
t1 = f1 * div;
t1 &= 0xffff;
t2 = f2 * div;
t2 &= 0xffff;
t2 <<= 16;
t1 = t1 | t2;
spWrite(DSS_hMcbsp0, t1);
t1 = spRead(DSS_hMcbsp0);
/* t2 = (t1>>16) & 0xffff;
t1 = t1 &0xffff;
if(t1 & 0x8000)
t1 |= 0xFFFF0000;
if(t2 & 0x8000)
t2 |= 0xFFFF0000;
f1 = (((Float)((Int)(t1)))/div);
f2 = (((Float)((Int)(t2)))/div);*/
}
}
Uns spRead(MCBSP_Handle hMcBsp)
{
// Poll until new value ready to read
while (((MCBSP_RGETH(DSS_hMcbsp0, SPCR)) & 0x2) == 0);
return MCBSP_read(hMcBsp);
}
// Write from McBsp to AIC23
Void spWrite(MCBSP_Handle hMcBsp, Uns data)
{
// Poll until ready to transmit
while (( (MCBSP_RGETH(hMcBsp, SPCR)) & 0x20000) == 0);
MCBSP_write(hMcBsp,data);
}
I was wondering if you could help me sort out a problem I'm having
with my EDMA transfer. I'm working with the C6711DSK and the AIC23EVM
Codec.
The problem is that when I use EDMA transfering, I'm losing every
second input and output sample. I have the sample rate set as 88200Hz,
but when I output a 1k signal, I get a 500Hz signal. When I input a
1kHz signal to the codec, I get 500 samples per cycle.
The problem is not related to the McBSP becuase I dont lose any
samples when I pole, instead of the EDMA transfer.
The AIC23 accepts the right and left channel as a 32 bit frame. In
otherwords the left and right channels are 16 bits each.
Another think I've noticed is that the right channel is clipped. If 1
output a signal with the maximum possible applitude, 1 Volts RMS, it
is clipped somewhere above and below 1 and -1 volts respectfully. This
does not happen to the left channel, and does not happen to either
channel when I use polling instead of EDMA transferring.
This is how I'm setting up the EDMA -
/* Config Structures */
EDMA_Config DSS_edmaMcbspRx = {
0x207D0000, /* Option */
0x30000000, /* Source Address - Numeric */
0x00000000, /* Transfer Counter - Numeric */
0x00000000, /* Destination Address - Numeric */
0x00000002, /* Index register - Numeric */
0x00000000 /* Element Count Reload and Link Address */
};
EDMA_Config DSS_edmaMcbspTx = {
0x431C0000, /* Option */
0x00000000, /* Source Address - Numeric */
0x00000000, /* Transfer Counter - Numeric */
0x30000000, /* Destination Address - Numeric */
0x00000002, /* Index register - Numeric */
0x00000000 /* Element Count Reload and Link Address */
};
I think the best thing is if I link to the code I'm using (.txt = .c)
-
http://baz.perlmonk.org/main.txt - contains main
http://baz.perlmonk.org/dss.txt - pipe interface to the serial port
audio
http://baz.perlmonk.org/dss_dsk6711.txt
http://baz.perlmonk.org/dss_edmacisr.txt - EDMA ISR
the cdb file -
http://baz.perlmonk.org/audio.cdb
The AIC23 Codec uses MCBSP 1 for control and MCBSP 0 for data
transfer. I've tried setting differenct sample rates on the AIC23, but
the EDMA transfer always seems to half my number of samples.
Can anyone see what I'm doing wrong, I've been stuck at this for a
while and I'd really like to get it fixed. Thanks for your help.
Barry.
When polling, I output a sine wave with the following -
for(i=0;i<80;i++)
sig[i] = cos(w(1102.5)*i/(Float)(SR));
EDMA_RSET(EER, 0x0000); /* Disable all events */
EDMA_RSET(ECR, 0xffff); /* Clear all pending events */
EDMA_RSET(CIER, 0x0000); /* Disable all events to Interrupt */
EDMA_RSET(CIPR, 0xffff); /* Clear all pending Queued EDMA ints */
MCBSP_RSETH(DSS_hMcbsp1, SPCR, 0x02001000);
MCBSP_RSETH(DSS_hMcbsp1, SPCR, 0x02C01000);
MCBSP_RSETH(DSS_hMcbsp1, SPCR, 0x02C11000);
MCBSP_RSETH(DSS_hMcbsp0, SPCR, 0x02010001);
initRegs();
for(;;)
for(i=0;i<80;i++)
{
f1=sig[i];
f2=sig[i];
t1 = f1 * div;
t1 &= 0xffff;
t2 = f2 * div;
t2 &= 0xffff;
t2 <<= 16;
t1 = t1 | t2;
spWrite(DSS_hMcbsp0, t1);
t1 = spRead(DSS_hMcbsp0);
/* t2 = (t1>>16) & 0xffff;
t1 = t1 &0xffff;
if(t1 & 0x8000)
t1 |= 0xFFFF0000;
if(t2 & 0x8000)
t2 |= 0xFFFF0000;
f1 = (((Float)((Int)(t1)))/div);
f2 = (((Float)((Int)(t2)))/div);*/
}
}
Uns spRead(MCBSP_Handle hMcBsp)
{
// Poll until new value ready to read
while (((MCBSP_RGETH(DSS_hMcbsp0, SPCR)) & 0x2) == 0);
return MCBSP_read(hMcBsp);
}
// Write from McBsp to AIC23
Void spWrite(MCBSP_Handle hMcBsp, Uns data)
{
// Poll until ready to transmit
while (( (MCBSP_RGETH(hMcBsp, SPCR)) & 0x20000) == 0);
MCBSP_write(hMcBsp,data);
}