dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts
PATCH 1/1 dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts
trigger watchdog before calling usb_gadget_handle_interrupts() This prevents board resets when calling dfu command on boards which have a watchdog.
---
common/cmd_dfu.c | 2 ++ 1 file changed, 2 insertions(+)
common/cmd_dfu.c +2 -0
@@ -9,6 +9,7 @@*/ #include <common.h> +#include <watchdog.h> #include <dfu.h> #include <g_dnl.h> #include <usb.h>
@@ -64,6 +65,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (ctrlc ()) goto exit; +WATCHDOG_RESET ();usb_gadget_handle_interrupts (); } exit:
Signature · 1 line
2.1.0
PATCH 1/1 dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts
Hi Heiko,
Quoted 23 lines
trigger watchdog before calling
usb_gadget_handle_interrupts()This prevents board resets when calling dfu command on boards which have a watchdog.Signed-off-by Heiko Schocher <[email protected]>---
common/cmd_dfu.c | 2 ++ 1 file changed, 2 insertions(+)common/cmd_dfu.c +1
-0@@ -9,6 +9,7 @@*/ #include <common.h> +#include <watchdog.h> #include <dfu.h> #include <g_dnl.h> #include <usb.h>
common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int · line 71
Quoted 7 lines
common/cmd_dfu.c +1
-0@@ -64,6 +65,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (ctrlc()) goto exit; +WATCHDOG_RESET ();usb_gadget_handle_interrupts (); } exit:
It seems strange for me, that we must reset watchdog when looping in the dfu.
What is the WATCHDOG interval on the affected board?
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 1/1 dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts
Hello Lukasz,
Am 17.03.2015 10:52, schrieb Lukasz Majewski:
Quoted 28 lines
Hi Heiko,
Quoted 26 lines
trigger watchdog before calling
usb_gadget_handle_interrupts()This prevents board resets when calling dfu command on boards which have a watchdog.Signed-off-by Heiko Schocher <[email protected]>---
common/cmd_dfu.c | 2 ++ 1 file changed, 2 insertions(+)common/cmd_dfu.c +1
-0@@ -9,6 +9,7 @@*/ #include <common.h> +#include <watchdog.h> #include <dfu.h> #include <g_dnl.h> #include <usb.h> @@ -64,6 +65,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (ctrlc()) goto exit;
Quoted 7 lines
common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 71
Quoted 4 lines
common/cmd_dfu.c +1
-0+WATCHDOG_RESET ();usb_gadget_handle_interrupts (); } exit:It seems strange for me, that we must reset watchdog when looping in the dfu.
Hmm.. maybe I overlook something, but If you look into this while(1) loop, there is no trigger of the watchdog ... and if I start the dfu command without a USB cable on the board, what triggers the boards watchdog?
Quoted 1 line
What is the WATCHDOG interval on the affected board?
~5 seconds
Ah, this is on an at91 board .. and in the drivers/serial/atmel_usart.c atmel_serial_tstc() is no WATCHDOG_RESET...
So ctrlc() does not trigger the watchdog
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 1/1 dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts
Hi Heiko,
Quoted 39 lines
Hello Lukasz,
Am 17.03.2015 10:52, schrieb Lukasz Majewski:
Quoted 28 lines
Hi Heiko,
Quoted 26 lines
trigger watchdog before calling
usb_gadget_handle_interrupts()This prevents board resets when calling dfu command on boards which have a watchdog.Signed-off-by Heiko Schocher <[email protected]>---
common/cmd_dfu.c | 2 ++ 1 file changed, 2 insertions(+)common/cmd_dfu.c +1
-0@@ -9,6 +9,7 @@*/ #include <common.h> +#include <watchdog.h> #include <dfu.h> #include <g_dnl.h> #include <usb.h> @@ -64,6 +65,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (ctrlc()) goto exit;Quoted 7 lines
common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 71
Quoted 4 lines
common/cmd_dfu.c +1
-0+WATCHDOG_RESET ();usb_gadget_handle_interrupts (); } exit:It seems strange for me, that we must reset watchdog when looping in the dfu.
Quoted 4 lines
Hmm.. maybe I overlook something, but If you look into this while(1) loop, there is no trigger of the watchdog ... and if I start the dfu command without a USB cable on the board, what triggers the boards watchdog?
So the problem is when cable is not attached to the board and you call dfu command to execute?
Quoted 10 lines
Quoted 2 lines
What is the WATCHDOG interval on the affected board?
~5 seconds
Ah, this is on an at91 board .. and in the
drivers/serial/atmel_usart.catmel_serial_tstc()is noWATCHDOG_RESET...So
ctrlc()does not trigger the watchdog
Could you be a bit more specific here. Does your board expect ctrlc() to update watchdog, so it won't reset?
Quoted 3 lines
bye,
Heiko
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 1/1 dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts
Hello Lukasz,
Am 17.03.2015 13:56, schrieb Lukasz Majewski:
Quoted 41 lines
Hi Heiko,
Quoted 39 lines
Hello Lukasz,
Am 17.03.2015 10:52, schrieb Lukasz Majewski:
Quoted 35 lines
Hi Heiko,
Quoted 23 lines
trigger watchdog before calling
usb_gadget_handle_interrupts()This prevents board resets when calling dfu command on boards which have a watchdog.Signed-off-by Heiko Schocher <[email protected]>---
common/cmd_dfu.c | 2 ++ 1 file changed, 2 insertions(+)common/cmd_dfu.c +1
-0@@ -9,6 +9,7 @@*/ #include <common.h> +#include <watchdog.h> #include <dfu.h> #include <g_dnl.h> #include <usb.h> common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int · line 71
Quoted 7 lines
common/cmd_dfu.c +1
-0@@ -64,6 +65,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (ctrlc()) goto exit; +WATCHDOG_RESET ();usb_gadget_handle_interrupts (); } exit:It seems strange for me, that we must reset watchdog when looping in the dfu.
Quoted 7 lines
Quoted 4 lines
Hmm.. maybe I overlook something, but If you look into this while(1) loop, there is no trigger of the watchdog ... and if I start the dfu command without a USB cable on the board, what triggers the boards watchdog?
So the problem is when cable is not attached to the board and you call dfu command to execute?
Yes.
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
What is the WATCHDOG interval on the affected board?
~5 seconds
Quoted 8 lines
Quoted 5 lines
Ah, this is on an at91 board .. and in the
drivers/serial/atmel_usart.catmel_serial_tstc()is noWATCHDOG_RESET...So
ctrlc()does not trigger the watchdogCould you be a bit more specific here. Does your board expect
ctrlc()to update watchdog, so it won't reset?
I do not know, if ctrlc() must trigger the WDT ... I just looked into the while(1) loop in common/cmd_dfu.c. There is only ctrlc() which could trigger the WDT... and on at91 it does not trigger it ...
If dfu transfer is started there is some output on the console, which triggers the WDT too ... do you have a board with a running WDT?
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 1/1 dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts
Hi Heiko,
Quoted 49 lines
Hello Lukasz,
Am 17.03.2015 13:56, schrieb Lukasz Majewski:
Quoted 46 lines
Hi Heiko,
Quoted 43 lines
Hello Lukasz,
Am 17.03.2015 10:52, schrieb Lukasz Majewski:
Quoted 28 lines
Hi Heiko,
Quoted 26 lines
trigger watchdog before calling
usb_gadget_handle_interrupts()This prevents board resets when calling dfu command on boards which have a watchdog.Signed-off-by Heiko Schocher <[email protected]>---
common/cmd_dfu.c | 2 ++ 1 file changed, 2 insertions(+)common/cmd_dfu.c +1
-0@@ -9,6 +9,7 @@*/ #include <common.h> +#include <watchdog.h> #include <dfu.h> #include <g_dnl.h> #include <usb.h> @@ -64,6 +65,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (ctrlc()) goto exit;Quoted 7 lines
common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 71
Quoted 4 lines
common/cmd_dfu.c +1
-0+WATCHDOG_RESET ();usb_gadget_handle_interrupts (); } exit:It seems strange for me, that we must reset watchdog when looping in the dfu.
Hmm.. maybe I overlook something, but If you look into this while(1) loop, there is no trigger of the watchdog ... and if I start the dfu command without a USB cable on the board, what triggers the boards watchdog?
Quoted 4 lines
Quoted 2 lines
So the problem is when cable is not attached to the board and you call dfu command to execute?
Yes.
For UMS gadget there is defined g_dnl_board_usb_cable_connected() function.
However, it is not yet supported in dfu and requires working MUIC block, which might be not available at your board.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
What is the WATCHDOG interval on the affected board?
~5 seconds
Ah, this is on an at91 board .. and in the
drivers/serial/atmel_usart.catmel_serial_tstc()is noWATCHDOG_RESET...
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
So
ctrlc()does not trigger the watchdogCould you be a bit more specific here. Does your board expect
ctrlc()to update watchdog, so it won't reset?I do not know, if
ctrlc()must trigger the WDT ... I just looked into the while(1) loop incommon/cmd_dfu.c. There is onlyctrlc()which could trigger the WDT... and on at91 it does not trigger it ...
By trigger you mean reset WDT core and don't reset the board?
Quoted 3 lines
If dfu transfer is started there is some output on the console, which triggers the WDT too ... do you have a board with a running WDT?
On trats/trats2 we disable WDT when we enter the u-boot.
I can imagine following situation when WDT is enabled when u-boot starts (its timeout is ~5sec) and then you start dfu transfer with not connected cable.
Then 5sec pass since cable is not connected and no transfer is ongoing. This causes board reset by WDT.
Am I right?
Quoted 3 lines
bye,
Heiko
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 1/1 dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts
Quoted 80 lines · Lukasz Majewski
Hi Heiko,
Quoted 49 lines
Hello Lukasz,
Am 17.03.2015 13:56, schrieb Lukasz Majewski:
Quoted 46 lines
Hi Heiko,
Quoted 43 lines
Hello Lukasz,
Am 17.03.2015 10:52, schrieb Lukasz Majewski:
Quoted 28 lines
Hi Heiko,
Quoted 26 lines
trigger watchdog before calling
usb_gadget_handle_interrupts()This prevents board resets when calling dfu command on boards which have a watchdog.Signed-off-by Heiko Schocher <[email protected]>---
common/cmd_dfu.c | 2 ++ 1 file changed, 2 insertions(+)common/cmd_dfu.c +1
-0@@ -9,6 +9,7 @@*/ #include <common.h> +#include <watchdog.h> #include <dfu.h> #include <g_dnl.h> #include <usb.h> @@ -64,6 +65,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (ctrlc()) goto exit;Quoted 7 lines
common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 71
Quoted 4 lines
common/cmd_dfu.c +1
-0+WATCHDOG_RESET ();usb_gadget_handle_interrupts (); } exit:It seems strange for me, that we must reset watchdog when looping in the dfu.
Hmm.. maybe I overlook something, but If you look into this while(1) loop, there is no trigger of the watchdog ... and if I start the dfu command without a USB cable on the board, what triggers the boards watchdog?
Quoted 4 lines
Quoted 2 lines
So the problem is when cable is not attached to the board and you call dfu command to execute?
Yes.
For UMS gadget there is defined
g_dnl_board_usb_cable_connected()function.However, it is not yet supported in dfu and requires working MUIC block, which might be not available at your board.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
What is the WATCHDOG interval on the affected board?
~5 seconds
Ah, this is on an at91 board .. and in the
drivers/serial/atmel_usart.catmel_serial_tstc()is noWATCHDOG_RESET...Quoted 8 lines
Quoted 4 lines
Quoted 1 line
So
ctrlc()does not trigger the watchdogCould you be a bit more specific here. Does your board expect
ctrlc()to update watchdog, so it won't reset?I do not know, if
ctrlc()must trigger the WDT ... I just looked into the while(1) loop incommon/cmd_dfu.c. There is onlyctrlc()which could trigger the WDT... and on at91 it does not trigger it ...
Quoted 7 lines
By trigger you mean reset WDT core and don't reset the board?
Quoted 3 lines
If dfu transfer is started there is some output on the console, which triggers the WDT too ... do you have a board with a running WDT?
On trats/trats2 we disable WDT when we enter the u-boot.
This seems wrong. We should enable the WDT and then be "petting" or whatever the right term is for saying "Hey WDT, I'm alive!" which is what WATCHDOG_RESET() is really about.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150317/7d58126a/attachment.sig>
PATCH 1/1 dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts
Quoted 89 lines · On Tue, 17 Mar 2015 12:09:17 -0400 Tom Rini <[email protected]> wrote:
Quoted 88 lines · Lukasz Majewski
Hi Heiko,
Quoted 49 lines
Hello Lukasz,
Am 17.03.2015 13:56, schrieb Lukasz Majewski:
Quoted 46 lines
Hi Heiko,
Quoted 43 lines
Hello Lukasz,
Am 17.03.2015 10:52, schrieb Lukasz Majewski:
Quoted 28 lines
Hi Heiko,
Quoted 26 lines
trigger watchdog before calling
usb_gadget_handle_interrupts()This prevents board resets when calling dfu command on boards which have a watchdog.Signed-off-by Heiko Schocher <[email protected]>---
common/cmd_dfu.c | 2 ++ 1 file changed, 2 insertions(+)common/cmd_dfu.c +1
-0@@ -9,6 +9,7 @@*/ #include <common.h> +#include <watchdog.h> #include <dfu.h> #include <g_dnl.h> #include <usb.h> @@ -64,6 +65,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (ctrlc()) goto exit;Quoted 7 lines
common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int · line 71
Quoted 4 lines
common/cmd_dfu.c +1
-0+WATCHDOG_RESET ();usb_gadget_handle_interrupts (); } exit:It seems strange for me, that we must reset watchdog when looping in the dfu.
Hmm.. maybe I overlook something, but If you look into this while(1) loop, there is no trigger of the watchdog ... and if I start the dfu command without a USB cable on the board, what triggers the boards watchdog?
Quoted 4 lines
Quoted 2 lines
So the problem is when cable is not attached to the board and you call dfu command to execute?
Yes.
For UMS gadget there is defined
g_dnl_board_usb_cable_connected()function.However, it is not yet supported in dfu and requires working MUIC block, which might be not available at your board.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 2 lines
What is the WATCHDOG interval on the affected board?
~5 seconds
Ah, this is on an at91 board .. and in the
drivers/serial/atmel_usart.catmel_serial_tstc()is noWATCHDOG_RESET...So
ctrlc()does not trigger the watchdogQuoted 7 lines
Quoted 2 lines
Could you be a bit more specific here. Does your board expect
ctrlc()to update watchdog, so it won't reset?I do not know, if
ctrlc()must trigger the WDT ... I just looked into the while(1) loop incommon/cmd_dfu.c. There is onlyctrlc()which could trigger the WDT... and on at91 it does not trigger it ...By trigger you mean reset WDT core and don't reset the board?
Quoted 4 lines
If dfu transfer is started there is some output on the console, which triggers the WDT too ... do you have a board with a running WDT?
Quoted 5 lines
Quoted 1 line
On trats/trats2 we disable WDT when we enter the u-boot.
This seems wrong. We should enable the WDT and then be "petting" or whatever the right term is for saying "Hey WDT, I'm alive!" which is what
WATCHDOG_RESET()is really about.
Tom, I agree with the above. However in trats/trats2 case it is not necessary.
Best regards,
Lukasz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150317/d7c29047/attachment.sig>
PATCH 1/1 dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts
In reply to Lukasz MajewskiHello Lukasz,
Am 17.03.2015 16:16, schrieb Lukasz Majewski:
Quoted 54 lines
Hi Heiko,
Quoted 52 lines
Hello Lukasz,
Am 17.03.2015 13:56, schrieb Lukasz Majewski:
Quoted 48 lines
Hi Heiko,
Quoted 39 lines
Hello Lukasz,
Am 17.03.2015 10:52, schrieb Lukasz Majewski:
Quoted 28 lines
Hi Heiko,
Quoted 26 lines
trigger watchdog before calling
usb_gadget_handle_interrupts()This prevents board resets when calling dfu command on boards which have a watchdog.Signed-off-by Heiko Schocher <[email protected]>---
common/cmd_dfu.c | 2 ++ 1 file changed, 2 insertions(+)common/cmd_dfu.c +1
-0@@ -9,6 +9,7 @@*/ #include <common.h> +#include <watchdog.h> #include <dfu.h> #include <g_dnl.h> #include <usb.h> @@ -64,6 +65,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (ctrlc()) goto exit;Quoted 7 lines
common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 71
Quoted 4 lines
common/cmd_dfu.c +1
-0+WATCHDOG_RESET ();usb_gadget_handle_interrupts (); } exit:It seems strange for me, that we must reset watchdog when looping in the dfu.
Quoted 4 lines
Hmm.. maybe I overlook something, but If you look into this while(1) loop, there is no trigger of the watchdog ... and if I start the dfu command without a USB cable on the board, what triggers the boards watchdog?
So the problem is when cable is not attached to the board and you call dfu command to execute?
Quoted 7 lines
Quoted 1 line
Yes.
For UMS gadget there is defined
g_dnl_board_usb_cable_connected()function.However, it is not yet supported in dfu and requires working MUIC block, which might be not available at your board.
Maybe, I must check this ...
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 1 line
What is the WATCHDOG interval on the affected board?
~5 seconds
Ah, this is on an at91 board .. and in the
drivers/serial/atmel_usart.catmel_serial_tstc()is noWATCHDOG_RESET...So
ctrlc()does not trigger the watchdog
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Could you be a bit more specific here. Does your board expect
ctrlc()to update watchdog, so it won't reset?I do not know, if
ctrlc()must trigger the WDT ... I just looked into the while(1) loop incommon/cmd_dfu.c. There is onlyctrlc()which could trigger the WDT... and on at91 it does not trigger it ...By trigger you mean reset WDT core and don't reset the board?
I mean, the code must trigger the WDT somewhere in this while(1). If not, the WDT resets the board.
Quoted 4 lines
Quoted 2 lines
If dfu transfer is started there is some output on the console, which triggers the WDT too ... do you have a board with a running WDT?
On trats/trats2 we disable WDT when we enter the u-boot.
Why?
So you can test this behaviour. Do not disable the WDT and start the dfu command ... the board should reset when you start the dfu command (without starting dfu-util on the host, and if ctrl() does not call WATCHDOG_RESET for your hw) ... with my patch it should work ...
BTW: I could not disable the WDT on this board, once it is enabled. So disabling the WDT is no option ... :-(
Quoted 7 lines
I can imagine following situation when WDT is enabled when u-boot starts (its timeout is ~5sec) and then you start dfu transfer with not connected cable.
Then 5sec pass since cable is not connected and no transfer is ongoing. This causes board reset by WDT.Am I right?
Yes, because the WDT gets not triggered in this while(1). And maybe if you start the dfu command with connected cable, but not starting dfu-util on the host also, but I have not yet running the usb gadget on this at91 board (at91sam9g20 based) ...
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 1/1 dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts
Hi Heiko,
Quoted 98 lines
Hello Lukasz,
Am 17.03.2015 16:16, schrieb Lukasz Majewski:
Quoted 54 lines
Hi Heiko,
Quoted 52 lines
Hello Lukasz,
Am 17.03.2015 13:56, schrieb Lukasz Majewski:
Quoted 48 lines
Hi Heiko,
Quoted 39 lines
Hello Lukasz,
Am 17.03.2015 10:52, schrieb Lukasz Majewski:
Quoted 28 lines
Hi Heiko,
Quoted 26 lines
trigger watchdog before calling
usb_gadget_handle_interrupts()This prevents board resets when calling dfu command on boards which have a watchdog.Signed-off-by Heiko Schocher <[email protected]>---
common/cmd_dfu.c | 2 ++ 1 file changed, 2 insertions(+)common/cmd_dfu.c +1
-0@@ -9,6 +9,7 @@*/ #include <common.h> +#include <watchdog.h> #include <dfu.h> #include <g_dnl.h> #include <usb.h> @@ -64,6 +65,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (ctrlc()) goto exit;Quoted 7 lines
common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, · line 71
Quoted 4 lines
common/cmd_dfu.c +1
-0+WATCHDOG_RESET ();usb_gadget_handle_interrupts (); } exit:It seems strange for me, that we must reset watchdog when looping in the dfu.
Quoted 4 lines
Hmm.. maybe I overlook something, but If you look into this while(1) loop, there is no trigger of the watchdog ... and if I start the dfu command without a USB cable on the board, what triggers the boards watchdog?
So the problem is when cable is not attached to the board and you call dfu command to execute?
Quoted 7 lines
Quoted 1 line
Yes.
For UMS gadget there is defined
g_dnl_board_usb_cable_connected()function.However, it is not yet supported in dfu and requires working MUIC block, which might be not available at your board.
Maybe, I must check this ...
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 9 lines
Quoted 1 line
What is the WATCHDOG interval on the affected board?
~5 seconds
Ah, this is on an at91 board .. and in the
drivers/serial/atmel_usart.catmel_serial_tstc()is noWATCHDOG_RESET...So
ctrlc()does not trigger the watchdogCould you be a bit more specific here. Does your board expect
ctrlc()to update watchdog, so it won't reset?Quoted 6 lines
Quoted 4 lines
I do not know, if
ctrlc()must trigger the WDT ... I just looked into the while(1) loop incommon/cmd_dfu.c. There is onlyctrlc()which could trigger the WDT... and on at91 it does not trigger it ...By trigger you mean reset WDT core and don't reset the board?
I mean, the code must trigger the WDT somewhere in this while(1). If not, the WDT resets the board.
Quoted 5 lines
Quoted 3 lines
If dfu transfer is started there is some output on the console, which triggers the WDT too ... do you have a board with a running WDT?
On trats/trats2 we disable WDT when we enter the u-boot.
Why?
Quoted 7 lines
So you can test this behaviour. Do not disable the WDT and start the dfu command ... the board should reset when you start the dfu command (without starting dfu-util on the host, and if
ctrl()does not callWATCHDOG_RESETfor your hw) ... with my patch it should work ...BTW: I could not disable the WDT on this board, once it is enabled. So disabling the WDT is no option ... :-(
Ok, I see. Then I will apply the proposed patch.
Quoted 7 lines
Quoted 7 lines
I can imagine following situation when WDT is enabled when u-boot starts (its timeout is ~5sec) and then you start dfu transfer with not connected cable.
Then 5sec pass since cable is not connected and no transfer is ongoing. This causes board reset by WDT.
Quoted 6 lines
Quoted 1 line
Am I right?
Yes, because the WDT gets not triggered in this while(1). And maybe if you start the dfu command with connected cable, but not starting dfu-util on the host also, but I have not yet running the usb gadget on this at91 board (at91sam9g20 based) ...
Thanks for explanation. I just wanted to have bigger picture of the problem.
Quoted 3 lines
bye,
Heiko
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 1/1 dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts
Hello Lukasz,
Am 18.03.2015 08:44, schrieb Lukasz Majewski:
Quoted 105 lines
Hi Heiko,
Quoted 103 lines
Hello Lukasz,
Am 17.03.2015 16:16, schrieb Lukasz Majewski:
Quoted 54 lines
Hi Heiko,
Quoted 52 lines
Hello Lukasz,
Am 17.03.2015 13:56, schrieb Lukasz Majewski:
Quoted 48 lines
Hi Heiko,
Quoted 39 lines
Hello Lukasz,
Am 17.03.2015 10:52, schrieb Lukasz Majewski:
Quoted 28 lines
Hi Heiko,
Quoted 26 lines
trigger watchdog before calling
usb_gadget_handle_interrupts()This prevents board resets when calling dfu command on boards which have a watchdog.Signed-off-by Heiko Schocher <[email protected]>---
common/cmd_dfu.c | 2 ++ 1 file changed, 2 insertions(+)common/cmd_dfu.c +1
-0@@ -9,6 +9,7 @@*/ #include <common.h> +#include <watchdog.h> #include <dfu.h> #include <g_dnl.h> #include <usb.h> @@ -64,6 +65,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (ctrlc()) goto exit;Quoted 7 lines
common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, · line 71
Quoted 4 lines
common/cmd_dfu.c +1
-0+WATCHDOG_RESET ();usb_gadget_handle_interrupts (); } exit:It seems strange for me, that we must reset watchdog when looping in the dfu.
Quoted 4 lines
Hmm.. maybe I overlook something, but If you look into this while(1) loop, there is no trigger of the watchdog ... and if I start the dfu command without a USB cable on the board, what triggers the boards watchdog?
So the problem is when cable is not attached to the board and you call dfu command to execute?
Quoted 7 lines
Quoted 1 line
Yes.
For UMS gadget there is defined
g_dnl_board_usb_cable_connected()function.However, it is not yet supported in dfu and requires working MUIC block, which might be not available at your board.
Maybe, I must check this ...
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 9 lines
Quoted 1 line
What is the WATCHDOG interval on the affected board?
~5 seconds
Ah, this is on an at91 board .. and in the
drivers/serial/atmel_usart.catmel_serial_tstc()is noWATCHDOG_RESET...So
ctrlc()does not trigger the watchdogCould you be a bit more specific here. Does your board expect
ctrlc()to update watchdog, so it won't reset?Quoted 6 lines
Quoted 4 lines
I do not know, if
ctrlc()must trigger the WDT ... I just looked into the while(1) loop incommon/cmd_dfu.c. There is onlyctrlc()which could trigger the WDT... and on at91 it does not trigger it ...By trigger you mean reset WDT core and don't reset the board?
I mean, the code must trigger the WDT somewhere in this while(1). If not, the WDT resets the board.
Quoted 5 lines
Quoted 3 lines
If dfu transfer is started there is some output on the console, which triggers the WDT too ... do you have a board with a running WDT?
On trats/trats2 we disable WDT when we enter the u-boot.
Why?
So you can test this behaviour. Do not disable the WDT and start the dfu command ... the board should reset when you start the dfu command (without starting dfu-util on the host, and if
ctrl()does not callWATCHDOG_RESETfor your hw) ... with my patch it should work ...
Quoted 4 lines
Quoted 2 lines
BTW: I could not disable the WDT on this board, once it is enabled. So disabling the WDT is no option ... :-(
Ok, I see. Then I will apply the proposed patch.
great!
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
I can imagine following situation when WDT is enabled when u-boot starts (its timeout is ~5sec) and then you start dfu transfer with not connected cable.
Then 5sec pass since cable is not connected and no transfer is ongoing. This causes board reset by WDT.Am I right?
Quoted 7 lines
Quoted 4 lines
Yes, because the WDT gets not triggered in this while(1). And maybe if you start the dfu command with connected cable, but not starting dfu-util on the host also, but I have not yet running the usb gadget on this at91 board (at91sam9g20 based) ...
Thanks for explanation. I just wanted to have bigger picture of the problem.
all right.
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 1/1 dfu: cmd: trigger watchdog before calling usb_gadget_handle_interrupts
In reply to Heiko SchocherHi Heiko,
Quoted 23 lines
trigger watchdog before calling
usb_gadget_handle_interrupts()This prevents board resets when calling dfu command on boards which have a watchdog.Signed-off-by Heiko Schocher <[email protected]>---
common/cmd_dfu.c | 2 ++ 1 file changed, 2 insertions(+)common/cmd_dfu.c +1
-0@@ -9,6 +9,7 @@*/ #include <common.h> +#include <watchdog.h> #include <dfu.h> #include <g_dnl.h> #include <usb.h>
common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int · line 71
Quoted 7 lines
common/cmd_dfu.c +1
-0@@ -64,6 +65,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (ctrlc()) goto exit; +WATCHDOG_RESET ();usb_gadget_handle_interrupts (); } exit:
Applied to u-boot-dfu tree! Thanks.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group