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.

MSP430f67791 RTC not count after power cut off

Other Parts Discussed in Thread: MSP430F6779A, MSP430F67791A, MSP430F67791

Hi All,

I have a similar problem, that was in e2e.ti.com/.../1728640 post, but my RTC don't reset after power off - it stop and continue after power on. 

I connect 3V battering to AUXVCC3 pin via diode. I try to transfer code to LPM3.5 before power off, but it not work. 

I found good example, that realy work on my device -

void main (void)
{
    WDTCTL = WDTPW | WDTHOLD;               // Stop WDT

    AUX3CHCTL = AUXCHKEY | AUXCHC_1 | AUXCHV_1 | AUXCHEN;  // Enable Charger for AUX3 to enable RTC

    if (SYSRSTIV == SYSRSTIV_LPM5WU)
    {
        // When woken up from LPM3.5, reinit since LPMx.5 will cause a BOR.
        PMMCTL0_H = PMMPW_H;                // open PMM
        PM5CTL0 &= ~LOCKIO;                 // Clear LOCKBAK and enable ports
        PMMCTL0_H = 0x00;                   // close PMM
    }

    // Initialize LFXT1
    UCSCTL6 &= ~(XT1OFF);                   // Enable XT1
    UCSCTL6 |= XCAP_3;                      // Internal load cap

    // Loop until XT1, XT2 & DCO fault flag is cleared
    do
    {
        UCSCTL7 &= ~(XT2OFFG | XT1LFOFFG | DCOFFG);
        // Clear XT2,XT1,DCO fault flags
        SFRIFG1 &= ~OFIFG;                  // Clear fault flags
    } while (SFRIFG1 & OFIFG);              // Test oscillator fault flag
    
    // Configure RTC_C
    RTCCTL0_H = RTCKEY_H;                   // Unlock RTC_C module
    RTCCTL1 |=  RTCHOLD; // BCD mode, RTC hold, Set RTCTEV for 1 minute alarm
                                   // event interrupt
    RTCYEAR = 2016;                       // Year = 0x2011
    RTCMON = 10;                          // Month = 0x10 = October
    RTCDAY = 07;                          // Day = 0x07 = 7th
    RTCDOW = 05;                          // Day of week = 0x05 = Friday
    RTCHOUR = 11;                         // Hour = 0x11
    RTCMIN = 27;                          // Minute = 0x59
    RTCSEC = 00;                          // Seconds = 0x45

    RTCCTL1 &= ~(RTCHOLD);                  // Start RTC calendar mode
    RTCCTL0_H = 0;   

    // Enter LPM3.5
    UCSCTL6 |= XT1OFF;                      // Turn off clock for LPMx.5 operation. ACLK will still
                                            // remain active
    PMMCTL0_H = PMMPW_H;                    // Open PMM Registers for write  
    PMMCTL0_L |= PMMREGOFF;                 // and set PMMREGOFF
    __disable_interrupt(); 
    __bis_SR_register(LPM4_bits);     // Enter LPM3.5 mode with interrupts enabled
    __no_operation();

    // Code should NOT get here. This means that LPM3.5 was not properly entered.
    // Ensure that an external power supply was ued. Or else JTAG will put the CPU
    // in LPM0 mode.

    // Stop the RTC
    RTCCTL0_H = RTCKEY_H;                   // Unlock RTC_C module
    RTCCTL1 |= RTCHOLD;                     // RTC hold
    RTCCTL0_H = 0;                          // Lock RTC_C module

    while(1)
    {
        __delay_cycles(1000);             // Delay
    }
}

In this example RTC continue count after power off, but if I add(for example) some initialization of somethig(for example TimerA3) I'll get old problem

void main (void)
{
    WDTCTL = WDTPW | WDTHOLD;               // Stop WDT

    AUX3CHCTL = AUXCHKEY | AUXCHC_1 | AUXCHV_1 | AUXCHEN;  // Enable Charger for AUX3 to enable RTC

    if (SYSRSTIV == SYSRSTIV_LPM5WU)
    {
        // When woken up from LPM3.5, reinit since LPMx.5 will cause a BOR.
        PMMCTL0_H = PMMPW_H;                // open PMM
        PM5CTL0 &= ~LOCKIO;                 // Clear LOCKBAK and enable ports
        PMMCTL0_H = 0x00;                   // close PMM
    }

    // Initialize LFXT1
    UCSCTL6 &= ~(XT1OFF);                   // Enable XT1
    UCSCTL6 |= XCAP_3;                      // Internal load cap

    // Loop until XT1, XT2 & DCO fault flag is cleared
    do
    {
        UCSCTL7 &= ~(XT2OFFG | XT1LFOFFG | DCOFFG);
        // Clear XT2,XT1,DCO fault flags
        SFRIFG1 &= ~OFIFG;                  // Clear fault flags
    } while (SFRIFG1 & OFIFG);              // Test oscillator fault flag
    
    // Configure RTC_C
    RTCCTL0_H = RTCKEY_H;                   // Unlock RTC_C module
    RTCCTL1 |=  RTCHOLD; // BCD mode, RTC hold, Set RTCTEV for 1 minute alarm
                                   // event interrupt
    RTCYEAR = 2016;                       // Year = 0x2011
    RTCMON = 10;                          // Month = 0x10 = October
    RTCDAY = 07;                          // Day = 0x07 = 7th
    RTCDOW = 05;                          // Day of week = 0x05 = Friday
    RTCHOUR = 11;                         // Hour = 0x11
    RTCMIN = 27;                          // Minute = 0x59
    RTCSEC = 00;                          // Seconds = 0x45

    RTCCTL1 &= ~(RTCHOLD);                  // Start RTC calendar mode
    RTCCTL0_H = 0;   

    TA3CTL = TASSEL_2 | MC_2 | TACLR;

    // Enter LPM3.5
    UCSCTL6 |= XT1OFF;                      // Turn off clock for LPMx.5 operation. ACLK will still
                                            // remain active
    PMMCTL0_H = PMMPW_H;                    // Open PMM Registers for write  
    PMMCTL0_L |= PMMREGOFF;                 // and set PMMREGOFF
    __disable_interrupt(); 
    __bis_SR_register(LPM4_bits);     // Enter LPM3.5 mode with interrupts enabled
    __no_operation();

    // Code should NOT get here. This means that LPM3.5 was not properly entered.
    // Ensure that an external power supply was ued. Or else JTAG will put the CPU
    // in LPM0 mode.

    // Stop the RTC
    RTCCTL0_H = RTCKEY_H;                   // Unlock RTC_C module
    RTCCTL1 |= RTCHOLD;                     // RTC hold
    RTCCTL0_H = 0;                          // Lock RTC_C module

    while(1)
    {
        __delay_cycles(1000);             // Delay
    }
}

Who knows why this is happening? Thanks

  • Hi Andrei,

    The only difference between the working and non-working code is one line which initializes TA3? Does any other kind of peripheral initialization also break your code? It is worth noting that TA3 will not work in LPM3.5 with SMCLK as the source. I see that Bhavdipsinh is replying to your queries on the other thread, please be sure to follow his advice as well.

    Regards,
    Ryan
  • Hi Ryan, thank for reply

    I know that TA3 will not work in LPM 3.5, I init it only for example. I try to init comparator_B,  TA0, TA2 and get non-working RTC after power off. This programm is example from ti.com site with some corrections (

    http://dev.ti.com/tirex/#/Package/MSPWare?link=MSPWare%2FDevices%2FMSP430F5XX_6XX%2FMSP430F67791%2FPeripheral%20Examples%2FRegister%20Level%2FMSP430F677x_RTC_02.c

    ) and it's works, but if I want to add some code RTC is breaks.

    If you're interesting how I check RTC working look at this code-

    #include <msp430.h>
    
    void main (void)
    {
        WDTCTL = WDTPW | WDTHOLD;               // Stop WDT
    
        AUX3CHCTL = AUXCHKEY | AUXCHC_1 | AUXCHV_1 | AUXCHEN;  // Enable Charger for AUX3 to enable RTC
    
        if (SYSRSTIV == SYSRSTIV_LPM5WU)
        {
            // When woken up from LPM3.5, reinit since LPMx.5 will cause a BOR.
            PMMCTL0_H = PMMPW_H;                // open PMM
            PM5CTL0 &= ~LOCKIO;                 // Clear LOCKBAK and enable ports
            PMMCTL0_H = 0x00;                   // close PMM
        }
    
        // Initialize LFXT1
        UCSCTL6 &= ~(XT1OFF);                   // Enable XT1
        UCSCTL6 |= XCAP_3;                      // Internal load cap
    
        // Loop until XT1, XT2 & DCO fault flag is cleared
        do
        {
            UCSCTL7 &= ~(XT2OFFG | XT1LFOFFG | DCOFFG);
            // Clear XT2,XT1,DCO fault flags
            SFRIFG1 &= ~OFIFG;                  // Clear fault flags
        } while (SFRIFG1 & OFIFG);              // Test oscillator fault flag
    
        if (RTCMIN > 27)
        {
            // Configure RTC_C
            RTCCTL0_H = RTCKEY_H;                   // Unlock RTC_C module
            RTCCTL0_L |= RTCTEVIE;                  // Enable RTC time event interrupt
            RTCCTL1 |=  RTCHOLD; // BCD mode, RTC hold, Set RTCTEV for 1 minute alarm
            // event interrupt
            RTCYEAR = 2016;                       // Year = 0x2011
            RTCMON = 10;                          // Month = 0x10 = October
            RTCDAY = 07;                          // Day = 0x07 = 7th
            RTCDOW = 05;                          // Day of week = 0x05 = Friday
            RTCHOUR = 11;                         // Hour = 0x11
            RTCMIN = 27;                          // Minute = 0x59
            RTCSEC = 45;                          // Seconds = 0x45
    
            RTCCTL1 &= ~(RTCHOLD);                  // Start RTC calendar mode
            RTCCTL0_H = 0;
            P2DIR |= BIT4;
            while(1)
            {
                P2OUT ^= BIT4;
                __delay_cycles(1000);
            }
        }
        // Configure RTC_C
        RTCCTL0_H = RTCKEY_H;                   // Unlock RTC_C module
        RTCCTL0_L |= RTCTEVIE;                  // Enable RTC time event interrupt
        RTCCTL1 |=  RTCHOLD; // BCD mode, RTC hold, Set RTCTEV for 1 minute alarm
                                       // event interrupt
        RTCYEAR = 2016;                       // Year = 0x2011
        RTCMON = 10;                          // Month = 0x10 = October
        RTCDAY = 07;                          // Day = 0x07 = 7th
        RTCDOW = 05;                          // Day of week = 0x05 = Friday
        RTCHOUR = 11;                         // Hour = 0x11
        RTCMIN = 27;                          // Minute = 0x59
        RTCSEC = 45;                          // Seconds = 0x45
    
        RTCCTL1 &= ~(RTCHOLD);                  // Start RTC calendar mode
        RTCCTL0_H = 0;   
    
        // Enter LPM3.5
        UCSCTL6 |= XT1OFF;                      // Turn off clock for LPMx.5 operation. ACLK will still
                                                // remain active
        PMMCTL0_H = PMMPW_H;                    // Open PMM Registers for write  
        PMMCTL0_L |= PMMREGOFF;                 // and set PMMREGOFF
        __disable_interrupt(); 
        __bis_SR_register(LPM4_bits);     // Enter LPM3.5 mode with interrupts enabled
        __no_operation();
    
        // Code should NOT get here. This means that LPM3.5 was not properly entered.
        // Ensure that an external power supply was ued. Or else JTAG will put the CPU
        // in LPM0 mode.
    
        // Stop the RTC
        RTCCTL0_H = RTCKEY_H;                   // Unlock RTC_C module
        RTCCTL1 |= RTCHOLD;                     // RTC hold
        RTCCTL0_H = 0;                          // Lock RTC_C module
    
        while(1)
        {
            __delay_cycles(1000);             // Delay
        }
    }
    
    #pragma vector=RTC_VECTOR
    __interrupt void rtc_isr(void)
    {
        switch (__even_in_range(RTCIV, 16))
        {
            case RTCIV_NONE:                    // No interrupts
                break;
            case RTCIV_RTCOFIFG:                // RTCOFIFG
                break;
            case RTCIV_RTCRDYIFG:               // RTCRDYIFG
                break;
            case RTCIV_RTCTEVIFG:               // RTCEVIFG
                break;
            case RTCIV_RTCAIFG:                 // RTCAIFG
                break;
            case RTCIV_RT0PSIFG:                // RT0PSIFG
                break;
            case RTCIV_RT1PSIFG:                // RT1PSIFG
                break;
    //        case 14: break;                     // Reserved
            case 16: break;                     // Reserved
            default: break;
        }
    }

    I turn on device and check PWM on p2.4. At first start I set 27 minutes and 45 second, then I power cut off and wait 20 second and turn on device again, if I have PWM on p2.4 - RTC is work. And it work before I add some initialization in code

  • Hi ,

    Its great to know that your code working.

    From above code which is not working properly, I found some points and would like to focus on it.

    1. You will find RTC value as per setting after power off and on, that means your RTC and Crystal block is working and H/W part is perfect.

    2. Actually your RTC is Increment the values but, (from your code) You are initialize RTC again at time of Power On and reset the values (Minute =27) (Please check for 5 minutes put your board On then off for 5 minutes then power On and check value If minute = 27 then I am right).

    So you need to change it in your code to initialize values of RTC register at once then rest of time only initialize only RTC (without changing the registers value)

    I hope it will work.

    Regards

    Bhavdipsinh

  • Dear Bhavdipsinh, I think that you read my post not attentively. I can delete initialization of RTC as you advise to me, but it useless. Problem is that RTC stop increment after add some initialization code to my programm. After adding some initialization of something(I test with Timer_A initialization) RTC stop increment  after power cut off.  If I will not find reason of this problem I want to change msp430f67791 to msp430f67791A or to msp430f6779A in future, I think that it MCU problem

  • Hi Andrei Zaitsau (4197185)

    will you provide result of below condition. I would like to go step by. 

    " (Please check for 5 minutes put your board On then off for 5 minutes then power On and check value If minute = 27 then I am right)."

    Also "If(Minute >27) condition makes reset the values of your RTC parameters values.

    Thanks

    Bhavdipsinh

  • Ok, there is result of your advise. I modified programm, I delete 

    if (RTCMIN > 27)
        {
            // Configure RTC_C
            RTCCTL0_H = RTCKEY_H;                   // Unlock RTC_C module
            RTCCTL0_L |= RTCTEVIE;                  // Enable RTC time event interrupt
            RTCCTL1 |=  RTCHOLD; // BCD mode, RTC hold, Set RTCTEV for 1 minute alarm
            // event interrupt
            RTCYEAR = 2016;                       // Year = 0x2011
            RTCMON = 10;                          // Month = 0x10 = October
            RTCDAY = 07;                          // Day = 0x07 = 7th
            RTCDOW = 05;                          // Day of week = 0x05 = Friday
            RTCHOUR = 11;                         // Hour = 0x11
            RTCMIN = 27;                          // Minute = 0x59
            RTCSEC = 45;                          // Seconds = 0x45
    
            RTCCTL1 &= ~(RTCHOLD);                  // Start RTC calendar mode
            RTCCTL0_H = 0;
            P2DIR |= BIT4;
            while(1)
            {
                P2OUT ^= BIT4;
                __delay_cycles(1000);
            }
        }

    and now I have only 

        // Configure RTC_C
        RTCCTL0_H = RTCKEY_H;                   // Unlock RTC_C module
        RTCCTL1 =  RTCMODE + RTCHOLD;
        // event interrupt
        RTCYEAR = 2016;                       // Year = 0x2011
        RTCMON = 10;                          // Month = 0x10 = October
        RTCDAY = 07;                          // Day = 0x07 = 7th
        RTCDOW = 05;                          // Day of week = 0x05 = Friday
        RTCHOUR = 11;                         // Hour = 0x11
        RTCMIN = 27;                          // Minute = 0x59
        RTCSEC = 30;                          // Seconds = 0x45
    
        RTCCTL1 &= ~(RTCHOLD);                  // Start RTC calendar mode
        RTCCTL0_H = 0;

    on start up programm. And now I make steps, that you told me to do.

    I power On device(set 27 minutes) and wait 5 minutes(32 minutes), then power Off device and wait 5 minutes(37 minutes). Before power On I connect MSP FET430UIF to my device and set break point at first line and look at RTC registers -> I saw RTCMIN==37, OK! 

    But then I add this line before RTC init

    TA0CTL = TASSEL_2 | MC_1 | TACLR;       // SMCLK, up mode, clear TAR

    for example and do again previous steps. Now I see RTCMIN==32.

    I tried many kinds of RTC initialization (add RTC events, enable GIE and oth.), but always got this result

  • thanks for your information.

    Sorry, I didnt get your microcontroller number, Please share it with your full code, I will check it and reply.

    Regards

    Bhavdipsinh

  • Thank you for reply,

    my MCU is MSP430F67791IPZ  - 

    #include <msp430.h>
    
    void main (void)
    {
        WDTCTL = WDTPW | WDTHOLD;               // Stop WDT
    
        AUX3CHCTL = AUXCHKEY | AUXCHC_1 | AUXCHV_1 | AUXCHEN;  // Enable Charger for AUX3 to enable RTC
    
        if (SYSRSTIV == SYSRSTIV_LPM5WU)
        {
            // When woken up from LPM3.5, reinit since LPMx.5 will cause a BOR.
            PMMCTL0_H = PMMPW_H;                // open PMM
            PM5CTL0 &= ~LOCKIO;                 // Clear LOCKBAK and enable ports
            PMMCTL0_H = 0x00;                   // close PMM
        }
    
        // Initialize LFXT1
        UCSCTL6 &= ~(XT1OFF);                   // Enable XT1
        UCSCTL6 |= XCAP_3;                      // Internal load cap
    
        // Loop until XT1, XT2 & DCO fault flag is cleared
        do
        {
            UCSCTL7 &= ~(XT2OFFG | XT1LFOFFG | DCOFFG);
            // Clear XT2,XT1,DCO fault flags
            SFRIFG1 &= ~OFIFG;                  // Clear fault flags
        } while (SFRIFG1 & OFIFG);              // Test oscillator fault flag
    
        //TA0CTL = TASSEL_2 | MC_1 | TACLR;       // SMCLK, up mode, clear TAR
        
        // Configure RTC_C
        RTCCTL0_H = RTCKEY_H;                   // Unlock RTC_C module
        RTCCTL1 =  RTCMODE + RTCHOLD;
        // event interrupt
        RTCYEAR = 2016;                       // Year = 0x2011
        RTCMON = 10;                          // Month = 0x10 = October
        RTCDAY = 07;                          // Day = 0x07 = 7th
        RTCDOW = 05;                          // Day of week = 0x05 = Friday
        RTCHOUR = 11;                         // Hour = 0x11
        RTCMIN = 27;                          // Minute = 0x59
        RTCSEC = 30;                          // Seconds = 0x45
    
        RTCCTL1 &= ~(RTCHOLD);                  // Start RTC calendar mode
        RTCCTL0_H = 0;
    
        // Enter LPM3.5
        UCSCTL6 |= XT1OFF;                      // Turn off clock for LPMx.5 operation. ACLK will still
        // remain active
        PMMCTL0_H = PMMPW_H;                    // Open PMM Registers for write
        PMMCTL0_L |= PMMREGOFF;                 // and set PMMREGOFF
        __disable_interrupt();
        __bis_SR_register(LPM4_bits);     // Enter LPM3.5 mode with interrupts enabled
        __no_operation();
    
        // Code should NOT get here. This means that LPM3.5 was not properly entered.
        // Ensure that an external power supply was ued. Or else JTAG will put the CPU
        // in LPM0 mode.
    
        // Stop the RTC
        RTCCTL0_H = RTCKEY_H;                   // Unlock RTC_C module
        RTCCTL1 |= RTCHOLD;                     // RTC hold
        RTCCTL0_H = 0;                          // Lock RTC_C module
    
        while (1)
        {
            __delay_cycles(1000);             // Delay
        }
    }
    
    #pragma vector=RTC_VECTOR
    __interrupt void rtc_isr(void)
    {
        switch (__even_in_range(RTCIV, 16))
        {
        case RTCIV_NONE:                    // No interrupts
            break;
        case RTCIV_RTCOFIFG:                // RTCOFIFG
            break;
        case RTCIV_RTCRDYIFG:               // RTCRDYIFG
            break;
        case RTCIV_RTCTEVIFG:               // RTCEVIFG
            break;
        case RTCIV_RTCAIFG:                 // RTCAIFG
            break;
        case RTCIV_RT0PSIFG:                // RT0PSIFG
            break;
        case RTCIV_RT1PSIFG:                // RT1PSIFG
            break;
    //        case 14: break;                     // Reserved
        case 16: break;                     // Reserved
        default: break;
        }
    }
  • Hi

    I have gone through your code, and would like to pointing below lines:

    1. In this code "RTCTEVIE" for enable RTC interrupt not defined.
    2. "GIE" for general interrupt enable - not defined.

    What do you want to do using Timer? because you have only set control register for this.(not define time and ISR).

    Regards
    Bhavdipsinh
  • e2e.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    #include <msp430.h>
    void main(void)
    {
    WDTCTL = WDTPW | WDTHOLD; // Stop WTD
    // Initialize LFXT1
    UCSCTL6 &= ~(XT1OFF); // Enable XT1
    UCSCTL6 |= XCAP_3; // Internal load cap
    // Loop until XT1, XT2 & DCO fault flag is cleared
    do
    {
    UCSCTL7 &= ~(XT2OFFG | XT1LFOFFG | DCOFFG);
    // Clear XT2,XT1,DCO fault flags
    SFRIFG1 &= ~OFIFG; // Clear fault flags
    } while (SFRIFG1 & OFIFG); // Test oscillator fault flag
    P1OUT &= ~BIT0; // Clear P1.0 output
    P1DIR |= BIT0; // Set P1.0 as output for RTC running check
    // Setup P5.3 ou tput, P1.5 SMCLK, P1.4 MCLK, P1.2 ACLK
    P5DIR |= BIT3; // Set P5.3 to output direction
    P5OUT &= ~BIT3; // Clear P5.3
    P1DIR |= BIT2 | BIT4 | BIT5; // ACLK, MCLK, SMCLK set out to pins
    P1SEL0 |= BIT2 | BIT4 | BIT5; // P1.2,4,5 for debugging purposes.
    // Setup TA0
    TA0CCTL0 = CCIE; // CCR0 interrupt enabled
    TA0CCR0 = 50000;
    TA0CTL = TASSEL_2 | MC_1 | TACLR; // SMCLK, upmode, clear TAR
    //Enable the charger for AUXVCC3
    AUX3CHCTL = AUXCHKEY + AUXCHEN + AUXCHC_1 + AUXCHV_1;
    // Configure RTC_C
    RTCCTL0_H = RTCKEY_H; // Unlock RTC_C module
    RTCCTL0_L |= RTCTEVIE | RTCAIE | RTCRDYIE; // Enable RTC time event, alarm event,
    // read ready interrupt
    RTCCTL1 |= RTCBCD | RTCHOLD; // RTC enable BCD mode, RTC hold
    RTCYEAR = 0x2011; // Year = 0x2011 = 2011
    RTCMON = 0x12; // Month = 0x12 = December
    RTCDAY = 0x05; // Day = 0x05 = 5th
    RTCDOW = 0x03; // Day of week = 0x03 = Wednesday
    RTCHOUR = 0x24; // Hour = 0x12
    RTCMIN = 0x59; // Minute = 0x57
    RTCSEC = 0x55; // Seconds = 0x36
    RTCADOWDAY = 0x3; // RTC Day of week alarm = 0x2
    RTCADAY = 0x22; // RTC Day Alarm = 0x22
    RTCAHOUR = 0x23; // RTC Hour Alarm
    RTCAMIN = 0x45; // RTC Minute Alarm
    RTCCTL1 &= ~(RTCHOLD); // Start RTC calendar mode
    RTCCTL0_H = 0; // Lock RTC_C module
    __bis_SR_register(GIE); // interrupts
    // enabled
    while(1)
    {
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Hi Andrei Zaitsau (4197185) ,

    PFA code, This should work for RTC and Timer both.

    Regards

    Bhavdipsinh

  • BHavdipsinh, I don't want to use TimerA, but I noticed that RTC stop work from battery after power Off, if I use Timer

**Attention** This is a public forum