请教各位专家、大侠:
我用F2812mcbsp用作SPI和ADS1271通信,只用到CLKX和DR管脚,但初始化后,在读取数据时,CLKX无时钟产生,一直保持高电平,初始化设置如下:
void InitMcbsp(void)
{
EALLOW;
GpioMuxRegs.GPFMUX.bit.MCLKXA_GPIOF8=1;
GpioMuxRegs.GPFMUX.bit.MDRA_GPIOF13=1;
GpioMuxRegs.GPFMUX.bit.MDXA_GPIOF12=1;
GpioMuxRegs.GPFMUX.bit.MFSXA_GPIOF10=1;
EDIS;
McbspRegs.SPCR2.bit.XRST = 0;
McbspRegs.SPCR1.bit.RRST = 0;
McbspRegs.SPCR2.bit.GRST = 0;
//Mcbsp配置成SPI主设备
McbspRegs.SPCR1.bit.CLKSTP = 1;
McbspRegs.PCR1.bit.CLKXP = 1;
// McbspRegs.PCR1.bit.CLKRP = 1;
McbspRegs.PCR1.bit.CLKXM = 1;
McbspRegs.PCR1.bit.SCLKME = 0;
McbspRegs.SRGR2.bit.CLKSM= 1;
McbspRegs.SRGR1.bit.CLKGDV = 0xaa;
McbspRegs.PCR1.bit.FSXM = 1;
McbspRegs.SRGR2.bit.FSGM = 0;
McbspRegs.PCR1.bit.FSXP=1;
McbspRegs.XCR2.bit.XDATDLY = 1;
McbspRegs.RCR2.bit.RDATDLY = 1;
McbspRegs.SPCR1.bit.DXENA=1;
McbspRegs.RCR1.bit.RWDLEN1 = 1;
McbspRegs.XCR1.bit.XWDLEN1 = 1;
McbspRegs.PCR1.bit.FSRM = 1;
//使能
NOP;
NOP;
McbspRegs.SPCR2.bit.GRST = 1;
NOP;
NOP;
McbspRegs.SPCR2.bit.XRST = 1;
McbspRegs.SPCR1.bit.RRST = 1;
NOP;
NOP;
// PieCtrl.PIEIER6.bit.INTx5 = 1;
// PieCtrl.PIEIER6.bit.INTx6 = 1;
}
在读程序中,我已经写了,先发数据,产生时钟,再读数据, SysCtrlRegs.PCLKCR.bit.MCBSPENCLK =1也已经设置。
请帮忙指教,设置有什么问题?谢谢了!