我用串口调试助手给DSP发数据,每次都少发一个是怎么回事?
nterrupt void sciaRxFifoIsr(void)
{
if(SciaRegs.SCIRXST.bit.RXWAKE==1)//
{
RdataA_Num=0;
RdataA[RdataA_Num]=SciaRegs.SCIRXBUF.all;
if(RdataA[RdataA_Num]==1)//local address
{
RdataA_Num++;
SciaRegs.SCICTL1.bit.SWRESET=0;
SciaRegs.SCICTL1.bit.SLEEP =0;
SciaRegs.SCICTL1.bit.SWRESET=1;
}
else//continue sleep
{
SciaRegs.SCICTL1.bit.SWRESET=0;
SciaRegs.SCICTL1.bit.SLEEP =1;
SciaRegs.SCICTL1.bit.SWRESET=1;
}
}
else//
{
RdataA[RdataA_Num++]=SciaRegs.SCIRXBUF.all; // Read data
}
SciaRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
SciaRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ack
}
比如我发01 03 00 25 00 03 14 02 01,DSP数组RdataA[]只能收到01 03 00 25 00 03 14 02
比如我发01 03 00 25 00 03 14 02 ,DSP数组RdataA[]只能收到01 03 00 25 00 03 14
每次都少一帧
Jones Chen:
你用接收FIFO了么?
FIFO的长度设置成多少个字节一个中断?
应该是剩下的那个还在FIFO中保存着呢,等着下次中断才能读出来。
我用串口调试助手给DSP发数据,每次都少发一个是怎么回事?
nterrupt void sciaRxFifoIsr(void)
{
if(SciaRegs.SCIRXST.bit.RXWAKE==1)//
{
RdataA_Num=0;
RdataA[RdataA_Num]=SciaRegs.SCIRXBUF.all;
if(RdataA[RdataA_Num]==1)//local address
{
RdataA_Num++;
SciaRegs.SCICTL1.bit.SWRESET=0;
SciaRegs.SCICTL1.bit.SLEEP =0;
SciaRegs.SCICTL1.bit.SWRESET=1;
}
else//continue sleep
{
SciaRegs.SCICTL1.bit.SWRESET=0;
SciaRegs.SCICTL1.bit.SLEEP =1;
SciaRegs.SCICTL1.bit.SWRESET=1;
}
}
else//
{
RdataA[RdataA_Num++]=SciaRegs.SCIRXBUF.all; // Read data
}
SciaRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
SciaRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ack
}
比如我发01 03 00 25 00 03 14 02 01,DSP数组RdataA[]只能收到01 03 00 25 00 03 14 02
比如我发01 03 00 25 00 03 14 02 ,DSP数组RdataA[]只能收到01 03 00 25 00 03 14
每次都少一帧
peter shi:
回复 Jones Chen:
SciaRegs.SCIFFTX.all=0xC022;
SciaRegs.SCIFFRX.all=0x0022;
SciaRegs.SCIFFCT.all=0x00;
SciaRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
SciaRegs.SCIFFTX.bit.TXFIFOXRESET=1;
SciaRegs.SCIFFRX.bit.RXFIFORESET=1;
应该设定的是0个字节一个中断
我用串口调试助手给DSP发数据,每次都少发一个是怎么回事?
nterrupt void sciaRxFifoIsr(void)
{
if(SciaRegs.SCIRXST.bit.RXWAKE==1)//
{
RdataA_Num=0;
RdataA[RdataA_Num]=SciaRegs.SCIRXBUF.all;
if(RdataA[RdataA_Num]==1)//local address
{
RdataA_Num++;
SciaRegs.SCICTL1.bit.SWRESET=0;
SciaRegs.SCICTL1.bit.SLEEP =0;
SciaRegs.SCICTL1.bit.SWRESET=1;
}
else//continue sleep
{
SciaRegs.SCICTL1.bit.SWRESET=0;
SciaRegs.SCICTL1.bit.SLEEP =1;
SciaRegs.SCICTL1.bit.SWRESET=1;
}
}
else//
{
RdataA[RdataA_Num++]=SciaRegs.SCIRXBUF.all; // Read data
}
SciaRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
SciaRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ack
}
比如我发01 03 00 25 00 03 14 02 01,DSP数组RdataA[]只能收到01 03 00 25 00 03 14 02
比如我发01 03 00 25 00 03 14 02 ,DSP数组RdataA[]只能收到01 03 00 25 00 03 14
每次都少一帧
peter shi:
回复 peter shi:
是不是SciaRegs.SCIFFRX.all=0x0021;
a啊
我用串口调试助手给DSP发数据,每次都少发一个是怎么回事?
nterrupt void sciaRxFifoIsr(void)
{
if(SciaRegs.SCIRXST.bit.RXWAKE==1)//
{
RdataA_Num=0;
RdataA[RdataA_Num]=SciaRegs.SCIRXBUF.all;
if(RdataA[RdataA_Num]==1)//local address
{
RdataA_Num++;
SciaRegs.SCICTL1.bit.SWRESET=0;
SciaRegs.SCICTL1.bit.SLEEP =0;
SciaRegs.SCICTL1.bit.SWRESET=1;
}
else//continue sleep
{
SciaRegs.SCICTL1.bit.SWRESET=0;
SciaRegs.SCICTL1.bit.SLEEP =1;
SciaRegs.SCICTL1.bit.SWRESET=1;
}
}
else//
{
RdataA[RdataA_Num++]=SciaRegs.SCIRXBUF.all; // Read data
}
SciaRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
SciaRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ack
}
比如我发01 03 00 25 00 03 14 02 01,DSP数组RdataA[]只能收到01 03 00 25 00 03 14 02
比如我发01 03 00 25 00 03 14 02 ,DSP数组RdataA[]只能收到01 03 00 25 00 03 14
每次都少一帧
zhou harry:
RdataA[RdataA_Num]==1
为什么要作这样的判断?