我的程序是5510串口初始化aic11,要求初始完成后音频信号能直通。 我的问题是 1。串口回环能够通过(不考虑aic11):即 写入数据到dxr后,在drr中能正确的收到,但是在dx管脚用示波器却测不到。 2。取消回环,初始化aic11不能成功,数据不能写入到aic11的寄存器,如果写入成功的话,aic11的输出时钟会按照配制的要求改变,但是现在测得的情况是没有改变。且程序停在while (!(*(volatile ioport int*)McBSP0_SPCR1_0 & 0x2)){};rrdy始终是为0。 下面是主要部分的源代码,希望大家帮我看看问题出在哪里!谢谢!!
void init_board(void) { *(volatile ioport int*)McBSP0_RCR1_0=0x0040; *(volatile ioport int*)McBSP0_RCR2_0=0x0002; *(volatile ioport int*)McBSP0_XCR1_0=0x0040; *(volatile ioport int*)McBSP0_XCR2_0=0x0002; *(volatile ioport int*)McBSP0_SRGR1_0=0x0101; *(volatile ioport int*)McBSP0_SRGR2_0=0x200f; *(volatile ioport int*)McBSP0_PCR0=0x0a00; *(volatile ioport int*)McBSP0_SPCR2_0=0x00c1; *(volatile ioport int*)McBSP0_SPCR1_0=0x0001; }
///////////////////////////////////////////////////////////////////////// void mcbsp0_write(int out_data) //function for writing { *(volatile ioport int*)McBSP0_DXR1_0 = out_data; }
////////////////////////////////////////////////////////////////////////// int mcbsp0_read() //function for reading { int tp; tp=*(volatile ioport int*)McBSP0_DRR1_0; return tp; }
//////////////////////////////////////////////////////////////////
void init_aic11() {
int val[8]={0x0001,0x0200,0x0001,0x0402,0x0001,0x0600,0x0001,0x0800}; int i; for(i=1;i<8;i++) { while(!(*(volatile ioport int*)McBSP0_SPCR2_0 & 0x2)){}; mcbsp0_write(val);
} }
#include "io.h" #include <stdio.h>
void main() { int xrdy,rrdy,i=0,err=0,sam[N],rcv[N],xx; int sample; init_board(); init_aic11();
while(1) { while (!(*(volatile ioport int*)McBSP0_SPCR1_0 & 0x2)){}; sample = mcbsp0_read(); while (!(*(volatile ioport int*)McBSP0_SPCR2_0 & 0x2)){}; mcbsp0_write(sample&0xfffe); } }
|