AN370
Rev. 1.0
61
7.8. Multi-time Programmable (MTP) Memory Module
The multi-time programmable (MTP) memory (EEPROM) module functions deal with four 20-32 bit counters stored
in the MTP non-volatile memory. In general the functions associated with the MTP module read and increment
counters stored in the MTP memory. Actual counter values stored in the MTP are in special encoded format, not in
the counter decimal representation. Users may change the contents of the memory at their own risk. The supplied
API functions expect the contents of the MTP to be in balanced gray encoded format. The purpose for balanced
gray encoding is to limit the number of transitions on any single bit of the memory.
The user is free to use any part of the MTP memory for different purposes. The memory is accessed as 128 bit 1
serial one bit in/128 bit parallel bits out. If the user wants to change a single bit in the MTP then all 128 bits need to
be read, single bit changed, and all 128 bits have to be put back into the MTP. There is no bit addressing in the
MTP.
7.8.1. MTP Memory Module Global Variables
The parallel 128 bit output of the MTP is organized into the read only 16 byte array
abMTP_RDATA[16]
Read only array of 16 bytes where the contents of the MTP can be read upon strobing of
the MTP outputs by vMtp_Strobe() function. This array is a read only array mapped into
the XDATA space.
This array is updated from MTP when the vMtp_Strobe() function is called. The functions
pbMtp_Read() and bMtp_Write() call the vMtp_Strobe() before return, so after calling
those two functions the array contains the MTP content.
7.8.2. Working with MTP
The user can choose not to use the balanced counters as implemented by API. The user is free to work with any bit
in the MTP memory. Given the asymmetric nature of the MTP there are rules the user should follow to work with
MTP raw data:
1. Any bit in the MTP can change state only up to 50,000 times. Since during programming all the bits which are
not being changed have to be put back into the MTP in their read state, it is worth noting that the fact that some
bits are changing values is not counted against the longevity of the bits for which the value is not changed.
2. The user must copy the read only array abMTP_RDATA[16] to XDATA RAM memory by calling pbMtp_Read()
function. The function returns a pointer to the 16 byte array in XDATA where the read only array
abMTP_RDATA[16] was copied to. The XDATA RAM array is part of the API reserved area. Note that every call
to pbMtp_Read() will return the same pointer value – the XDATA location of the mirror array is fixed.
3. All the desired changes must be done on the XDATA array, pointer to which was returned by abMtp_Read()
data.
4. Call the bMtp_Write() function to write the modified data from XDATA array to MTP.
It is up to the application responsibility not to stress any of the MTP bits over the specified limit.
7.8.3. Working with Balanced Counters
This module implements API functions which implement balanced counters (counting up), such that the application
can use an MTP based counter which counts up to 1.040 million counts while no stressing any of the MTP bits over
the 50,000 cycle limit.
The counter width in this section means overall balance counter width in bits, which are needed to store the
counter value in MTP.
The module supports up to 4 to 5 counters with the following independent configurations per counter.