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.

Help for RTC_C module in MSP430-it doesn't update after a power cycle

Other Parts Discussed in Thread: MSP430F6779A, MSP430F6779, MSP430F6776

Hello,

My Application require a datalogger with time-stamp.I wanted to use the chip : MSP430F6779A and it's on chip RTC_C module in calender mode for the time -stamp part.

I am following the App Notes "Implementation of a Three-Phase Electronic Watt-Hour Meter Using the MSP430F677x(A)" SLAA577F and it's associated code library.

And connected a external 3.3V Battery on AUXVCC3 pin of the chip and also connected a 0.47uF capacitor as suggested in datasheet.32.768kHz crystal on xt1.

Form the ref. TI  code library , i have seen that , on power up initialization it doesn't update  "rtc" variables from the RTC h/w registers e.g RTCSEC , RTCMIN etc. on power-up ( don't know why it's skipped ?)

In my implementation i have modified (the referred library code) for the power up intialization for RTC. rest of the files are same.

         Here i would prefer to read RTC h/w register and then update internal rtc variables.In library they are not doing this may be rtc variables are mapped to INFO memory.

          RTCCTL0_H = RTCKEY_H;                  // Unlock RTC
          rtc.second =RTCSEC;
          rtc.minute =RTCMIN;
          rtc.hour=RTCHOUR;
          rtc.day=RTCDAY;
          rtc.month=RTCMON;
          rtc.year = RTCYEAR - 0x2000;
          RTCCTL13 &= ~RTCHOLD;                   // Enable RTC
          RTCCTL13 = RTCBCD+RTCMODE+RTCTEV_0; // Init RTC
          RTCCTL0_H = 0;   // LOCK RTC

  in the main loop i would read and display rtc.sec , rtc.min , rtc.hour variables as they are updating as part of RTC_C 1 sec interrupt.Once i set a correct time   and date , rtc structure variable would display the correct date & time.

But when i switch off the device ( assumed that 3.3V external battery would supply the crystal and RTC_C module) and switch on , say, after 3 minutes or so , i found that displayed time and date is exactly what i have seen at the time of switch off the device.My understanding is that BAT would backup the RTC_C module and internally RTCSEC,RTCHOUR, etc registers would be counting & so i have read those registers on power up. Even i have checked the AUXVCC3 voltage on the MCU pin to be 3.3V.

One point to mention that , I didn't set RTCDOW register. is  that be a  reason that RTC h/w registers were not updated during AUXVCC3 battery powered. I don't require any LPM mode also.

plz suggest where i have gone wrong and possible causes.

Appreciate your valuable response.

Regards,

Ars

  • Ars,

    If the software file was provided by the SLAA577F, then I don't imagine that you would have to change the RTC header to get the function to work. I did notice, however, that there are very meticulous instructions on how to get the AUXVCC3 header to power the device in certain cases, so I would ask that you review the jumpers that are required to be place/removed, and the correct software changes that are specified in the table found in Section 5.1.2 Power Supply Options and Jumper Settings. Hope this helps!

    Regards,
    Michael Arriete
  • Hi Michael,
    thnks for your suggestion.There is a correction...Chip is msp430f6779. Anyway this is my designed board and i have followed the concept of EVM as memtioned in 5.1.2 to power up the RTC module.As i said in my earlier post Auxvcc3 pin connected to 3.3 coin cell thru' a diode as shown in EVM schematic.Even i could able to measure the voltage on that Auxvcc3 pin as approx 3 V when device is in powr off state... And i didn't change the rtc header file. As i could see from the code library that on power up it doesn't read the rtc value from the internal H/W RTC register , I only add few lines of code to read those register...... Hence i came to know that those registers retained the rtc values which were last counted value at the time of power off...What could hv gone wrong for RTC h/w registers not being updated between power cycle. Anything to do with LOCKBAK bit...

    Rgds,
    Ars....
  • Ars,

    After talking with one of the creators of the App Note you are following, he has guided me to two documents that could prove useful for you.

    1) A TI Design for an Aux Module that would be a better example on how to use the RTC module:
    www.ti.com/.../tidu452.pdf

    2) A F67xx -> F67xxA Migration Guide:
    www.ti.com/.../slaa666.pdf

    I found a paragraph of interest within the Migration document that might be helpful in figuring out your problem:

    "One benefit of this RTCLOCK feature is that it prevents having to clear the RTCHOLD bit after a POR
    reset. This prevents the RTC from being stopped when exposed to a pulse on VCC that is long enough to
    set the RTCHOLD bit but not long enough to allow software to clear RTCHOLD. For instance, if a battery
    is connected to AUXVCC3 only, AUXVCC1 and AUXVCC2 are not used as alternative power supplies,
    and power is lost at DVCC/AVCC, the RTC would still continue to count. However, when power is
    restored, a POR event would occur and the RTCHOLD bit would automatically be set causing the RTC to
    be turned OFF. This RTCHOLD bit should be cleared as soon as possible so that the RTC can continue
    counting from where it was before RTCHOLD was set. As a result of having to turn off RTCHOLD, the
    RTC time is off by the time difference between when the RTCHOLD bit was set and when it was cleared
    in software. Additionally, there could be a case where power at DVCC/AVCC is restored long enough so
    that RTCHOLD is set but not long enough for the software to clear this bit, thereby causing the RTC to
    stop. However, with the RTCLOCK feature there is no need to clear the RTCHOLD bit, thereby preventing
    this from happening."

    Let me know if this solves your issue!

    Regards,
    Michael Arriete
  • Hi Michael,

    Thanks for this information & for your support.

    I was about to bring out this fact. I have already referred those App Notes and accordingly used RTCLOCK bit.I have set the RTCLOCK bit in the RTC_C initialization routine  and as well as in the routine where user was setting RTC value from a GUI / Display.This bit helped me in solving the issue in only "MSP430F6779A"device as this bit is only available for this device ( luckily i had a sample of this "A" device).

    "Non-A" device i.e MSP430F6779 has this "bit" Reserved and we can't access it.. So problem remains same with that device. I could able to solve the issue in MSP430F6779A only.

    Does TI has any solution for MSP430F6779. ? or that I have to shift MSP430F6779A device to use the RTC_C ...

    I too agree with you that RTCHOLD might have been set while power off ....so not counting up the the registers while power off mode ( but AUXVCC3 battery backup)... But then what is the solution?

    1. Does this "Non-A" device has a bug for RTC_C module ?

    2. TI should  highlight  the necessity of "RTCLOCK" bit with supported example code for MSP430F677x A device. My   MSP430F677x A RTC code is not fully functional without this bit.

    Again , Thank you very much and looking for a solution for MSP430F6779  ( without 'A') device , if any.

    Regards,

    ars...

  • Ars,

    As of right now, it might be better to shift to the MSP430F6779A device. I'll continue looking for a solution for the non-A version in the meantime.

    Regards,
    Michael Arriete
  • Ars,

    There is a similar thread that might have a solution for your problem with the MSP430F6779 device and using both AUXVCC3 with RTC_C. Look through the thread and see if any of the recommendations fix your issue. It might just end up being that you need to have the A version to have it run correctly without extra work. Let me know what you think!

    e2e.ti.com/.../453023

    Sincerely,
    Michael Arriete
  • Michael,

    Thanks for your support  on rtc issue.

    But the thread , you mentioned , is not similar to my case on  RTC_C not working, for the simple reason that I don't find any difficulty in running & getting into RTC  1 sec ISR routine nor do i face oscillator fault. As you can see from my previous posts , RTC_C on my device( MSP430F6779) just functions okay when DVCC or mains supply is available.But after a power cycle ( i kept the device off for 5 minutes then switched on ) i found that  RTC didn't updated from it's last counted value( at the time of powering off) . That means it retains the value because of AUXVCC3 ( a battery connected in my case ) .so i am suspecting that during powering off , somehow RTCHOLD bit might have set to 1.I am using IAR c compiler.I even tried to reset RTCHOLD bit to zero in low_level_init() function.but no success.

    Can you list what would be the probable reason that RTCHOLD bit set (let's say) while power off.

    Plz check internally with your TI team, really RTC_C is functional in all respect on this "non-A" version of this chip.My experiment with the device says "NO".Correct me if i have missed out any steps in my experiment or suggest any work around.I don't even find any errata on this.Parallely I am building my application based on "A" device. i.e MSP430F6779A.Ofcourse RTC_C is functional in this chip with the help of RTCLOCK bit.

    Regards,

    Ars

  • Ars,

    Sorry for the late reply! The following is some new information that has come to light that might be of some use to you:

    "RTCHOLD is set not when the power is lost but when it returns. As a result, the RTC should continue to count when the power is OFF. However, when power returns RTCHOLD is set and would have to be cleared immediately so that the RTC could continue counting. In the TI Design there should be a code example that has this implemented in case the RTCLOCK feature is not enabled (for devices like the non-A F67cc chips)."

    Sincerely,
    Michael Arriete
  • I have a similar issue, is there any updates on this?

    For reference I am using the MSP430F6776.
  • Hi,
    I did RTC with MSP430F6779, Its working perfect.
    Please check my discussed thread : e2e.ti.com/.../1727818

    Regards
    Bhvdipsinh
  • Hi Ars,

    i am getting the same problem as the rtc_c module is not getting updated after power off but i am using msp430f6779a as per this thread u had solve the issue for map430f6779a, so can u plzz send me the code snippet or tell me how to do it... i need urgent help i m on a project...

    #if defined(RTC_SUPPORT)
          if (!check_rtc_sumcheck())
          {
            
            rtc.year   = 0x11;
            rtc.month  = 0x03;
            rtc.day    = 0x1C;
            rtc.hour   = 0x02;
            rtc.minute = 0x03;
            rtc.second = 0x04;
            set_rtc_sumcheck();
        #if defined(__MSP430_HAS_RTC_C__) || defined(__MSP430_HAS_RTC_CE__)
           
              RTCCTL0_H = RTCKEY_H;                  // Unlock RTC
            if (RTCCTL0 & RTCOFIFG){  // init if RTCOFIFG is set
              RTCCTL13 = RTCBCD+RTCHOLD+RTCMODE+RTCTEV_0; // Init RTC
              RTCCTL0_L &= ~RTCOFIFG_L;                                                    //RTCCTL0_L &= ~RTCOFIFG_L;   // Clear Flag
              RTCSEC  = rtc.second;
              RTCMIN  = rtc.minute;                 //rtc.minute = RTCMIN;
              RTCHOUR = rtc.hour;                   //rtc.hour = RTCHOUR;
            //    RTCDOW   = rtc.DayOfWeek;
              RTCDAY   = rtc.day;
              RTCMON   = rtc.month;
              RTCYEAR  = rtc.year + 0x2000;
              RTCCTL13 &= ~RTCHOLD;                   // Enable RTC
            }
           else
            {
             
              RTCCTL13 = RTCBCD+RTCMODE+RTCTEV_0; // Init RTC
            }
            RTCCTL0_H = 0;   // LOCK RTC
        #endif
        }
        #endif

    plzz kindly help me ,,,,,,,,

    thanxx..

    regards,

    sumit,,,,, 

**Attention** This is a public forum