哪位高手用过mcbsp串口呀,我用两片vc5416进行串口通信,可是有的时候发的数据不对,我用的字节方式传输的,中断发送,中断接受.我的mcbsp设置如下, 发送端初始化: void initia_MCBSP(void) { SPSA0=0x00;//SPCR1 uWork=SPSD0; uWork=uWork&0x0000; SPSD0=uWork; SPSA0=0x01;//SPCR2 uWork=SPSD0; uWork=uWork&0x0000; SPSD0=uWork; SPSA0=0x00;//SPCR1 uWork=SPSD0; uWork=uWork|0x0080;//使能dx,并复位接收器; SPSD0=uWork; SPSA0=0x01;//SPCR2 uWork=SPSD0; uWork=uWork|0x0040;//复位发送器,采样率发生器从复位中退出 SPSD0=uWork; SPSA0=0x0E;//PCR0 uWork=SPSD0; SPSD0=0x0000; uWork=0x0A00;//采样率发生器由的桢同步模式位决定发送桢同步信号, SPSD0=uWork; SPSA0=0x06;//SRGR1 uWork=SPSD0; uWork=uWork|0x00fe; SPSD0=uWork; asm(" nop "); asm(" nop "); SPSA0=0x00;//SPCR1 uWork=SPSD0; uWork=uWork|0x0001; SPSD0=uWork; SPSA0=0x01;//SPCR2 uWork=SPSD0; uWork=uWork|0x0001; SPSD0=uWork; } 接受端初始化: void initia_MCBSP(void) { SPSA0=0x00;//SPCR10 uWork=SPSD0; uWork=uWork&0x0000; SPSD0=uWork; SPSA0=0x01; uWork=SPSD0;//SPCR20 uWork=uWork&0x0000; SPSD0=uWork; SPSA0=0x00;//SPCR10 uWork=SPSD0; uWork=uWork|0x0080; SPSD0=uWork; SPSA0=0x01;//SPCR20 uWork=SPSD0; uWork=uWork|0x0040; SPSD0=uWork; SPSA0=0x0E;//PCR0 //uWork=SPSD0; //SPSD0=0x0000; uWork=0x0A00; SPSD0=uWork; SPSA0=0x06;//SRGR10 uWork=SPSD0; uWork=uWork|0x00FF; SPSD0=uWork; asm(" nop "); asm(" nop "); SPSA0=0x00;//SPCR10 uWork=SPSD0; uWork=uWork|0x0001; SPSD0=uWork; SPSA0=0x01;//SPCR2 uWork=SPSD0; uWork=uWork|0x0001; SPSD0=uWork; }
请各位高手给分析一下,初始化是否正确.有例程也行,我这先谢谢了.我的E_mail;yeqingchi@163.com 07.06.06
|