TI中文支持网
TI专业的中文技术问题搜集分享网站

请教f28035 SCI 串口通信调试

以下是我程序中的SCI相关代码,我用中断方式接收,查询方式发送,但是不知为什么我用串口调试助手发送字符后不能接收到CPU发送回来的数据?

void sInitSCI(void)
{
 EALLOW;
 GpioCtrlRegs.GPAPUD.bit.GPIO28 = 0; // Enable pullup on GPIO28
 GpioCtrlRegs.GPAQSEL2.bit.GPIO28 = 3; // asynch input
 GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 1; // GPIO28 = SCIRXDA
 GpioCtrlRegs.GPAPUD.bit.GPIO29 = 0; // Enable pullup on GPIO29
 GpioCtrlRegs.GPAMUX2.bit.GPIO29 = 1; // GPIO29 = SCITXDA
// GpioCtrlRegs.GPAQSEL2.bit.GPIO29 = 3; // asynch input
 EDIS;

 // One stop bit, no parity, 8-bit character length
 SciaRegs.SCICCR.all=0x07;
 // Enable transmit and receive, Relinquish SCI from Reset
 SciaRegs.SCICTL1.all =0x03;
 //bard= 115200
 SciaRegs.SCIHBAUD=0x00;
 SciaRegs.SCILBAUD=0x07;
 // Enable Receive interrupt and transmit interrupt
 SciaRegs.SCICTL2.bit.TXINTENA = 1;
 SciaRegs.SCICTL2.bit.RXBKINTENA = 1;
// SciaRegs.SCICTL1.bit.SWRESET = 1;
 SciaRegs.SCICTL1.all = 0x0023;

}

interrupt void sSciRxIsr(void)  //接收中断函数
{

     wSciRxTemp = SciaRegs.SCIRXBUF.bit.RXDT;

     PieCtrlRegs.PIEACK.all = PIEACK_GROUP9;

}

void  sSCITX(void)

{

  if(SciaRegs.SCICTL2.bit.TXRDY == 1)
  {   
   SciaRegs.SCITXBUF = wSciRxTemp;
  }

}

请高手帮忙看看,谢谢!

赞(0)
未经允许不得转载:TI中文支持网 » 请教f28035 SCI 串口通信调试
分享到: 更多 (0)