Shop OBEX P1 Docs P2 Docs Learn Events
watchdog in propellor — Parallax Forums

watchdog in propellor

faizzzfaizzz Posts: 7
edited 2009-11-21 22:57 in Propeller 1
hi

i am new to propellor, and i am just getting to know it. Could anyone please tell me how a watchdog timer is implemented on a propellor?

Regards

Comments

  • LeonLeon Posts: 7,620
    edited 2009-11-21 12:38
    You could dedicate a cog to a WDT function, and reset the chip if it didn't get a signal in the required time using an output pin connected to the reset pin. An external WDT chip could also be used (I think that Maxim makes them), it might be a better solution.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM

    Post Edited (Leon) : 11/21/2009 12:49:09 PM GMT
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-11-21 13:42
    In general a watchdog is not so useful than in other systems. The reason to use a watchdog is that in unlikely situations some things can effect each other in a way that the program can't handle. This happens easier in other systems as these are interrupt driven. Interrupt A interrupts interrupt B ... that's most likely where a watchdog has to help out. On the propeller you should be able to write programs that never hang. In the propeller one COG can not effect another COG except they work on and rely on data stored in HUB-RAM. SPIN stack for example is a candidate to produce crashes. But then you did something wrong in your program and a watchdog is the worst solution to solve that.
  • LeonLeon Posts: 7,620
    edited 2009-11-21 14:08
    I was thinking more in terms of, say, a glitch on the supply, affecting program execution. Each cog could be required to send a periodic signal to the WDT cog. I'm not sure how workable this is, though.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM

    Post Edited (Leon) : 11/21/2009 2:15:36 PM GMT
  • kwinnkwinn Posts: 8,697
    edited 2009-11-21 15:43
    Leon, that's not a bad idea. One cog checking a hub location for each of the remaining 7 cogs. Could even have the WD cog send a "kill" signal back to the running cogs when one goes down. That way the running cogs could put whatever they are controlling into a safe state.
  • mctriviamctrivia Posts: 3,772
    edited 2009-11-21 17:10
    i made a simple watchdog for my bootloader app because some times trying to mounting an sd card with none present would cause it to hang. if that happened i new there was no new code so the watchdog initiallized the normal boot mode.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    24 bit LCD Breakout Board coming soon. $21.99 has backlight driver and touch sensitive decoder.
  • dMajodMajo Posts: 855
    edited 2009-11-21 19:08
    It seems to me that you guys are speaking of a time-out error handling routine. A watchdog in my opinion serves as a restart option when the hardware hangs. Here software can do nothing (eg. waitvid without having started the plla).

    @faizzz: the propeller haven't a hardware watchdog. But if in place of the standard 32K eeprom you use the FM31L278 (ramtron) in a single chip you have 32K un-wear-able fast-write eeprom substitute, a hw watchdog, a RTC and other features

    PEdit: BTW many times watchdog haven't special software retrigering them, the triger pin is just wired on the data or addres bus thus monitoring bus activity.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · Propeller Object Exchange (last Publications / Updates);·· Vaati's custom search

    Post Edited (dMajo) : 11/21/2009 7:21:15 PM GMT
  • kwinnkwinn Posts: 8,697
    edited 2009-11-21 22:57
    dMajo, A watchdog timer is in essence a hardware time out handler. It sets a flag, and if some software routine has not reset that flag within a specific time period it resets the processor. As for the prop, a timeout routine would not always work. If a cog is waiting (waitpeq/pne/vid) for a signal on a pin or condition and it never comes the code for the timeout routine would never be executed.

    By dedicating a cog and an I/O pin that connects to the prop reset pin you can have a watchdog timer for the remaining cogs. Each remaining cog has a hub memory location that it must set to a specific value to prevent the watchdog cog from resetting the prop.
Sign In or Register to comment.