Jeff Smith

SCI - OR flg but no RDRF

Discussion created by Jeff Smith on Jun 2, 2006
Latest reply on Jun 5, 2006 by Jeff Smith
I have told someone before, concerning SCI interrupts, that I did not think OR would ever be set without RDRF being also set. I hope that doesn't mess them up, because I had it happening to me which caused trouble.

I finally think I figured out how it works (correct me if I'm wrong):

The OR is cleared the same way that RDRF is cleared, and also will never be set unless RDRF is still set as another byte is received. That fooled me into thinking it will always be cleared at the same time RDRF is cleared. There is good reason why my assumption was false.

To clear either flag,
  1. read SCISR1 while the flag is set
  2. read SCIDRL
See, the key that makes a difference is this phrase, "while the flag is set". Since there are two seperate steps which take time, the OR could happen between the two steps. Since status was read with only RDRF set, the OR could still happen up to the point of reading data, and not clear because software has not yet detected the OR.

The only way I see to ensure clearing OR in the same ISR call instead of a separate call is to test for OR (and not RDRF) immediately after reading SCIDRL received.

Hope this helps others.

Outcomes