TMS320F28335中,将MCBSP配置为SPI从模式,怎么在一个同步帧中发送或接收多个字节??我现在的配置中,每个同步帧有效的时间内只能发送或接收一个字节内容,之后即使同步帧继续有效,DSP也不发送和接收数据了,请问该怎么设置,使的在同步帧为低的过程中,只要有时钟,就可以不停的发送数据和接收数据?谢谢!
我的MCBSP配置内容如下,用接收中断接收数据,每次接收8bit数据:
{
// McBSP-A register settings config as spi-slave
McbspaRegs.SPCR2.bit.XRST=0; // Reset FS generator, sample rate generator & transmitter
McbspaRegs.SPCR1.bit.RRST=0; // Reset Receiver, Right justify word
McbspaRegs.SPCR2.bit.GRST = 0; //复位取样率发送器
McbspaRegs.SPCR1.bit.DLB = 0; //禁止回送
// McbspaRegs.SPCR1.bit.DLB = 1; // Enable loopback mode for test. Comment out for normal McBSP transfer mode.
McbspaRegs.MFFINT.all=0x4; // 使能接收中断
McbspaRegs.SPCR1.bit.RINTM=0; //RRDY(SPCR1[1])从0变为1时产生接收中断(RINT)请求 //Add on 20140729
McbspaRegs.SPCR1.bit.CLKSTP = 2; // SPI模式 不延时
McbspaRegs.PCR.bit.CLKXP = 0;
McbspaRegs.PCR.bit.CLKRP = 0; // 上升沿发送 下降沿接收
McbspaRegs.PCR.bit.CLKXM = 0; //SPI从模式
McbspaRegs.PCR.bit.SCLKME = 0; //时钟为lspclk
McbspaRegs.SRGR2.bit.CLKSM = 1;
McbspaRegs.SRGR1.bit.CLKGDV= 0x01; //配置为从模式时此位要为1
// McbspaRegs.SRGR1.bit.CLKGDV= 0x0063;//波特率:1.5M,20140525——yxy.原来为:0x7C; //300k..1.2M/////1.1MHz...0X87
McbspaRegs.PCR.bit.FSXM = 0; //发送帧同步由GSGM of SRGR2决定
// McbspaRegs.SRGR2.bit.FSGM = 0; //当数据由dxr到xsr寄存器时产生发送帧 CLKSM=1, FPER = 1 CLKG periods
McbspaRegs.PCR.bit.FSXP = 1; //帧同步低有效
McbspaRegs.RCR2.bit.RDATDLY=0; // 接收1bit 延时 FSX setup time 1 in master mode. 0 for slave mode (Receive)
McbspaRegs.XCR2.bit.XDATDLY=0; // FSX setup time 1 in master mode. 0 for slave mode (Transmit)
McbspaRegs.SPCR1.bit.RJUST = 0; //右对齐 高位补充0
McbspaRegs.RCR1.bit.RWDLEN1=0; // 16-bit word--2// 8-bit word--0
McbspaRegs.XCR1.bit.XWDLEN1=0; // 16-bit word--2// 8-bit word--0
McbspaRegs.RCR2.bit.RCOMPAND=0; //无压缩扩展,8位数据,先传送高位
McbspaRegs.XCR2.bit.XCOMPAND=0; //无压缩扩展,8位数据,先传送高位
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
McbspaRegs.SPCR2.bit.FRST=1; // Frame Sync Generator reset
}
