Shop OBEX P1 Docs P2 Docs Learn Events
P2 Taqoz V2.8 Watchdog with Serial Output of Return Chain and Stack - Example for Timer Interrupt — Parallax Forums

P2 Taqoz V2.8 Watchdog with Serial Output of Return Chain and Stack - Example for Timer Interrupt

Hi, this might perhaps be useful for others, groping because of mysterious trouble.
It uses absolute addresses of serial routines and cog, so they are fix here for the version! **So this will only work with the version _BOOT_P2.BIX in Taqoz.zip in https://sourceforge.net/projects/tachyon-forth/files/TAQOZ/binaries/ .
The assembler routines from TRACE are used here, so it should work, even, if the Forth system is defective.
It is meant for cog0.

What does it do?
"startIsr" establishes an interrupt service routine "isrWatch".
"isrWatch" will be called regularly, defined by the long constant deltaCnt, once a second in my example. Normally this routine just adds one to the variable wdCount. But if a limit "wdLimit" is reached (5 in my example), the watchdog will output the momentary Forth call chain and stack depth and it's top 4 contents.

While in the example, we just wait for the watchdog to chime in, normally some routine should "0 wdCount !" to prevent this.
Have fun and I wish you, that you never need it! :#
Christof

Comments

  • MaciekMaciek Posts: 674
    edited 2023-04-19 07:31

    Looks like a useful piece of code (may your wish be granted in my case). Thanks for sharing.

    ~~I may have skipped some of your work and posts here and haven't properly studied the code of the AutoP.fth yet so bear with me, please, but could you possibly describe in a sentence or two what does this library do, roughly ?
    It's quite a bit of code to be frank and a quick and dirty look at Watch_D.fth reveals it only needs !polls from the former.
    (I'm not a fan of libraries, I must confess, so maybe that's why I struggle)~~

    Please disregard the above. I've done my homework.
    Thank you.

Sign In or Register to comment.