Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys/auto_init: control the wdt thread #21024

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mariemC
Copy link
Contributor

@mariemC mariemC commented Nov 21, 2024

Contribution description

This enables the user to stop the watchdog thread at any time, the use case I had is that due to a power glitch the board hangs before reaching main, so the idea was to add the module auto_init_wdt_thread to enable early resets in case the board hangs (workaround ^^) But I don't want the thread to continue working becasue it can interfere with the behavior of the software and can lead to unwanted resets, therefore I wanted to add a "wdt_stop_thread" to stop the watchdog thread once main is reached.

Testing procedure

For testing, I have used the gnrc_networking example and I added the module auto init wdt:

USEMODULE += auto_init_wdt_thread
CFLAGS += -DCONFIG_PERIPH_WDT_WIN_MAX_MS=16384 /* feel free to change this  or not add it ;) */

and in main I added:
wdt_thread_stop();

output, no wdt thread:

ps
2024-11-21 15:52:10,060 # ps
2024-11-21 15:52:10,063 # 	pid | name                 | state    Q | pri | stack  ( used) ( free) | base addr  | current     
2024-11-21 15:52:10,076 # 	  - | isr_stack            | -        - |   - |    512 (  240) (  272) | 0x20000000 | 0x200001c8
2024-11-21 15:52:10,083 # 	  1 | main                 | running  Q |   7 |   1536 (  700) (  836) | 0x20000b58 | 0x20000fac 
2024-11-21 15:52:10,093 # 	  3 | pktdump              | bl rx    _ |   6 |   1472 (  176) ( 1296) | 0x20005324 | 0x20005834 
2024-11-21 15:52:10,097 # 	  4 | 6lo                  | bl rx    _ |   3 |    960 (  356) (  604) | 0x20006348 | 0x200065bc 
2024-11-21 15:52:10,109 # 	  5 | ipv6                 | bl rx    _ |   4 |    960 (  400) (  560) | 0x200012b4 | 0x20001524 
2024-11-21 15:52:10,116 # 	  6 | udp                  | bl rx    _ |   5 |    448 (  192) (  256) | 0x2000674c | 0x2000684c 
2024-11-21 15:52:10,125 # 	  7 | at86rf215 [sub GHz]  | bl anyfl _ |   2 |    896 (  376) (  520) | 0x20001ad0 | 0x20001d8c 
2024-11-21 15:52:10,126 # 	  8 | at86rf215 [2.4 GHz]  | bl anyfl _ |   2 |    896 (  376) (  520) | 0x20001e50 | 0x2000210c 
2024-11-21 15:52:10,140 # 	  9 | atwinc15x0           | bl anyfl _ |   2 |    896 (  700) (  196) | 0x200028ec | 0x20002bac 
2024-11-21 15:52:10,156 # 	 10 | slipdev              | bl anyfl _ |   2 |    896 (  264) (  632) | 0x20002e68 | 0x2000312c 
2024-11-21 15:52:10,157 # 	    | SUM                  |            |     |   9472 ( 3780) ( 5692)

@github-actions github-actions bot added the Area: sys Area: System label Nov 21, 2024
@benpicco
Copy link
Contributor

But for your application: do you even need the thread? When you set the WDT interval so high and disable it right away in main(), you could also just

USEMODULE += periph_wdt_auto_start

and call wdt_stop() in main()

@mariemC
Copy link
Contributor Author

mariemC commented Nov 21, 2024

But for your application: do you even need the thread? When you set the WDT interval so high and disable it right away in main(),
The max window in the application will be the default 1024ms!

@mariemC
Copy link
Contributor Author

mariemC commented Nov 21, 2024

Hm but still high...

@mariemC mariemC force-pushed the mariem/wdt_thread_stop branch from 35f8c46 to df8e4d1 Compare November 21, 2024 15:36
@mariemC
Copy link
Contributor Author

mariemC commented Nov 21, 2024

No need for this then, I drop it

@maribu
Copy link
Member

maribu commented Dec 13, 2024

No need for this then, I drop it

So, this PR is no longer needed and should be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: sys Area: System
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants