DSPRelated.com
Forums

McBSP0 Init troubles

Started by dwjohns1 November 11, 2003
Hi all,
I am trying to generate a clock signal from the SRGR of 48kHz to
drive a PCM3003 codec on a daughtercard I designed. The problem I am
having is when I step through the code, when the PCR gets assigned to
0x0f0c, the CLKX0 signal goes high on pin 21 of J3 and stays high.
The only way to get it low is to reset the board. The clock never
gets derived.I have read through the peripherals guide several times
and can't find any reason why this signal stays high. Has any one in
the group tried to use the SRGR for a clock signal before and has a
better way to do it? Here is a sample of the code below. By the way,
I am using McBSP0 with a shunt attached to JP1 on a c6711 DSK.

Thanks!!!
David void McBSP0_init()
{
int i;
/******setting up registers******/
*(unsigned volatile int *) McBSP0_SPCR = 0; /*
resetting serial port*/
*(unsigned volatile int *) McBSP0_SRGR = 0x301F1030;
/* framing and clocks frame period
fwidth clkdivide
frame period2 cycles= 2*word length-1
frame width bits =word length-1
clock divide by 70 for 48kHz= (cpu/2)/(2*wordlength*
(clkdivide+1)
0011 0000 00011111 00010000 00110000
*/
for(i=0;i<3;i++)
*(unsigned volatile int *) McBSP0_PCR = 0x0F0C; /*
setting pin control,CLKX/FSrX is int..driven Output */
*(unsigned volatile int *) McBSP0_RCR = 0x004000A0; /*
set Rx control,0-bit delay, 16bit data per frame*/
*(unsigned volatile int *) McBSP0_XCR = 0x004000A0; /*
set Tx control,0-bit delay, 16bit data per frame*/
*(unsigned volatile int *) McBSP0_DXR = 0; /*
write the first word*/

*(unsigned volatile int *) McBSP0_SPCR = 0x400000; /*
CLKG pulled out of reset*/
for(i=0;i<3;i++)

*(unsigned volatile int *) McBSP0_SPCR = 0x10001; /*
setup serial port, taken out of reset,sp transmitter enabled,

right-justify and zero fill MSB's in DRR*/ *(unsigned volatile int *) McBSP0_SPCR & 0x800000;
}