我用例程试了下,发单个字节是没有问题的:
下面是我的配置:
//*************** RESET MCBSP
McbspaRegs.SPCR2.all=0x0000; // Reset FS generator, sample rate generator & transmitter
McbspaRegs.SPCR1.all=0x0000; // Reset Receiver, Right justify word, Digital loopback dis.
McbspaRegs.PCR.all=0x0F08; //(CLKXM=CLKRM=FSXM=FSRM= 1, FSXP = 1)
//McbspaRegs.SPCR1.bit.DLB = 1;
McbspaRegs.SPCR1.bit.CLKSTP = 2; // Low inactive state without delay:
McbspaRegs.PCR.bit.CLKXP = 0; // transmits data on the rising edge
McbspaRegs.PCR.bit.CLKRP = 0; //receives data on the falling edge of MCLKR.
McbspaRegs.RCR2.bit.RDATDLY = 1; // FSX setup time 1 in master mode. 0 for slave mode (Receive)
McbspaRegs.XCR2.bit.XDATDLY = 1; // FSX setup time 1 in master mode. 0 for slave mode (Transmit)
McbspaRegs.XCR2.bit.XPHASE = 0; //发送使用单相位帧
McbspaRegs.RCR2.bit.RPHASE = 0; //接收使用单相位帧
McbspaRegs.RCR1.bit.RWDLEN1 = 2; // 16-bit word
McbspaRegs.RCR1.bit.RFRLEN1 = 15;
McbspaRegs.XCR1.bit.XWDLEN1 = 2; // 16-bit word
McbspaRegs.XCR1.bit.XFRLEN1 = 15;
McbspaRegs.SRGR2.bit.CLKSM = 1; // CLKSM=1 (If SCLKME=0, i/p clock to SRG is LSPCLK)
McbspaRegs.SRGR1.bit.CLKGDV = 8; //10 CLKG frequency = LSPCLK/(CLKGDV+1)
McbspaRegs.SPCR2.bit.GRST = 1; // Enable the sample rate generator
//delay_loop(); // Wait at least 2 SRG clock cycles
McbspaRegs.SPCR2.bit.XRST = 1; // Release TX from Reset
McbspaRegs.SPCR1.bit.RRST = 1; // Release RX from Reset
delay_loop();
McbspaRegs.SPCR2.bit.FRST = 1; // Frame Sync Generator reset
我定时发数据16个字节数据
for(i=0;i<16;i++)
{
McbspaRegs.DXR1.all = Send_Dat[i];
}
数据就全部错位了,但如果只发一个字节,则没有问题。
请教各位,是否有遇到这个问题,谢谢! |