Project

General

Profile

Actions

Attiny-wdt » History » Revision 4

« Previous | Revision 4/8 (diff) | Next »
laforge, 08/10/2022 10:38 AM


attiny-wdt

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.

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.

Operating Principle

The general idea is to use the Timer/Counter block of the ATTiny9 in the following way:
  • Clear the output OC0B on BOTTOM (counter == 0)
    • this generates a rising edge on the !RESET signal of the CPU we're guarding
  • Set the output OC0B when counter reaches OCR0B
    • this generates a falling edge on the !RESET signal of the CPU we're guarding
  • Wrap the counter once it reaches OCR0A
    • this determines the amount of time until a reset
  • Configure any falling edge on the INT0 pin to re-set the counter to zero
    • this is what the software on the CPU we're guarding nees to do to avoid the watchdog from expiring

Pinout

The board contains two connectors:

JP1

This header is used in two cases:
  1. programming phase: the firmware into the ATtiny9 (using the TPI protocol)
  2. normal use: To supply VCC to the watchdog and to connect its output with !RESET/GLOBAL_EN of the target
Number Name Description Programming Function
1 VCC 3.3V supply voltage powering the watchdog VCC
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
3 PB0 - TPIDATA
4 !RESET - !RESET
5 GND Ground GND

JP2

Number Name Description
1 GND Ground
2 PB2 Input; any falling edge re-sets the counter to zero. Connected to GPIO26 on Raspi
3 PB0/GPIO19 No function; RFU

Pictures

The pictures below show one of the first hand-soldered prototypes:

attiny-wdt1.jpg attiny-wdt2.jpg attiny-wdt3.jpg

Files (9)
attiny-wdt1.jpg View attiny-wdt1.jpg 310 KB laforge, 08/10/2022 10:24 AM
attiny-wdt2.jpg View attiny-wdt2.jpg 184 KB laforge, 08/10/2022 10:24 AM
attiny-wdt3.jpg View attiny-wdt3.jpg 286 KB laforge, 08/10/2022 10:24 AM
attiny_wdt_with_gulprog_cable.jpg View attiny_wdt_with_gulprog_cable.jpg 710 KB laforge, 08/23/2022 02:22 PM
guloprog_with_cable.jpg View guloprog_with_cable.jpg 476 KB laforge, 08/23/2022 02:23 PM
attiny_with_cable.jpg View attiny_with_cable.jpg 605 KB laforge, 08/23/2022 02:24 PM
attiny_wdt_v2_bot.jpg View attiny_wdt_v2_bot.jpg 348 KB laforge, 08/23/2022 02:28 PM
attiny_wdt_v2_top.jpg View attiny_wdt_v2_top.jpg 340 KB laforge, 08/23/2022 02:28 PM
attiny_wdt_led_test.jpg View attiny_wdt_led_test.jpg 718 KB laforge, 08/23/2022 02:30 PM

Updated by laforge almost 2 years ago · 4 revisions

Add picture from clipboard (Maximum size: 48.8 MB)