Problem when using UART (eTPU) function

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

Problem when using UART (eTPU) function

1,222件の閲覧回数
Wu
Contributor I
Hi All,
I think this is a sample question.
 
I  am using 'fs_etpu_uart_read_receive_data' eTPU function to receive data.
 
Here is the code:
 
 uint32 data = 0;
 uint8_t errCode = 1;
 while(1)
 {  
  data = fs_etpu_uart_read_receive_data(11, &errCode);
  if (errCode == 0)
  {
     //Postion 1
      .........
      .........
      return 1;
  }
If I sent just one byte from other side, my code will always reach 'Postion 1' and return the same data value.
It seems that I missed to clear a flag after I receive each byte.
 
Could anyone point out what is wrong in my code?
 
Thanks,
 
Ben
 
ラベル(1)
0 件の賞賛
1 返信

346件の閲覧回数
Arev
Contributor III
Hello,
 
After reading the Received Data, you must Clear the Channel Interrupt Bit, Write CIS/CIC bit = 1 in the eTPU Channel Status Control Register ETPU_CnSCR[].
 
Something like : ETPU.CHAN[ETPU_UART0_RX].SCR.B.CIS = 1;
 
Bye

 
0 件の賞賛