Rx interrupt error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rx interrupt error

1,416 Views
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
Labels (1)
0 Kudos
2 Replies

422 Views
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 Kudos

422 Views
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 Kudos