Attiny-wdt » History » Version 3
laforge, 08/10/2022 10:38 AM
1 | 1 | laforge | h1. @attiny-wdt@ |
---|---|---|---|
2 | |||
3 | @attiny-wdt@ is an OSHW + open source firmware project of turning an Attiny{4,5,9,10} microcontroller into a hardware watchdog that can be used to reset another CPU/SoC when it gets stuck. |
||
4 | |||
5 | The primary use case was to use it with Raspberry Pi devices. Those do have a built-in hardware watchdog themselves, but unfortuantelly it is not documented at the register-level and there is no option to enable it straight from the boot loader, so it is not really providing the kind of guarantees one would expect from a watchdog. |
||
6 | |||
7 | 3 | laforge | h2. Operating Principle |
8 | |||
9 | The general idea is to use the Timer/Counter block of the ATTiny9 in the following way: |
||
10 | * Clear the output @OC0B@ on BOTTOM (counter == 0) |
||
11 | ** this generates a rising edge on the @!RESET@ signal of the CPU we're guarding |
||
12 | * Set the output @OC0B@ when counter reaches @OCR0B@ |
||
13 | ** this generates a falling edge on the @!RESET@ signal of the CPU we're guarding |
||
14 | * Wrap the counter once it reaches @OCR0A@ |
||
15 | ** this determines the amount of time until a reset |
||
16 | * Configure any falling edge on the INT0 pin to re-set the counter to zero |
||
17 | ** this is what the software on the CPU we're guarding nees to do to avoid the watchdog from expiring |
||
18 | |||
19 | h2. Pinout |
||
20 | |||
21 | The board contains two connectors: |
||
22 | |||
23 | h3. JP1 |
||
24 | |||
25 | This header is used in two cases: |
||
26 | # *programming phase:* the firmware into the ATtiny9 (using the TPI protocol) |
||
27 | # *normal use:* To supply VCC to the watchdog and to connect its output with @!RESET/GLOBAL_EN@ of the target |
||
28 | |||
29 | |_.Number|_.Name|_.Description|_.Programming Function| |
||
30 | |1|VCC|3.3V supply voltage powering the watchdog|VCC| |
||
31 | |2|GLOBAL_EN|watchdog output; expected to be connected to the !RESET of the CPU we're guarding (or GLOBAL_EN in case of Raspi)|TPICLK| |
||
32 | |3|PB0|-|TPIDATA| |
||
33 | |4|!RESET|-|!RESET| |
||
34 | |5|GND|Ground|GND| |
||
35 | |||
36 | |||
37 | h3. JP2 |
||
38 | |||
39 | |_.Number|_.Name|_.Description| |
||
40 | |1|GND|Ground| |
||
41 | |2|PB2|Input; any falling edge re-sets the counter to zero. Connected to GPIO26 on Raspi| |
||
42 | |3|PB0/GPIO19|No function; RFU| |
||
43 | |||
44 | |||
45 | 1 | laforge | h2. Pictures |
46 | |||
47 | 2 | laforge | The pictures below show one of the first hand-soldered prototypes: |
48 | 1 | laforge | |
49 | 2 | laforge | {{thumbnail(attiny-wdt1.jpg)}} {{thumbnail(attiny-wdt2.jpg)}} {{thumbnail(attiny-wdt3.jpg)}} |