User avatar
DougieLawson
Posts: 36907
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: external watchdog on GPIO output

Sun Sep 17, 2017 8:54 am

Yes.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

nixy82
Posts: 42
Joined: Sat Sep 12, 2015 9:19 am

Re: external watchdog on GPIO output

Wed Sep 27, 2017 11:31 am

Hi

Am I understanding this correctly that you can use any GPIO line (subject to default pull being correct) for external watchdog operation with this?

i.e. the module doesn't make use of RPi PWM to do the watchdog pulse timer but rather this is controlled/generated by the Linux OS/Kernel

So for example we could use GPIO lines 26 for enable and 25 for watchdog timer input.

Hope this makes sense

Andrew.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2542
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: external watchdog on GPIO output

Wed Sep 27, 2017 11:43 am

Yes, that is my understanding. The driver uses a standard kernel timer to check for pings from userspace at half the configured watchdog timeout value. If a ping has been received then it keeps the external watchdog happy, otherwise it lets the watchdog trigger and reboot the system.

PetrSvetr
Posts: 20
Joined: Wed Mar 01, 2017 6:49 am
Location: The Czech Republic

Re: external watchdog on GPIO output

Sat Sep 30, 2017 6:28 pm

nixy82 wrote:
Wed Sep 27, 2017 11:31 am
So for example we could use GPIO lines 26 for enable and 25 for watchdog timer input.
nixy82, what do you mean by "we could use GPIO lines 26 for enable" in your post?

nixy82
Posts: 42
Joined: Sat Sep 12, 2015 9:19 am

Re: external watchdog on GPIO output

Tue Oct 03, 2017 1:23 pm

What I mean is

This sounds like if we have an external watchdog chip (e.g. STWD100PYW83F) hooked up to GPIOs 26 (Watchdog enable) & 25 (Watchdog input) we could use a modified version of the config in your posts to allow us to use the rather nice watchdog module, with the range of conditionals in /etc/watchdog.conf, to control it rather than having to write a separate software module

I've not had chance to play with it yet, it's on my list of things to do, but it looked really interesting (good work by the way!)

Andrew.

marcelser
Posts: 5
Joined: Thu Jun 01, 2017 8:47 pm

Now configurable via /etc/modules && /etc/modprobe.d ?

Wed Feb 07, 2018 12:11 am

Hi,

Now that the gpio_wdt module is available in the kernel, would it possible to load & configure it much more easily by adding it to /etc/modules

gpio_wdt

and add the needed parameters in /etc/modprobe.d directory. I've seen a thread how to do this on rpi here:
viewtopic.php?f=28&t=135027 , see post #2

I just don't know what the options would look like, cuase in the overlay they look quite strange with all this quotes, brackets, etc.

Can anyone share a quick example with active_low=false in toggle mode? Or do I have to keep the strange overlay posted in this thread before? BTW: I probably should disable the internal watchdog right? BTW, is the gpio pin numbering board or something like bcm (like in python where you have to set to gpio layout)?

User avatar
joan
Posts: 14605
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: external watchdog on GPIO output

Wed Feb 07, 2018 8:30 am

The gist appears to be you need a user process to kick the watchdog, which then toggles a GPIO, to give visible assurance the user process is still running. May I ask why you don't just dump the watchdog and use the user process to directly toggle the GPIO?

marcelser
Posts: 5
Joined: Thu Jun 01, 2017 8:47 pm

Re: external watchdog on GPIO output

Thu Feb 08, 2018 5:01 am

Because I tried it with a python user process in a loop but after some hours (approx. 2-8 hrs) python messes up the gpio pin which causes the watchdog to weirdly v reset the Pi and secondly why should I reinvent the wheel when there's a better solution. So I'm still looking for the answer on how to use the kernel driver gpio_wdt which was included in the new kernels for a reason.

User avatar
joan
Posts: 14605
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: external watchdog on GPIO output

Thu Feb 08, 2018 8:37 am

@marcelser

My comment was intended for the OP rather than your post.

However if a Python process fails after 2-8 hours when writing to a GPIO it seems little different to a Python process failing after 2-8 hours when writing to a watchdog device. Why not work out why it is failing?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2542
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: external watchdog on GPIO output

Thu Feb 08, 2018 9:57 am

There are many reasons to want to use the existing watchdog interface:
* It should be (marginally) less code.
* Any code that uses it will be portable to other Linux systems because the API is separated from the hardware by multiple layers of abstraction - the fact that the watchdog is reached via GPIO, and the fact that GPIOs are accessed via the internal BCM2835 GPIO controller are both of no concern to the application.
* It fits with the Linux philosophy of doing one thing and doing it well.

Return to “Device Tree”