Rx interrupt error

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Rx interrupt error

1,611件の閲覧回数
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 返答(返信)

617件の閲覧回数
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 件の賞賛
返信

617件の閲覧回数
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 件の賞賛
返信