Watchdog: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The watchdog is an anti lock-up/protection feature in AES/MVS system: A resettable down counter located in the [[NEO-B1]] chip resets the system if it underflows.
The watchdog is an anti lock-up (or security) measure to prevent games from freezing due to a bug or a glitch. It's a common feature of arcade hardware and many electronic systems.


It must be therefor "kicked" regularly to reset the counter to its highest value, this is done by writing any byte to register REG_DIPSW ($300001).
It consists of an internal resettable counter in {{Chipname|NEO-B1}} which resets the whole system if it goes over a certain value. To avoid this, the software needs to regularly reset the counter by writing any value to {{Reg|REG_DIPSW|REG_DIPSW}} ("kick" the watchdog). [[68k interrupts|VBlank]] routines typically take care of this task, but care has to be taken when the interrupt is disabled.
Games [[68k interrupts|VBlank]] routines often take care of this task.


Constantly resetting systems produce a typical clicking sound (due to ?), giving a clue for solving boot issues.
The watchdog counter can be physically disabled by connecting pin {{Sig|DOGE|DOGE}} to ground (J2 jumper on some boards). This was probably done on development units.


CD systems don't have a watchdog.
A constantly resetting system produces the [[click of death]]: a typical clicking sound, giving a clue for solving boot issues.


(Sound file ?)
The NeoGeo CD 2 also has a watchdog timer ?
 
==Timings==
 
This isn't verified.
 
Charles mvstech.txt specifies this:
 
<pre>
/RESET low          3 244 030 cycles
/RESET high        8 120 860 cycles
Total time        11 364 890 cycles
</pre>
 
[[MAME]]'s source says that a 0.128762s long loop '''sometimes''' resets the system.
 
Since the values are large and don't match simple binary numbers, the watchdog timer might have been implemented in NEO-B1 so it can be clocked by a slow video-related signal. This would also explain the variable behavior described in the MAME comment.
 
*3244030 cycles is an extremely close match to the cycle count of exactly 8 [[Framerate|frames]].
*8120860 cycles is also a very close match to the duration of 20 frames (- 7 lines).
*128762µs is 3090288 cycles, which corresponds to about 7.6 frames.
 
A looping watchdog reset gives a steady 3.7Hz {{Sig|RESET|RESET}} signal, relating to the duration of 2x 8 frames (135.17ms).
 
==As a security measure==
 
The watchdog is used as a form of protection on a number of games, previously this was implemented as a specific hack which locked a single address of [[Battery-backed RAM|SRAM]]. If the game doesn't find valid data in the backup ram it will initialize it, then sit in a loop. The watchdog should then reset the system. If the watchdog fails to reset the system the code will continue and set a value in backup ram to indiate that the protection check has failed.


[[Category:Code]]
[[Category:Code]]
[[Category:CPUs]]
[[Category:Base system]]

Revision as of 22:32, 14 June 2016

The watchdog is an anti lock-up (or security) measure to prevent games from freezing due to a bug or a glitch. It's a common feature of arcade hardware and many electronic systems.

It consists of an internal resettable counter in NEO-B1 which resets the whole system if it goes over a certain value. To avoid this, the software needs to regularly reset the counter by writing any value to REG_DIPSW ("kick" the watchdog). VBlank routines typically take care of this task, but care has to be taken when the interrupt is disabled.

The watchdog counter can be physically disabled by connecting pin DOGE to ground (J2 jumper on some boards). This was probably done on development units.

A constantly resetting system produces the click of death: a typical clicking sound, giving a clue for solving boot issues.

The NeoGeo CD 2 also has a watchdog timer ?

Timings

This isn't verified.

Charles mvstech.txt specifies this:

/RESET low          3 244 030 cycles
/RESET high         8 120 860 cycles
Total time         11 364 890 cycles

MAME's source says that a 0.128762s long loop sometimes resets the system.

Since the values are large and don't match simple binary numbers, the watchdog timer might have been implemented in NEO-B1 so it can be clocked by a slow video-related signal. This would also explain the variable behavior described in the MAME comment.

  • 3244030 cycles is an extremely close match to the cycle count of exactly 8 frames.
  • 8120860 cycles is also a very close match to the duration of 20 frames (- 7 lines).
  • 128762µs is 3090288 cycles, which corresponds to about 7.6 frames.

A looping watchdog reset gives a steady 3.7Hz RESET signal, relating to the duration of 2x 8 frames (135.17ms).

As a security measure

The watchdog is used as a form of protection on a number of games, previously this was implemented as a specific hack which locked a single address of SRAM. If the game doesn't find valid data in the backup ram it will initialize it, then sit in a loop. The watchdog should then reset the system. If the watchdog fails to reset the system the code will continue and set a value in backup ram to indiate that the protection check has failed.