This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320C6713B: 调用mcbsp0作为spi主发送器时无法正常控制

Part Number: TMS320C6713B

进行初始化后无法检测到mcbsp的输出时钟信号,请帮我查看一下初始化程序是否正确。

void init_McBSP0(void)
{
*(unsigned volatile int*)McBSP0_SPCR &= 0xFF3EFFFE;
// serial port control register
// Reset /FRST /GRST /XRST /RRST

*(unsigned volatile int*)McBSP0_SRGR &= 0x00000000;
*(unsigned volatile int*)McBSP0_SRGR |= 0x2000000F; //初始化SRGR寄存器
//0010 0000 0000 0000 0000 0000 0000 1111

*(unsigned volatile int*)McBSP0_SPCR &= 0xFE000700;
*(unsigned volatile int*)McBSP0_SPCR |= 0x02001000; //将CLKSTP置为10
//0000 0010 0000 0000 0001 0000 0000 0000

*(unsigned volatile int*)McBSP0_PCR &= 0xFFFFCFFF; //将CLKXP置为0
//1111 1111 1111 1111 1100 1111
*(unsigned volatile int*)McBSP0_PCR |= 0x00000F08; //初始化PCR寄存器
//0000 0000 0000 0000 0000 1111 0000 1000

*(unsigned volatile int*)McBSP0_XCR &= 0x00010000;
*(unsigned volatile int*)McBSP0_XCR |= 0x00010080; //初始化XCR寄存器
//0000 0000 0000 0001 0000 0000 0100 0000

*(unsigned int*)TIMER0_COUNT = 0;
*(unsigned int*)TIMER0_CTRL |= 0x0c0;// start timer
while ((*(unsigned int*)TIMER0_COUNT) < 10);// wait for 8 CPU clock cycles - 240 required
*(unsigned int*)TIMER0_CTRL &= 0xFF7F;// hold timer


*(unsigned volatile int*)McBSP0_SPCR |= 0x00400000; //GRST置为1

*(unsigned int*)TIMER0_COUNT = 0;
*(unsigned int*)TIMER0_CTRL |= 0x0c0;// start timer
while ((*(unsigned int*)TIMER0_COUNT) < 10);// wait for 8 CPU clock cycles - 240 required
*(unsigned int*)TIMER0_CTRL &= 0xFF7F;// hold timer

*(unsigned volatile int*)McBSP0_SPCR |= 0x00800000; //将FRST置为1

*(unsigned volatile int*)McBSP0_SPCR |= 0x00010001; //将/XRST /RRST置为1

*(unsigned int*)TIMER0_COUNT = 0;
*(unsigned int*)TIMER0_CTRL |= 0x0c0;// start timer
while ((*(unsigned int*)TIMER0_COUNT) < 10);// wait for 8 CPU clock cycles - 240 required
*(unsigned int*)TIMER0_CTRL &= 0xFF7F;// hold timer
} // end of init_McBSP0