A combined hardware/firmware device and method for automatic recovery of an
integrated circuit avoids a disruptive power-on reset after occurrence of
an electrostatic discharge which may occur during normal operations or
during electromagnetic compatibility testing. The device is incorporated
into the chip of the IC and includes an electromagnetic discharge sensor,
a flag, and firmware to execute the recovery and reset procedures. The
sensor is located between the VDD and VSS lines of the IC which itself
includes one or both of a microprocessor and a microcontroller. In a
power-on reset sequence, the sensor output and the flag are both set to
logic 0. After an electrical transient voltage occurs, the sensor output
is set to logic 1. The logic 1 output of the sensor sets the flag, which
may be a D flip-flop, to a value of logic 1. When either a power-on reset
operation begins or the sensor output is set to logic 1 due to an
electrical transient voltage on the VDD-VSS lines, firmware begins a reset
subroutine in which (1) the sensor output is reset to logic 0, (2) the
status of the flag is checked, (3) if the flag is at logic 1, the firmware
performs a recovery procedure to restore predetermined functions of the IC
and resets the flag to logic 0 (the recovery procedure being performed on
the order of nanoseconds), and (4) if the flag is at logic 0, a general
reset procedure is performed. The reset procedure includes a first set of
operations and the recovery procedure includes a second set of operations
which is different from the first set of operations (for example, a subset
or overlapping set). The reset procedure will be disruptive to a user,
whereas the recovery procedure involves smooth restoration not noticeable
to the user. The apparatus and method permit higher levels of
electrostatic discharge to be absorbed by a device without causing
permanent damage and/or corrupted data. One particular embodiment for the
present invention is for personal computer keyboard microcontrollers.