tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

rp2040: watchdog

Open ysoldak opened this issue 3 years ago • 7 comments

Implements hardware watchdog timer for RP2040.

Implementation inspired by Pico SDK It ended up quite different though.

I could not use time.Duration to have nice "period" configuration parameter instead of "ticks" due to an import loop.

Examples demonstrate basic usage, watchdog triggering on runtime panic and while spinning. Basic example added to the list of smoke tests.

ysoldak avatar Jan 30 '22 01:01 ysoldak

This is printout from the basic example:

Hardware reset
10
9
8
7
6
5
4
3
2
1
0

Timer reset
10
9
8
7
6

Force reset
10
9
8
7
6
5
4
3
2
1
0

Timer reset
10
9
8

ysoldak avatar Jan 31 '22 19:01 ysoldak

@ofauchon What do you think?

ysoldak avatar Feb 02 '22 11:02 ysoldak

I've observed a strange behaviour when building with this change. Time seem to flow much slower with these changes. I've probably messed up with some timer.

This behaviour manifests itself quite remarkably: while the board is plugged in and flashed (tinygo flash) it works just fine as usual. But once you unplug the board and plug it in again (hard power cycle) you can directly tell your code runs much slower, very easy to see with blinky1 example.

ysoldak avatar Feb 08 '22 00:02 ysoldak

Now that https://github.com/tinygo-org/tinygo/pull/3855 was merged, this PR seems obsolete, so should probably close it.

deadprogram avatar Sep 10 '23 13:09 deadprogram

Now that #3855 was merged, this PR seems obsolete, so should probably close it.

That PR does not cover all functionality though. I'll try and rebase and sync with dev branch.

ysoldak avatar Sep 12 '23 13:09 ysoldak

@ysoldak just noticed this PR again. What do you think about it?

deadprogram avatar Nov 12 '25 10:11 deadprogram

@deadprogram I'll take a look. If nothing from me in a week, feel free to close it.

ysoldak avatar Nov 12 '25 19:11 ysoldak