Yep, I did verify that. You need to use the child_process.execSync()
function to call the tuning binary from Node.js because you must wait for
the tuning to complete before opening the watchdog device from within your
Node.js application. I know, using synchronous functions inside an
asynchronous environment like Node.js is bad practice, blah blah blah - It
works, it's good enough for me.

Verification of the timeout change is done by looking at the timeout and
timeleft entries in:

/sys/devices/platform/ocp/44e35000.wdt/watchdog/watchdog0

For example, on first boot:

debian@beaglebone:/sys/devices/platform/ocp/44e35000.wdt/watchdog/watchdog0$
cat timeout
60

Then I start my Node.js application that in turn calls the watchdog tuning
binary then sets up a 1 second write to the watchdog device:

debian@beaglebone:/sys/devices/platform/ocp/44e35000.wdt/watchdog/watchdog0$
cat timeout
5

debian@beaglebone:/sys/devices/platform/ocp/44e35000.wdt/watchdog/watchdog0$
cat timeleft
4

If I Ctrl-C my Node.js application (simulating a lockup/it crashes etc)
then I can watch the timeout value count down and the system reboots.

I hope that helps...



On Tue, 18 Jun 2019 at 17:40, 'Mark Lazarewicz' via BeagleBoard <
beagleboard@googlegroups.com> wrote:

> Did you verify the time out changed?
> If so how?
>
>
> Sent from Yahoo Mail on Android
> <https://go.onelink.me/107872968?pid=InProduct&c=Global_Internal_YGrowth_AndroidEmailSig__AndroidUsers&af_wl=ym&af_sub1=Internal&af_sub2=Global_YGrowth&af_sub3=EmailSignature>
>
> On Tue, Jun 18, 2019 at 7:55 AM, Hugh Frater
> <hugh.fra...@gmail.com> wrote:
> Update: The kernel watchdog driver support tuning the timout through ioctl
> calls. A quick and dirty bit of C code:
>
>
> int main()
> {
>     int fd = open("/dev/watchdog", O_WRONLY);
>     int timeout = 5;
>     ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
>     printf("Setting timeout to %d seconds\n", timeout);
>     close(fd);
>     return 0;
> }
>
> Will tune the watchdog. I use node.js' child_process to call the above
> code (when compiled, obviously), if my node.js app crashes then the BBB
> will reboot. Perfect
>
> On Monday, 3 June 2019 13:07:49 UTC+1, Hugh Frater wrote:
>
> Where does one go to tune the watchdog timer? Is it a
> kernel-recompilation-required thing, or can it be done through uBoot?
>
> Or.... should I just use my PRU code to tune the watchdog control register
> when it boots? This would be the easiest option for me, if someone can
> point me at the correct area if the AM335XTRM? I had a look in there and
> couldn't find the correct registers.
>
> I'd like it to run about 10 seconds if possible for my application.
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beagleboard+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beagleboard/ab8ea583-ab9a-4017-a89f-6bd8127eaf47%40googlegroups.com
> <https://groups.google.com/d/msgid/beagleboard/ab8ea583-ab9a-4017-a89f-6bd8127eaf47%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "BeagleBoard" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/beagleboard/ovGQSAXqwBE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> beagleboard+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beagleboard/952566089.2906417.1560876023480%40mail.yahoo.com
> <https://groups.google.com/d/msgid/beagleboard/952566089.2906417.1560876023480%40mail.yahoo.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CAPm6wa11-z9GOguf%3DdddpFob1PsVZAi4U%2BMcmv80gQ-W6duydg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to