SLAU367P October 2012 – April 2020 MSP430FR5041 , MSP430FR5043 , MSP430FR50431 , MSP430FR5847 , MSP430FR58471 , MSP430FR5848 , MSP430FR5849 , MSP430FR5857 , MSP430FR5858 , MSP430FR5859 , MSP430FR5867 , MSP430FR58671 , MSP430FR5868 , MSP430FR5869 , MSP430FR5870 , MSP430FR5872 , MSP430FR58721 , MSP430FR5887 , MSP430FR5888 , MSP430FR5889 , MSP430FR58891 , MSP430FR5922 , MSP430FR59221 , MSP430FR5947 , MSP430FR59471 , MSP430FR5948 , MSP430FR5949 , MSP430FR5957 , MSP430FR5958 , MSP430FR5959 , MSP430FR5962 , MSP430FR5964 , MSP430FR5967 , MSP430FR5968 , MSP430FR5969 , MSP430FR5969-SP , MSP430FR59691 , MSP430FR5970 , MSP430FR5972 , MSP430FR59721 , MSP430FR5986 , MSP430FR5987 , MSP430FR5988 , MSP430FR5989 , MSP430FR5989-EP , MSP430FR59891 , MSP430FR5992 , MSP430FR5994 , MSP430FR59941 , MSP430FR6005 , MSP430FR6007 , MSP430FR6035 , MSP430FR6037 , MSP430FR60371 , MSP430FR6041 , MSP430FR6043 , MSP430FR60431 , MSP430FR6045 , MSP430FR6047 , MSP430FR60471 , MSP430FR6820 , MSP430FR6822 , MSP430FR68221 , MSP430FR6870 , MSP430FR6872 , MSP430FR68721 , MSP430FR6877 , MSP430FR6879 , MSP430FR68791 , MSP430FR6887 , MSP430FR6888 , MSP430FR6889 , MSP430FR68891 , MSP430FR6920 , MSP430FR6922 , MSP430FR69221 , MSP430FR6927 , MSP430FR69271 , MSP430FR6928 , MSP430FR6970 , MSP430FR6972 , MSP430FR69721 , MSP430FR6977 , MSP430FR6979 , MSP430FR69791 , MSP430FR6987 , MSP430FR6988 , MSP430FR6989 , MSP430FR69891
Before configuring the MTIF, the RTC module must be configured for operation. Chose the maximum pulse frequency for operation and select PGFS accordingly (see Table 23-1). 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.
Table 23-2 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).
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 |
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 |