我在DM642里面对TLV320AIC23进行Transmit操作时,遇到一个问题。代码如下,各同步时钟信号AFSX、ACLKX、AHCLKX由AIC23提供。
MCASP_ConfigSrctl MysrctlRegs = {
0x00000009, //AXR00=Xmt
0x00000000, //AXR01=Rcv
0x00000000, //AXR02=Xmt
0x00000000, //AXR03=Rcv
0x00000000, //AXR04=Xmt
0x00000000, //AXR05=Rcv
0x00000000, //AXR06=Xmt
0x00000000, //AXR07=Rcv
};
hMcasp = MCASP_open(MCASP_DEV0,MCASP_OPEN_RESET);
//1: reset McASP to default values
MCASP_reset(hMcasp);
//2a: Leave PWRDEMU at default.
//2b: Receiver registers:
//2c: Transmit register:
MCASP_RSETH(hMcasp, XMASK, 0x0000FFFF);
MCASP_RSETH(hMcasp, XFMT, 0x00018070);
MCASP_RSETH(hMcasp, AFSXCTL, 0x00000111);
MCASP_RSETH(hMcasp, ACLKXCTL, 0x000000C0);
MCASP_RSETH(hMcasp, AHCLKXCTL,0x00000030);
MCASP_RSETH(hMcasp, XTDM, 0xFFFFFFFF);
MCASP_RSETH(hMcasp, XINTCTL, 0x00000020);
MCASP_RSETH(hMcasp, XCLKCHK, 0x00000000);
//2d: Serialize registers: SRCTL[n]
MCASP_configSrctl(hMcasp, &MysrctlRegs);
//2e: Global registers:$FUNC,PDIR,DITCTL,DLBCTL,AMUTE.
MCASP_RSETH(hMcasp, PFUNC, 0x00000000);
MCASP_RSETH(hMcasp, PDIR, 0x0200FF55);
MCASP_RSETH(hMcasp, DITCTL,0x00000000);
MCASP_RSETH(hMcasp, DLBCTL,0x00000000);
MCASP_RSETH(hMcasp, AMUTE, 0x00000000);
//3:Start high-frequency serial clock AHCLKR
MCASP_enableHclk(hMcasp, MCASP_XMT);
while(!(MCASP_FGETH(hMcasp, GBLCTL, XHCLKRST)));
//4: Start serial clock ACLKR.If external, skipped
//MCASP_enableClk(hMcasp, MCASP_RCV);
//while(!(MCASP_FGETH(hMcasp, GBLCTL,RCLKRST)));
//MCASP_enableClk(hMcasp, MCASP_XMT);
//while(!(MCASP_FGETH(hMcasp, GBLCTL, XCLKRST)));
//5: Enable receive interrupt
MCASP_RSETH(hMcasp,XINTCTL,0x00000020); //enable XDATA interrupt
//6: Activate serializers
MCASP_RSETH(hMcasp,XSTAT,0x0000FFFF);
MCASP_enableSers(hMcasp, MCASP_XMT);
while(!(MCASP_FGETH(hMcasp, GBLCTL, XSRCLR)));
//7: Verify that all transmit buffers are serviced.Ignored.
while(MCASP_FGETH(hMcasp, XSTAT, XDATA));
//8: Release machines from reset
MCASP_enableSm(hMcasp, MCASP_XMT);
while(!(MCASP_FGETH(hMcasp, GBLCTL, XSMRST)));
//9: Release frame sync generators from reset
MCASP_enableFsync(hMcasp, MCASP_XMT);
while(!(MCASP_FGETH(hMcasp, GBLCTL, XFRST)));
为什么我的代码在执行到第六步时,即启动serializers时,程序就停下来了。检查了很久,都没有找到原因,很是郁闷。望大家帮我看看问题出在哪里。谢谢了! |