Message ID | 1586512009-613-1-git-send-email-guilin.wang@gl-inet.com |
---|---|
State | Changes Requested |
Delegated to: | Petr Štetiar |
Headers | show |
Series | [OpenWrt-Devel] om-watchdog: Add support for GL-X1200 (GL.iNet) | expand |
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software. Hi, On Fri, Apr 10, 2020 at 11:47 AM guilin.wang@gl-inet.com <guilin.wang@gl-inet.com> wrote: > > Signed-off-by: guilin.wang@gl-inet.com <guilin.wang@gl-inet.com> the format should be "your name <email@address.com>" > --- > package/kernel/om-watchdog/Makefile | 2 +- > package/kernel/om-watchdog/files/om-watchdog | 40 +++++++++++++++++++---- > package/kernel/om-watchdog/files/om-watchdog.init | 2 ++ > 3 files changed, 37 insertions(+), 7 deletions(-) why not use a GPIO watchdog node in board.dts instead? see [0] for an example Martin [0] https://github.com/torvalds/linux/blob/v5.4/Documentation/devicetree/bindings/watchdog/gpio-wdt.txt
Hi ,Martin Thank your for your suggest, I initially followed this method, but found that the dog could not be fed successfully. Our external microcontroller feeds the dog. The cpu just gives the microcontroller a trigger signal, but I tested that the microcontroller cannot detect the level change using this method you said So I used the script. ------------------ Original ------------------From: "Martin Blumenstingl"<martin.blumenstingl@googlemail.com>;Date: Fri, Apr 10, 2020 05:55 PMTo: "guilin.wang@gl-inet.com"<guilin.wang@gl-inet.com>; Cc: "openwrt-devel"<openwrt-devel@lists.openwrt.org>; Subject: Re: [OpenWrt-Devel] [PATCH] om-watchdog: Add support for GL-X1200 (GL.iNet) Hi, On Fri, Apr 10, 2020 at 11:47 AM guilin.wang@gl-inet.com <guilin.wang@gl-inet.com> wrote: > > Signed-off-by: guilin.wang@gl-inet.com <guilin.wang@gl-inet.com> the format should be "your name <email@address.com>" > --- > package/kernel/om-watchdog/Makefile | 2 +- > package/kernel/om-watchdog/files/om-watchdog | 40 +++++++++++++++++++---- > package/kernel/om-watchdog/files/om-watchdog.init | 2 ++ > 3 files changed, 37 insertions(+), 7 deletions(-) why not use a GPIO watchdog node in board.dts instead? see [0] for an example Martin [0] https://github.com/torvalds/linux/blob/v5.4/Documentation/devicetree/bindings/watchdog/gpio-wdt.txt
Hi, On Fri, Apr 10, 2020 at 06:55:59PM +0800, guilin.wang wrote: > but found that the dog could not be fed successfully. Why exactly? > Our external microcontroller feeds the dog. The cpu just gives the > microcontroller a trigger signal, but I tested that the > microcontroller cannot detect the level change using this method How is it able to detect the level change using another method then, what exactly makes them different?
Hi , MartinOur Watchdog uses two GPIO to control, one is to use pulse to switch the watchdog, one GPIO is used to feed the dog, specifically the external single-chip to feed the dog, now the external single-chip cannot detect the level change of GPIO I now suspect that the wdt-gpio delay is too short, and the microcontroller part has not detected a falling edge change. I tried both toggle and level, but unfortunately both failed, and I will continue to test. ------------------ Original ------------------From: "Paul Fertser"<fercerpav@gmail.com>;Date: Fri, Apr 10, 2020 07:10 PMTo: "guilin.wang"<guilin.wang@gl-inet.com>; Cc: "Martin Blumenstingl"<martin.blumenstingl@googlemail.com>; "openwrt-devel"<openwrt-devel@lists.openwrt.org>; Subject: Re: [OpenWrt-Devel] [PATCH] om-watchdog: Add support for GL-X1200 (GL.iNet) Hi, On Fri, Apr 10, 2020 at 06:55:59PM +0800, guilin.wang wrote: > but found that the dog could not be fed successfully. Why exactly? > Our external microcontroller feeds the dog. The cpu just gives the > microcontroller a trigger signal, but I tested that the > microcontroller cannot detect the level change using this method How is it able to detect the level change using another method then, what exactly makes them different?
Hi , Paul
Sorry, I misread the mail contact.
Our watchdog uses two GPIO to control, one is to use pulse to switch the watchdog, one GPIO is used to feed the dog, specifically the external single-chip to feed the dog, now the external single-chip cannot detect the level change of GPIO I now suspect that the wdt-gpio delay is too short, and the microcontroller part has not detected a falling edge change. I tried both toggle and level, but unfortunately both failed, and I will continue to test.
------------------ Original ------------------
From: "guilin.wang"<guilin.wang@gl-inet.com>;
Date: Fri, Apr 10, 2020 07:22 PM
To: "Paul Fertser"<fercerpav@gmail.com>;
Cc: "Martin Blumenstingl"<martin.blumenstingl@googlemail.com>; "openwrt-devel"<openwrt-devel@lists.openwrt.org>;
Subject: Re: [OpenWrt-Devel] [PATCH] om-watchdog: Add support for GL-X1200 (GL.iNet)
Hi , MartinOur
Watchdog uses two GPIO to control, one is to use pulse to switch the watchdog, one GPIO is used to feed the dog, specifically the external single-chip to feed the dog, now the external single-chip cannot detect the level change of GPIO I now suspect that the wdt-gpio delay is too short, and the microcontroller part has not detected a falling edge change. I tried both toggle and level, but unfortunately both failed, and I will continue to test.
------------------ Original ------------------From: "Paul Fertser"<fercerpav@gmail.com>;Date: Fri, Apr 10, 2020 07:10 PMTo: "guilin.wang"<guilin.wang@gl-inet.com>; Cc: "Martin Blumenstingl"<martin.blumenstingl@googlemail.com>; "openwrt-devel"<openwrt-devel@lists.openwrt.org>; Subject: Re: [OpenWrt-Devel] [PATCH] om-watchdog: Add support for GL-X1200 (GL.iNet) Hi,
On Fri, Apr 10, 2020 at 06:55:59PM +0800, guilin.wang wrote:
> but found that the dog could not be fed successfully.
Why exactly?
> Our external microcontroller feeds the dog. The cpu just gives the
> microcontroller a trigger signal, but I tested that the
> microcontroller cannot detect the level change using this method
How is it able to detect the level change using another method then,
what exactly makes them different?
Hi, On Fri, Apr 10, 2020 at 07:23:44PM +0800, guilin.wang wrote: > now the external single-chip cannot detect the level change of GPIO How often do you really need to feed the watchdog? Why do you have an additional MCU taking care of capturing the level change, what else is it doing? Can this MCU firmware be upgraded without external hardware? > I now suspect that the wdt-gpio delay is too short and the > microcontroller part has not detected a falling edge change. I tried > both toggle and level, With gpio_wdt driver when you're using LEVEL mode the GPIO will be pulsed (high level for 1 us (microsecond!)) each time the watchdog is pinged. With TOGGLE mode the GPIO will be toggled each ping. Default watchdog ping frequency in procd is 5 seconds. You can see more info on [0]. > but unfortunately both failed, and I will continue to test. It's not a matter of testing, it's a matter of understanding what's really going on. HTH [0] https://openwrt.org/docs/guide-user/hardware/watchdog
Hi, Paul Thanks for your answers. How often do you really need to feed the watchdog? >> 10s a falling edge triggers dog feeding Why do you have an additional MCU taking care of capturing the level change, what else isit doing? >>MCU is also responsible for other functions, external RTC, and some indicators Can this MCU firmware be upgraded without external hardware? >>No, With gpio_wdt driver when you're using LEVEL mode the GPIO will be pulsed (high level for 1 us (microsecond!)) each time the watchdog is pinged. With TOGGLE mode the GPIO will be toggled each ping. >> Thank you for your explanation, I should use TOGGLE mode, ------------------ Original ------------------From: "Paul Fertser"<fercerpav@gmail.com>;Date: Sat, Apr 11, 2020 07:07 PMTo: "guilin.wang"<guilin.wang@gl-inet.com>; Cc: "Martin Blumenstingl"<martin.blumenstingl@googlemail.com>; "openwrt-devel"<openwrt-devel@lists.openwrt.org>; Subject: Re: [OpenWrt-Devel] [PATCH] om-watchdog: Add support for GL-X1200 (GL.iNet) Hi, On Fri, Apr 10, 2020 at 07:23:44PM +0800, guilin.wang wrote: > now the external single-chip cannot detect the level change of GPIO How often do you really need to feed the watchdog? Why do you have an additional MCU taking care of capturing the level change, what else is it doing? Can this MCU firmware be upgraded without external hardware? > I now suspect that the wdt-gpio delay is too short and the > microcontroller part has not detected a falling edge change. I tried > both toggle and level, With gpio_wdt driver when you're using LEVEL mode the GPIO will be pulsed (high level for 1 us (microsecond!)) each time the watchdog is pinged. With TOGGLE mode the GPIO will be toggled each ping. Default watchdog ping frequency in procd is 5 seconds. You can see more info on [0]. > but unfortunately both failed, and I will continue to test. It's not a matter of testing, it's a matter of understanding what's really going on. HTH [0] https://openwrt.org/docs/guide-user/hardware/watchdog
diff --git a/package/kernel/om-watchdog/Makefile b/package/kernel/om-watchdog/Makefile index 403069b..02520d2 100644 --- a/package/kernel/om-watchdog/Makefile +++ b/package/kernel/om-watchdog/Makefile @@ -12,7 +12,7 @@ PKG_RELEASE:=2 PKG_VERSION:=1 include $(INCLUDE_DIR)/package.mk - +PKG_CONFIG_DEPENDS += BUSYBOX_CONFIG_FLOAT_DURATION define Package/om-watchdog SECTION:=base CATEGORY:=Base system diff --git a/package/kernel/om-watchdog/files/om-watchdog b/package/kernel/om-watchdog/files/om-watchdog index d730c68..b12db3e 100644 --- a/package/kernel/om-watchdog/files/om-watchdog +++ b/package/kernel/om-watchdog/files/om-watchdog @@ -1,15 +1,43 @@ #!/bin/sh +. /lib/functions.sh + GPIO=$1 trap "" INT HUP +om_feed_dog() +{ + while true; do + echo 1 > /sys/class/gpio/gpio${GPIO}/value + sleep 1 + echo 0 > /sys/class/gpio/gpio${GPIO}/value + sleep 180 + done +} +glinet_feed_dog() +{ + local count=1 + for i in $(seq 1 $count); + do + echo 1 >/sys/class/gpio/gpio14/value + sleep 0.01 + echo 0 >/sys/class/gpio/gpio14/value + sleep 0.01 + done +} + echo $GPIO > /sys/class/gpio/export echo out > /sys/class/gpio/gpio${GPIO}/direction -while true; do - echo 1 > /sys/class/gpio/gpio${GPIO}/value - sleep 1 - echo 0 > /sys/class/gpio/gpio${GPIO}/value - sleep 180 -done +board=$(board_name) +if [ "$board" = "glinet,gl-x1200-nor" -o "$board" = "glinet,gl-x1200-nor-nand" ];then + echo 14 >/sys/class/gpio/export + echo out >/sys/class/gpio/gpio14/direction + while true;do + glinet_feed_dog + sleep 10 + done +else + om_feed_dog +fi diff --git a/package/kernel/om-watchdog/files/om-watchdog.init b/package/kernel/om-watchdog/files/om-watchdog.init index 4c407da..5d3ffdd 100644 --- a/package/kernel/om-watchdog/files/om-watchdog.init +++ b/package/kernel/om-watchdog/files/om-watchdog.init @@ -50,6 +50,8 @@ get_gpio() { elif [ "$board" = "teltonika_rut5xx" ]; then # ramips return 11 + elif [ "$board" = "glinet,gl-x1200-nor" -o "$board" = "glinet,gl-x1200-nor-nand" ];then + return 16 else #we assume it is om1p in this case return 3
Signed-off-by: guilin.wang@gl-inet.com <guilin.wang@gl-inet.com> --- package/kernel/om-watchdog/Makefile | 2 +- package/kernel/om-watchdog/files/om-watchdog | 40 +++++++++++++++++++---- package/kernel/om-watchdog/files/om-watchdog.init | 2 ++ 3 files changed, 37 insertions(+), 7 deletions(-)