Problem when using UART (eTPU) function

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem when using UART (eTPU) function

1,045 Views
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
 
Labels (1)
0 Kudos
1 Reply

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