请教各位高手,我用DM642的MCBSP接口作为SPI主器件,来控制DA转换,寄存器初始化如下,程序可以跑起来,DXR寄存器中也有我想要发送的值,但用示波器测量没有信号,片选、时钟、数据都没有输出,有没有哪位大侠指点一下,已经搞了好几天了:
void mcbsp1_init() //配置McBSP0为SPI主设备 { //串行接口接收器被禁止并且处于复位状态 McBSP1_SPCR = 0x00800000; //每帧一段,每段一字,Ignore FS after the first McBSP1_RCR = 0x00010040; //16 BITs,Ignore FS after the first McBSP1_XCR = 0x00010040; McBSP1_SRGR = 0x200F010F; McBSP1_PCR = 0x00000A0F; McBSP0_SPCR = 0x00801800; //FSX,CLKX输出,FSR,CLKR输入 //启动采样率发生器 McBSP1_SPCR = 0x00C01800; //使能串口的收发,选择时间停止模式 McBSP1_SPCR = 0x00C11801; //McBSP1_SPCR = 0x00C11801;
}
void main() { myhMcbsp1 = MCBSP_open(MCBSP_DEV1, MCBSP_OPEN_RESET); mcbsp1_init(); MCBSP_enableSrgr(myhMcbsp1);//Enable the McBSP MCBSP_enableFsync(myhMcbsp1); MCBSP_enableRcv(myhMcbsp1); MCBSP_enableXmt(myhMcbsp1); while(1) { while (!MCBSP_xrdy(myhMcbsp1)){} MCBSP_write(myhMcbsp1,outA); } }
|