MTIF Operation
623
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
Metering Test Interface (MTIF)
23.2.4 Reading Pulse Counter
To read the pulse counter perform a read request to update the pulse counter read register by writing
MTIFPCCTL.PCRR = 1 with password, then wait for the acknowledge on MTIFPCST.PCRA for
confirmation.
Table 23-4. Reading the Pulse Rate
Order
LPM3 operation
Comment
1
Check if MTIFPCSR.PCRA = 0
Check if last request is complete
2
Write to MTIFPCCTL (PGPW = 0xA5, PCRR = 1)
Request update of pulse counter read register
3
Wait for MTIFPCSR .PCRA = 1
Wait until update request is acknowledged
4
Read MTIFPCR register
Treat the count value as signed 16 bit value
5
Subtract the old (previous) value from new value; this is
done after reading the PCSR.OFL bit
Calculate the difference with wrap around correction when
negative
MTIFPCSE.PCOFL indicates an wrap around of the pulse counter. MTIFPCSR.PCOFL can be considered
as the 17
th
bit of the counter. XOR the previous read with the current read value to determine the overflow
condition.
23.2.5 Synchronizing Pulse Generator Timing to Application
At the very first start up, perform an update request: set MTIFPGCTL.PGUR, poll MTIFPGSR.PGUA for
changing, then read the RTC prescaler registers after the MTIFPGSR.PGUA change. The RTC prescaler
value indicates the moment of the update slot for the selected frame rate. Alternatively, set the RTC
prescaler registers after a MTIFPGSR.PGUA change for synchronization.
In most cases, the pulse generator frame rate and the measurement rate of the meter are kept the same.
If the MTIFPGKVAL register is updated much faster than the pulse generator frame frequency, the value
read during the update time slot is used for the next frame.
23.2.6 Various Resets During MTIF Operation
The MTIF module provides immunity against most system reset types. A power-up clear (PUC) resets the
watchdog timer (WDT), and password violation resets do not cause any changes in setting, count, and
behavior of the MTIF setting.
A power-on reset (POR) stops the RTC and low-frequency crystal and sets MTIFPGCNF.PGEN = 0 and
MTIFPCCNF.PCEN = 0. After a POR, reactivate the module and settings and record the POR event as an
error with a timestamp for later reference, if required by the application.
A POR (for example, after waking up from LPMx.5) resets the MTIF pin configuration, but the content of
the pulse generator setting and the pulse counter are not affected. Reinitialize the MTIF pin configuration
by software.
A BOR (resulting from a power supply drop) resets the MTIF module, including the pulse generating
setting and pulse counter value.
A reset caused by the RST pin resets the MTIF module. To avoid this type of reset, select the NMI
functionality on the RST/NMI pin. Restore SFRRPCR.SYSNMI on any other reset.
23.2.7 PUC Reset During Register Access
PUC resets can occur during register access of the pulse generator registers, pulse counter registers, or
pin configuration registers. A PUC reset requires immediate action during the following reset start-up
sequence, because the configuration and counter value may be corrupted. Alternatively, use software
signatures in FRAM and Hoare_Monitors to keep track of what was happening and resolve the situation.
The application can keep FRAM structures (in separate storage clusters) that contain "old_value",
"new_value", "transaction_number", and "transaction_state". Record and update each phase of the
transaction. This allows recovery after any reset on the next start-up.