MTIF Operation
622
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
Metering Test Interface (MTIF)
23.2.2 Initialization of the MTIF
Before configuring the MTIF, the RTC module must be configured for operation. Chose the maximum
pulse frequency for operation and select PGFS accordingly (see
). In the following initialization
example, a grid frequency of 256 Hz is chosen. The grid frequency is the frequency at which the inner
state machines of the pulse generator and the pulse counter run. The width of pulses and the gaps are
derived from this frequency. A frequency of 256 Hz allows a pulse rate of 128 pulses per seconds. The
frame duration is 1 second. Within this second, up to 127 pulses can be generated. No pulse is generated
in the update time slot.
summarizes the process of initializing MTIF. The MTIF requires a running RTC, therefore the
RTC is initialized first. Next, the MTIF pulse generator, pins, and counter are configured. Optionally, the
pulse counter can be cleared (regulations in some countries require that the counter can be cleared only
once in a meter’s lifetime).
Table 23-1. PGFS Values
PGFS
Pulses Rate
Frame Duration
Update Time Slot
Grid Frequency
0
8
16 s
62 ms before frame end
16 Hz
1
16
8 s
31 ms before frame end
32 Hz
2
32
4 s
15 ms before frame end
64 Hz
3
64
2 s
8 ms before frame end
128 Hz
4
128
1 s
4 ms before frame end
256 Hz
5
256
500 ms
2 ms before frame end
512 Hz
6
512
250 ms
1 ms before frame end
1024 Hz
7
1024
125 ms
500 µs before frame end
2048 Hz
Table 23-2. MTIF Initialization
Order
Required
Comment
1
Configure and enable the RTC
See RTC module chapter for details
2
Write to MTIFPGCNF (PGPW = 0x5A, PGFS = 5,
PGCLR = 1, PGEN = 1)
Set grid frequency to 256 Hz, clear and enable the MTIF
pulse generator
3
Write to MTIFPGCTL (PGPW = 0x5A, PGUR = 1)
Request update of grid frequency setting
4
Check for MTIFPGST.PGUA = 1
Check for acknowledge of PGFS setting
5
Write to MTIFPCCNF (PCPW = 0xA5, PCCLR = 1,
PCEN = 1)
Clear and enable MTIF pulse counter
6
Write to MTIFTPCTL (TPPW = 0xC3, ACTIVATE = 1,
TPOE = 1)
Enable MTIF output enable pin to control MTIF output
23.2.3 Setting the Pulse Rate
To set the pulse rate to
n
pulses per frame, write the required pulse count
n
into MTIFPGKVAL.KVAL = n
with proper password and request an update by setting MTIFPGCTL.PKUR = 1 with password. The
update occurs at the last time slot of the current frame. MTIFPGCTL.PKUA may be polled after for 1 to
verify an update of MTIFPGKVAL.
shows a simple example to set the pulse rate.
Table 23-3. Setting the Pulse Rate
Order
LPM3 operation
LPM3.5 operation
Comment
1
Check if MTIFPGSR.PGUA = 0
Check if MTIFPGSR.PGUA = 0
Check if last request is complete
2
Write to MTIFPGKVAL(PGPW = 0x5A,
KVAL = n)
Write to MTIFPGKVAL(PGPW = 0x5A,
KVAL = n)
Set to
n
pulses
3
Write to MTIFPGCTL (PCPW = 0x5A,
PGUR = 1)
Write to MTIFPGCTL (PCPW = 0x5A,
PGUR = 1)
Request update of pulse generator
4
Enter LPM3
Enter LPM3.5
Optional, when required