AnsweredAssumed Answered

Request for advice on elegant usage of RXEDGIE/F in SCI

Question asked by David Haigh on May 1, 2012
Latest reply on May 3, 2012 by David Haigh

I'm developing application software for a low-cost, low-power sensor product, using an MC9S08QE8.  I'm a fairly experienced developer, but I'm using this product for the first time.

 

The micro stays in STOP3 mode for the vast majority of its life, waking only briefly once every second to monitor AtoDs, do signal processing, make decisions, etc.

 

I need to use the SCI to Rx/Tx using very simple protocol (2 bytes in, one out), very occasionally.   My intention is to wake the micro from STOP3 using an interrupt from RXEDGIF, then use RDRF/TDRE/TC to complete the very standard Rxn and Txn.  I've used a similar SCI before, but have never used the RXEDGIF/E feature.

 

After some fiddling and head scratching, I have it working, but I'm not really happy with the solution.  RXEDGIF is set on every -ve edge on the Rxd pin, so, as I only want to use it to wake the micro, I clear RXEDGIE after the first interrupt from RXEDGIF.  However, this seems a cumbersome process as RXEDGIE is located in the baud rate register, which requires both bytes to be written (high then low).  Once my Rxn & Txn is complete I then have to rewrite the whole 16-bit baud rate just to set RXEDGIE for the next sequence.  Also RXEDGIF is still set on every -ve Rxd edge so I have to ignore this flag each time I get an RDRF interrupt, as they share the same vector.

 

Questions:

1) Can RXEDGIE be set/cleared without writing to both high and low baud rate registers?

2) Can anyone suggest a more elegant solution to this problem?

3) Why is RXEDGIF (among others) cleared by writing a 1 to it?

Outcomes