This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using RTC on MSP430F47166. Reading the RTC clarification.

Hi,

I am getting conflicting information on TI’s user guide and the examples provided for the RTC.

The example shows no majority sampling:
  while (1)
  {
    __bis_SR_register(LPM3_bits + GIE); // Enter LPM3 w/ interrupt
    __no_operation();                   // Required for debugger

    tx_char((RTCHOUR>>4)+0x30);         // Send high nibble of hour
    tx_char((RTCHOUR&0x0F)+0x30);       // Send low nibble of hour
    tx_char(':');                       // Send ':'
    tx_char((RTCMIN>>4)+0x30);          // Send high nibble of minute
    tx_char((RTCMIN&0x0F)+0x30);        // Send low nibble of minute
    tx_char('\n');                      // Send new line
  }

While the user guide clearly states that unpredictable results can occur when the counter clock is async to the CPU clock (as is the case in my instance).

Note: Accessing the Real-Time Clock registers
When the counter clock is asynchronous to the CPU clock, any read from any
counting register should occur while the counter is not operating. Otherwise,
the results may be unpredictable. Alternatively, the counter may be read
multiple times while operating, and a majority vote taken in software to
determine the correct reading.

Can someone please clarify? Should I be using a majority-vote scheme and if so, how many reads are required?

Thanks

 

  • DDDD SSSS said:
    Can someone please clarify? Should I be using a majority-vote scheme and if so, how many reads are required?

    If you read the registers while the counte ris in teh process of updating, any value can appear in the register (racing condition on the digit-to-digit rollover).

    I suggest takign 4 reads, so at least two are identical. It is unlikely (unless the two clocks are close but not in sync) that more than one read in a sequence of four fails, so either the first two or the last two (or 3 or all four) are identical and valid. if you only take three smaples, one could be before, one during and one after the register update, so all three could differ.

**Attention** This is a public forum