Watchdog: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
The watchdog is an anti lock-up/protection feature consisting of a resettable down counter located in the [[NEO-B1]] chip, that resets the system if it underflows. It can be disabled by putting pin {{Sig|DOGE|DOGE}} to ground.
[[File:Doge.jpg|thumb|The watchdog can be physically disabled for troubleshooting purposes by connecting pin {{Sig|DOGE|DOGE}} (watch'''DOG E'''nable, {{Chipname|NEO-B1}} pin 94, J2 jumper on some boards) to ground.]]


It must be therefor "kicked" regularly to reset the counter to its highest value. This is done by writing any byte to any odd addresses in the $300000~$31FFFF range. Register {{Reg|REG_DIPSW}} is the most often used. [[68k interrupts|VBlank]] routines often take care of this task.
The watchdog is an automatic reset system to prevent games from freezing due to a bug or a hardware fault. It's a common feature of arcade hardware and many electronic systems.


A constantly resetting system produces a typical clicking sound, giving a clue for solving boot issues. (Sound file ?)
On the NeoGeo, it consists of an internal frame counter 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}} (to "kick" the watchdog). [[68k interrupts|VBlank]] routines typically take care of this task, so care has to be taken when the interrupt is disabled.


Watchdog can be disabled by shorting J2 jumper.
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 ?
The NeoGeo CD 2 also has a watchdog timer ?


Informations from [[MESS]]'s source:
==Timings==


The watchdog timer will reset the system after ~0.13 seconds (Clocked by what signal ?).
This isn't verified.


Newer games force a reset using the following code (from KOF99):
Charles mvstech.txt specifies this:
<syntaxhighlight>
MOVE.L  #$30D40,D0
SUBQ.L  #1,D0
BCC.S    *-0x2
</syntaxhighlight>


The watchdog is used as a form of protecetion 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.
<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.
 
The counter is clocked by the {{Sig|CHBL|BNKB}} signal.
 
*3244030 cycles corresponds to 8 [[Framerate|frames]].
*8120860 cycles corresponds to 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, matching the duration of 2 times 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:Base system]]
[[Category:Base system]]

Latest revision as of 20:16, 9 May 2019

The watchdog can be physically disabled for troubleshooting purposes by connecting pin DOGE (watchDOG Enable, NEO-B1 pin 94, J2 jumper on some boards) to ground.

The watchdog is an automatic reset system to prevent games from freezing due to a bug or a hardware fault. It's a common feature of arcade hardware and many electronic systems.

On the NeoGeo, it consists of an internal frame counter 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 (to "kick" the watchdog). VBlank routines typically take care of this task, so care has to be taken when the interrupt is disabled.

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.

The counter is clocked by the CHBL signal.

  • 3244030 cycles corresponds to 8 frames.
  • 8120860 cycles corresponds to 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, matching the duration of 2 times 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.