Rx interrupt error

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Rx interrupt error

1,476 次查看
DavidoBG
Contributor II
Find my following code under here
void interrupt VectorNumber_Vscirx isr_rx(void)
{
 unsigned char RX_car;   // Caractere reçu
 
 Cod_err = 0;
 RX_car = SCID;  // read SCI1S1 to check for receive errors
  if (RX_car & 7)     // is there any rx errors?
  { // yes, make a dummy read of the rx data and return
       // dummy read of rx data to clear the interrupt flag
    //Buf_car[No_car] = RX_car;
    //No_car++;
    Cod_err = 3;
    RX_car = SCID;
    return;
  }
When my  interrupt run, my check error reception (RX_car & 7) is always true.
I already check SCI1S1 register and i can see:
PF=0; FE=0; NF=0; OR=0; IDLE=1; RDRF=1; TC=1; TDRE=1
So  whait is the error?
Thanks
David
标签 (1)
0 项奖励
回复
2 回复数

482 次查看
erooll
Contributor II
RX_car = SCID;  // read SCI1S1 to check for receive errors
in the above line RX_car load data register, you need read status register
 
RX_car = SCI1S1;
0 项奖励
回复

482 次查看
DavidoBG
Contributor II

More explanations

Before RX_car = SCID so SCI1S1 =>PF=0; FE=0; NF=0; OR=0; IDLE=1; RDRF=1; TC=1; TDRE=1

After RX_car = SCID so SCI1S1 =>PF=0; FE=0; NF=0; OR=0; IDLE=0; RDRF=0; TC=1; TDRE=1

so if (RX_car & 7) always true!!!

0 项奖励
回复