• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Low Power RF & Wireless Connectivity » Low Power RF ZigBee® Software & IEEE 802.15.4 Forum » CC2530 - Use Hardware Timer as a Watchdog Timer possible??
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

CC2530 - Use Hardware Timer as a Watchdog Timer possible??

CC2530 - Use Hardware Timer as a Watchdog Timer possible??

This question is answered
Nikos Koutsioumaris
Posted by Nikos Koutsioumaris
on Aug 31 2012 06:08 AM
Intellectual505 points

Hello all!

I want to be able to reset my system in case that something goes terribly  wrong and it gets stuck at an infinite while for example or anything else unexpected happens(memory leaks etc.). The watchdog timer is a good solution but i also need to backup some values to an external memory before reseting. Is there a way of doing this with a kind of "watchdog timer ISR"? So that if a "watchdog interrupt " occurs i can backup my precious data and then reset the system.

From what i saw the watchdog timer DOES NOT offer the capability of doing anything else except resetting the system when something goes wrong. IF IT DOES please show me the way!!!!:)

Alternatively i was wondering if i could use a hardware timer in the place of the watchdog timer so that: when a system crash occurs i will be able to go to the timer ISR and from there backup my values and then reset my system? Or is it the watchodg timer the only timer that can recover/reset the system after a serious error?

It is very urgent for me cause i need to be 100% that my system wont ever stop functioning and wont lose the data calculated(if a system crash occurs)

P.S. I'm using Zstack 2.5.0

Thanks in advance

Nikos 

cc2530 watchdog hardware timer interrupt
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Dirty Harry
    Posted by Dirty Harry
    on Aug 31 2012 15:54 PM
    Verified Answer
    Verified by Dirty Harry
    Mastermind19350 points

    Interesting embedded system dilemma you have to solve.

    Obviously, using  a H/W timer in lieue of the Watchdog timer is not an option, since bad code can disable interrupts before going into an infinite loop, in which case the H/W Timer interrupt is never realized.

    But, using a H/W timer to regularly backup critical data is an interesting option. The thing is, you want to have a checksum on your critical data (and thus anytime that your data changes, you have to re-calculate the checksum) because you don't want to save garbage in the case when the out-of-control code walks on memory before finally crashing the system and being saved by the Watchdog.

    BUT - backing up too frequently to internal flash (e.g. OSAL_NV) will cause the internal flash pages to wear out and fail.

    So - you can consider making all of your critical data no-init data - the IAR startup will not zero it or assign it to starting values. Like this:

    __no_init uint16 criticalVal1;
    __no_init uint16 criticalVal2;
    __no_init critical_struct_t criticalStruct1;

    Then, your powerup init code has to check the reset reason, and when the reset reason is a watchdog reset (and the checksum of your data passes) then you use the variables as they stand with no initialization.

    But note that __no_init variables don't save you from an unexpected power failure.

    Depending on how much money you can spend, there are external NV chips with enough capacitance that they sense power-down/brown-out and never lose data. So you would add this to your board and acces it via SPI or something.

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Nikos Koutsioumaris
    Posted by Nikos Koutsioumaris
    on Jan 22 2013 04:59 AM
    Intellectual505 points

    Hello Dirty Harry,

    thanks for the answer, very enlightening(after that i tried crashing the system by freeing a NULL pointer and the HW timer didnt work). Sorry for the late reply on this but i had been running with other stuff the days after. I have an external memory (EEPROM) and a chip able to detect power failures.

    This is my main question:

    The thing is i'm trying to understand what you said about no_init variables. If i declare all critical data no_init then if i recover from a watchdog reset i will be able to get the values i had before system crash from these variables?(i think i'am a bit confused with what you 've said) Can you give an example on a simple use of no_init values and watchdog timer? If yes that would help a lot!!

    If i wasnt clear please tell me so that i can be more specific. Thanks in advance and thanks in general for your help in various subjects at the TI forums.

    Nikos

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use