File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,12 @@ bool SERCOM::isFrameErrorUART()
152152  return  sercom->USART .STATUS .bit .FERR ;
153153}
154154
155+ void  SERCOM::clearFrameErrorUART ()
156+ {
157+   //  clear FERR bit writing 1 status bit
158+   sercom->USART .STATUS .bit .FERR  = 1 ;
159+ }
160+ 
155161bool  SERCOM::isParityErrorUART ()
156162{
157163  // PERR : Parity Error
Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ class SERCOM
158158		bool  availableDataUART ( void  ) ;
159159		bool  isBufferOverflowErrorUART ( void  ) ;
160160		bool  isFrameErrorUART ( void  ) ;
161+ 		void  clearFrameErrorUART () ;
161162		bool  isParityErrorUART ( void  ) ;
162163		bool  isDataRegisterEmptyUART ( void  ) ;
163164		uint8_t  readDataUART ( void  ) ;
Original file line number Diff line number Diff line change @@ -90,6 +90,13 @@ void Uart::flush()
9090
9191void  Uart::IrqHandler ()
9292{
93+   if  (sercom->isFrameErrorUART ()) {
94+     //  frame error, next byte is invalid so read and discard it
95+     sercom->readDataUART ();
96+ 
97+     sercom->clearFrameErrorUART ();
98+   }
99+ 
93100  if  (sercom->availableDataUART ()) {
94101    rxBuffer.store_char (sercom->readDataUART ());
95102
@@ -114,7 +121,6 @@ void Uart::IrqHandler()
114121  if  (sercom->isUARTError ()) {
115122    sercom->acknowledgeUARTError ();
116123    //  TODO: if (sercom->isBufferOverflowErrorUART()) ....
117-     //  TODO: if (sercom->isFrameErrorUART()) ....
118124    //  TODO: if (sercom->isParityErrorUART()) ....
119125    sercom->clearStatusUART ();
120126  }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments