3 application note an225, 4 interrupt and watchdog timer, 1 interrupt – Cirrus Logic CS5460A User Manual

Page 26: 1 clearing the status register, 2 typical use of the int pin, 3 int active state, 4 exceptions, 2 watch dog timer, Cs5460a

Advertising
background image

CS5460A

26

DS487F5

3.3.3 Application Note AN225

For more information on Auto-boot mode, see the
AN225, “USING THE CS5460A AUTO-BOOT
MODE”.

3.4 Interrupt and Watchdog Timer

3.4.1 Interrupt

The INT pin is used to indicate that an event has
taken place in the CS5460A that (may) need atten-
tion. These events inform the meter system about
operation conditions and internal error conditions.
The INT signal is created by combining the Status
Register with the Mask Register. Whenever a bit in
the Status Register becomes active, and the corre-
sponding bit in the Mask Register is a logic 1, the
INT signal becomes active.

3.4.1.1 Clearing the Status Register

Unlike the other registers, the bits in the Status
Register can only be cleared (set to logic 0). When
a word is written to the Status Register, any 1s in
the word will cause the corresponding bits in the
Status Register to be cleared. The other bits of the
Status Register remain unchanged. This allows the
clearing of particular bits in the register without
having to know the state of the other bits. This
mechanism is designed to facilitate handshaking
and to minimize the risk of losing events that ha-
ven’t been processed yet.

3.4.1.2 Typical use of the INT pin

The steps below show how interrupts can be han-
dled by the on-board MCU.

Initialization:

Step I0 - All Status bits are cleared by writing
FFFFFF (Hex) into the Status Register.

Step I1 - The conditional bits which will be used
to generate interrupts are then written to logic
1 in the Mask Register.

Step I2 - Enable interrupts.

Interrupt Handler Routine:

Step H0 - Read the Status Register.

Step H1 - Disable all interrupts.

Step H2 - Branch to the proper interrupt service
routine.

Step H3 - Clear the Status Register by writing
back the value read in step H0.

Step H4 - Re-enable interrupts.

Step H5 - Return from interrupt service routine.

This handshaking procedure insures that any
new interrupts activated between steps H0 and
H3 are not lost (cleared) by step H3.

3.4.1.3 INT Active State

The behavior of the INT pin is controlled by the SI1
and SI0 bits of the Configuration Register. The pin
can be active low (default), active high, active on a
return to logic 0 (pulse-low), or active on a return to
logic 1 (pulse-high).

If the interrupt output signal format is set for either
active-high or active-low assertion, the interrupt
condition is cleared when the bits of the Status
Register are returned to their inactive state. If the
interrupt output signal format is set for either
pulse-high or pulse-low, note that the duration of
the INT pulse will be at least one MCLK/K cycle, al-
though in some cases the pulse may last for 2
MCLK/K cycles.

3.4.1.4 Exceptions

The IC (Invalid Command) bit of the Status Regis-
ter can only be cleared by performing the port ini-
tialization sequence. This is also the only Status
Register bit that is active low.

To properly clear the WDT (Watch Dog Timer) bit
of the Status Register, first read the Energy Regis-
ter, then clear the bit in the Status Register.

3.4.2 Watch Dog Timer

The Watch Dog Timer (WDT) is provided as a
means of alerting the system that there is a poten-
tial breakdown in communication with the micro-
controller. By allowing the WDT to cause an
interrupt, a controller can be brought back, from
some unknown code space, into the proper code
for processing the data created by the converter.
The time-out is preprogrammed to approximately 5
seconds. The countdown restarts each time the
Energy Register is read. Under typical situations,
the Energy Register is read every second. As a re-
sult, the WDT will not time out. Other applications
that use the watchdog timer will need to ensure

Advertising