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.

RTC_C configuration of Interrupts in MSP430F6779

Other Parts Discussed in Thread: MSP430F6779, TIDM-AUX-MODULE

Moderator Edit: this post has been split from the following thread: https://e2e.ti.com/support/microcontrollers/msp430/f/166/p/448828/1617520

Hello Jace H,
I am also getting a kind of issue with this i am getting continuously oscillator fault flag without enabling it.
RTCOFIE is zero though RTCOFIFG interrupt comes regularly and hence i can not get into ISR as it is at highest priority may i have any masking to make it zero.
Or any register configuration to clear this flag?

Thanks
Regards
Abhishek Parikh

  • Hello

    I am having same problem. I have connected AUXVCC3 also but still it is not going into its ISR.

    And RTCOFIE and RTCOFIFG bits are set.
    Which means 32KHz fault interrupt flag.I am updating this register RTCCTL0_L manually but it is not updating.It still shows 88 or 8 value.

    Thank you.
    Abhishek Parikh
  • Hi Abhishek,

    Have you tried following one of the code examples from  www.ti.com/tool/tidm-aux-module

    -Katie

  • Hello Abhishek,

    Can you post your RTC configuration? If you set RTCOFIE to 0 then then the RTCOFIFG should be ignored and not wake-up your device.

    Regards,
    JH
  • Hello Jace,

    Here is my RTC configuration... the value i am getting of "a" means RTCCTL0_L.



    a= RTCCTL0_L; //a=0 till now i am not getting any interrupt but when i enable AUXVCC3 it generates RTCOFIFG.
    AUX3CHCTL = AUXCHKEY + AUXCHEN + AUXCHC_1 + AUXCHV_1;
    a= RTCCTL0_L; // a=8 Which means i am getting 32-kHz crystal oscillator fault interrupt flag without enabling RTCOFIE.
    // Configure RTC_C
    RTCCTL0_H = RTCKEY_H; // Unlock RTC_C module
    a= RTCCTL0_L; // a=8
    RTCCTL0_L |= RTCRDYIE; // Enable RTC time event,
    a= RTCCTL0_L; //a=24 means 0x18 means RDYIE interrupt enabled and 32-kHz crystal oscillator fault interrupt flag
    RTCCTL1 |= RTCBCD | RTCHOLD | RTCMODE; // RTC enable BCD mode, RTC hold
    a= RTCCTL0_L; //a=24
    __bis_SR_register(GIE);
    a= RTCCTL0_L; //a=24


    this problem is occurring i am using AUXVCC3 internally and it is working properly as it gives me 2.7-2.8 V on 29th AUXVCC3 pin.
    Crystal is also 32KHz perfect as i have seen in DSO on P1.5 pin.
    What else configuration is remaining or what else should do?
  • Hello Katie Pier,

    Yes I have tried code example no. 5 MSP430F6779_AUX_05.c but it is showing same problems.
    One more question should this program run on step into mode??

    When I run it on step mode it goes in continuous loop of

    UCSCTL6 &= ~(XT1OFF); // Enable XT1
    UCSCTL6 |= XCAP_3; // Internal load cap
    // Loop until XT1, XT2 & DCO fault flag is cleared
    // Start RTC calendar mode
    do
    {
    UCSCTL7 &= ~(XT2OFFG | XT1LFOFFG | DCOFFG); //This loop
    // Clear XT2,XT1,DCO fault flags
    SFRIFG1 &= ~OFIFG; // Clear fault flags
    } while (SFRIFG1 & OFIFG); // Test oscillator fault flag

    But when I make it run in continuous mode and putting breakpoint at next instruction after this it comes to that instruction.
    Is there any problem with my clock?

    Thank you.
  • I have two boards of MSP430.
    I have checked that I'm getting 32.72 Khz frequency on my board as A-clock and in another board it is 32.81 Khz does it making anything?
    Should i change my crystal?

    Regards
    Abhishek Parikh
  • Hello @Jace H and ,

    I have connected external AUXVCC3 and checked for output but result is same.
    What can be the problem?

    Infect I am going in its interrupt service routine but though value of RTCCTL0 remains  as it is. Means I am receiving interrupt RTCOFIFG this flag doesn't goes off though I have gone to its isr.

    I am really stuck at this point.. any one reply soon. 

     
    Thanks
    Regards,
    Abhishek Parikh

  • Hi Abhishek,

    It looks like you set RTCRDYIE - that means that you will go to the ISR is RTCRDYIFG is set - do you think that is what is happening?

    -Katie
  • I also wanted to ask - for the 32kHz crystal on your board, what does the manufacturer say is the required effective load capacitance? In addition, do you use any external capacitors on the crystal, or do you use the internal caps? What values?

    Is this on the TI target board, or on your own custom board?
    -Katie
  • Hello Katie,

    Yes I am enabling RTCRDYIE but RTCRDYIFG flag is not set.
    Because my RTCRDYIFG does not goes off.
    So I can't get into ISR of RTCRDYIFG

    Thanks
    Regards
    Abhishek
  • Thanks for the reply,

    Yes it is my own custom board and I am using 22nF capacitors for it.

    I have tried to use the crystal with internal capacitor also but it doesn't making any difference.

    Do I need to change my crystal? I have tried to do that also but result is same.

    Thank you
  • In reply to Jace H I have mentioned that

    a= RTCCTL0_L; //a=0 till now i am not getting any interrupt but when i enable AUXVCC3 it generates RTCOFIFG.
    AUX3CHCTL = AUXCHKEY + AUXCHEN + AUXCHC_1 + AUXCHV_1;
    a= RTCCTL0_L; // a=8 Which means i am getting 32-kHz crystal oscillator fault interrupt flag without enabling RTCOFIE

    I think some problem with my AUXVCC3 internally or externally applying it supply (I have tried both)
    It is generating RTCOFIFG flag.
  • Hi Abhishek,

    Do you have the datasheet for the crystal that you use? It should list a required capacitance - what does it say (do you have a link or could provide a screenshot?) You should also check that all guidelines in the document www.ti.com/lit/pdf/slaa322 are followed to make sure you have a robust crystal layout on your board - short, symmetric traces, guard ring, etc as noted in the document, as well as the caps being the correct value per the calculation for effective load capacitance to match what is specified in your crystal datasheet.

    You can't always tell if you are having a crystal oscillator fault simply from looking at ACLK - this is because if ACLK fails I believe it will fall back to the REFO on this part that is also 32kHz (see www.ti.com/lit/pdf/slau208 section 5.2.12 UCS Module Fail-Safe Operation, where it says when a fault occurs for ACLK,

    "If ACLKis sourced from XT1 in LF mode, an oscillator fault causes ACLK to be automatically switched to the REFO for its clock source (REFOCLK)".

    To check if your crystal is having issues, you could enable the NMI for OFIFG and make an interrupt service routine. If you are going to this ISR, you will know that you are having an unstable crystal. You could try simply running this code example (if you use external caps, please comment out the line that sets XCAP_3):

    msp430f677xA_of_lfxt1_nmi.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    /* --COPYRIGHT--,BSD_EX
    * Copyright (c) 2013, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    You can see if your code is going into the UNMI ISR by setting a breakpoint. If it is, then you are having oscillator faults and may have an unstable crystal (can be caused by poor crystal layout, wrong cap selection, etc) and should look into that crystal app note SLAA322 I mentioned above.  

    Regards,

    Katie

  • Thanks,
    I will check and let you know after checking
  • I saw these duplicate threads:
    e2e.ti.com/.../1633551
    e2e.ti.com/.../1633550

    Let's please try to keep everything here in this thread to avoid duplication of effort and so that everyone can see all of the information you have already provided and what you have already tried.
  •  Hello Katie Pier,

    We have changed capacitor by values of 12pF and 22pF as well as we have also removed capacitor and used internal capacitor as given in your code msp430f677xA_of_lfxt_1nmi.c  but the result is same.

     

    Thank you

    Regards

    Abhishek Parikh

  • Hello ,

    Series resistance should be given to it??

    Thanks
    -Abhishek Parikh
  • Hi Abhishek,

    Yes, it sounds like your load cap values are correct then. Did you try running msp430f677xA_of_lfxt_1nmi.c on your board as well (the full code example, not just copying the cap setup) - did that work, or was it continually going into the NMI ISR in that code?

    Next step:
    What are all of the connections on your board, for all AUXVCC1,2,3? What components are connected to them, and how is your board powered. Maybe you can provide a snippet of your schematic?

    Regards,
    Katie
  • Hello Katie Pier (1555997) ,

    Thanks for your continuous support.

    Well when i run that code it  is not going into ISR of RTC but going into ISR of UNMI.

    And here is my schematic

    Thank you

    Regards

    Abhishek Parikh

  • If photo isn't visible please go through this link
    drive.google.com/.../view

    Thanks
    Regards
    Abhishek Parikh
  • ABHISHEK PARIKH said:
    Well when i run that code it  is not going into ISR of RTC but going into ISR of UNMI.

    Hi Abhishek,

    If it is going always into the UNMI ISR that means that you are seeing a crystal fault that is not clearing, so this is where we should probably focus. So was it going into the UNMI ISR even with no caps connected, since that code example sets XCAP = 3 (12pF)? Your schematic shows 2 12pF caps for the crystal, which is incorrect. Per the calculation in www.ti.com/lit/pdf/slaa322 for the capacitors, you need effective load capacitance around 12pF which means you need to use 22pF on both XIN and XOUT if you use external caps (alternately remove all external caps and just use the internal XCAP_3 setting). The app note also explains how you can perform a test on your crystal design for stability - see the section on the oscillation allowance test. You want to see if your crystal design has a good safety margin to ensure it is stable, because right now you are going to the UNMI ISR which makes it sound like your crystal is not stable.

    If you look in the design guide for the TIDM-AUX-MODULE TI Design, http://www.ti.com/lit/pdf/tidu452 Table 3 has a set of code example descriptions. Which scenario best matches what you are trying to implement? - would it be maybe MSP430F6779_AUX_05.c or MSP430F6779_06.c - both of those have AUXVCC3 only being used (no use for AUXVCC1 or 2) and only power the RTC off of AUXVCC3. The difference between the two is whether you want the RTC to always be powered from the battery, or have the RTC powered from DVCC when it is available.

    Regards,

    Katie

  • Hello Katie Pier (1555997) ,

    Yes I have tried with 22pF capacitors also and also disconnecting the external Capacitor by using internal XCAP=3.

    I have tried both of that example with battery power and through internal supply.

    But it was not working as it should work... as my crystal is not stable any ways....

    Can i use internal clock source and remove external crystal for RTC module?

    Thank you,
    Regards
    Abhishek Parikh
  • No I believe that the 32kHz crystal is the only source for the RTC_C module. In addition, if you want an accurate real-time clock it needs the accuracy that a crystal provides.

    Since it does sound like you've narrowed it down to the crystal stability as the root cause, the next steps will be to diagnose the issues with the crystal circuit. Because you seem to have tried the correct load caps, the issue may be related instead to layout requiring you to do a new spin of your board. The application note www.ti.com/lit/pdf/slaa322 provides information on how to test the stability of your crystal (oscillation allowance/safety factor tests) as well as providing a lot of detailed information about what things to watch out for in crystal layout and all precautions to take for a good crystal layout. You could also see if using a higher drive strength setting in your software helps as well.

    Would you have a TI target socket board for this device that you could run code on in the meantime, and use as a comparison?

    Regards,
    Katie

  • Hello Katie Pier,

    Actually i have made a breakout out board of msp430 and working with it on GPB.
    My pcb design is ready and i will receive pcb tomorrow.
    So let me check once whether there is a problem due to my soldering or anything else.

    Thank you
    Regards
    Abhishek Parikh
  • Hello ,

    Today i have tested with my pcb but issue still remains.
    I have bought my crystal from a electronic component shop.
    Now i have purchased it from Element 14.
    But don't know what's going on.

    Thank you
    Regards
    Abhishek Parikh
  • Hello,
    This is my layout design I have gone through the rules mentioned in www.ti.com/lit/pdf/slaa322 and made it.
    If I am wrong at any place let me correct.

    Thank you
    Regards
    Abhishek Parikh
  • This is my new crystal's datasheet.

    Thank you

  • Abishek,

    Do you have any lines crossing the xtal lines or plane on the underside of the PCB?

    Also, can you load up the MSPWare example msp430f677xA_of_lfxt1_nmi.c inside CCS ? This way we can eliminate your code as a factor. this example assumes AUXVCC3 is powered for it uses the RTC. Also, make sure to comment the line that adds load caps.

    Regards,
    JH
  • Hello Jace H,
    I don't have any line crossing at Xtal underside my pcb.
    I had tried  MSPWARE code  MSP430F6779_AUX_05.c , MSP430F6779_AUX_06.c and  msp430f677xA_of_lfxt_1nmi.c  month ago when Katie pier said me to do so.
    When I run that code it is not going into ISR of RTC but going into ISR of UNMI.
    I have tried again but it is giving me same type of problem.

    Regards
    Abhishek Parikh

  • Abhishek,

    With the msp430f677xA_of_lfxt_1nmi.c example, it is supposed to go into an NMI when you have a clock issue. this is expected behavior. Working with this example, I think we can definitely rule it is a HW issue. Have you performed the negative resistance test to get the safety factor here as Katie suggested? Beyond that, your layout looks ok, and the Xtal is per datasheet within spec. My only other suggestion is to try to directly measure the Xtal frequency (using a low impedance probe) and seeing where it lies and adjusting your load caps accordingly.

    Regards,
    JH

**Attention** This is a public forum