2 fwcol0 and fwcol1, 3 ce_busy interrupt, 4 pll_isr – Maxim Integrated 71M6534 Energy Meter IC Family Software User Manual

Page 55: Fwcol0 and fwcol1, Ce_busy interrupt, Pll_isr

Advertising
background image

71M653X Software User’s Guide

Once per second, the RTC_1_SEC interrupt runs. It calls a pulse counting routine that takes the counts from the pulse
interrupts, and adds them to global pulse counts. These pulse counts roll over at one million (1x10

6

). This step is

needed to synchronize the pulse counts with real time, since most tests of the pulse counts compare them against real
time.

TSC deprecates pulse counting because the direct CE registers are more precise, and easier to synchronize. The
accuracies are the same, because the pulse outputs are driven from CE register data.

5.4.2.2

FWCOL0 and FWCOL1

These occur when the CE is active, and there’s an attempt to erase or write to flash.

TSC’s demo code has no flash write routines in the standard release, so these interrupts are directed to a stub that
detects spurious interrupts.

5.4.2.3

CE_BUSY Interrupt

The CE_BUSY interrupt (ce_busy_isr() in meter\ce.c) detects mains power failure by reading the CE’s status. If
there’s a power failure, it saves two copies of the power registers.

Why two copies? The meter cannot predict when a power failure will occur. So, it always has to have valid data. The
first copy is updated by the meter calculations. The second is copied after the first one is done. So, one copy or the
other always has good data.

Both copies have a check for bad data. When the meter starts up, it uses the first copy with good data.

Many power grids have reclosers, circuit breakers that reset automatically several times. When a recloser trips, the
power grid rapidly switches from two to ten times. The time between reclosings varies, but is usually near 100
milliseconds.

Some utilities simulate recloser operation and test meters for anomalies. Some meters have anomalies from recloser
operation.

The demo code copes with reclosers by saving registers on the first power failure, and then ignoring following power
failures for up to 1/3 second. It ignores them by testing a counter (sag_timer) for zero, before saving registers. It
restarts the counter when the CE starts up and each time power fails. It counts down on normal ce_busy interrupts.

This interrupt occurs very often, 2500 times per second. So, the interrupt saves MPU time by running all the logic only
1/8 of the time. It has a counter.

5.4.2.4

PLL_ISR

When V1 goes below the comparison voltage, the meter IC switches to battery power. At the same time, the IC’s
electronics automatically takes action to reduce the power use. It switches off the CE, ADCs and phase-locked loop,
and switches the MPU clock from the phase-locked loop to 28kHz (7/8 of the crystal rate, but able to operate the serial
ports at 300 BAUD).

It then sets the PLL_FALL bit, which causes an interrupt.

The interrupt code (pll_isr() in main\batmodes.c) tests to see if a battery exists.

Since some meter ICs can operate the MPU with VCC as low as 1.5V, when there is no battery the MPU can corrupt
some EEPROMs by trying to write to them. So, if there’s no battery, the interrupt waits forever for the power to come
back. If the power does not return, the loop in this high priority interrupt prevents the MPU from trying to write to the
EEPROM. Basically, the loop confines the MPU’s low-power behavior to the loop.

If there’s no battery and the power returns while the interrupt is waiting, the code simulates a reset to start up the meter
again. When leaving brownout, the code could just restore the system state in some way, but the CE was turned off,
and its filters have unlocked from the mains. A simulated reset reuses reliable pre-existing code, and still starts up the
meter well before the CE could regain PLL lock.

If there is a battery, the code immediately performs a simulated reset to quickly get to the battery mode code in
main\main.c

The simulated reset in the battery case keeps the battery mode code in one place. The sleep and LCD-only states
start the MPU from the reset vector. So, some location on the reset path is the only place in which all system restart

v1.1v1.1

TERIDIAN Proprietary

55 of 116

© Copyright 2005-2008 TERIDIAN Semiconductor Corporation

Advertising
This manual is related to the following products: