SNAP_OTP - david-macmahon/wiki_convert_test GitHub Wiki
Introduction
The SPI flash chip used on the SNAP board has a special 64 byte region of one-time programmable (OTP) memory. It is called "one-time programmable" because the bits can be "programmed" from '1' to '0', but they can never be "erased" back from '0' to '1'. This property makes this region useful for storing information unique to each individual SNAP board such as the board's serial number. Because future as-yet-imagined uses of this special memory region may be devised, it is also nice to provide some indication to the reader about what they might be able to expect to find or not find in the OTP memory. This specification details the scheme used to manage this OTP memory on SNAP boards.
Versioning
Because different and/or additional uses of the OTP memory may be devised in the future, this specification will be released in versions. The first (and current) version is version 0. The version number is encoded in the first byte of the OTP region in a way that allows updating the version number on a board programmed with on older version number. The version number is stored in the first byte of the OTP region. Each version specifies the utilization of a version-defined number of bytes. These version-defined bytes must follow the space occupied by the version-specific bytes of all previous versions. The unused bytes following the version-defined bytes are always reserved for future use and must be left un-programmed.
Byte 0 - OTP Version
The first byte in the OTP region (offset 0) is the OTP specification version byte. It is essentially a bit mask where the highest order '0' bit identifies the highest OTP specification version number programmed into the device. OTP version 0 is indicated by no '0' bits in the first byte ('11111111'). Bits below the highest order '0' bit may be '0' or '1' depending on whether the version defined bytes for the corresponding version are programmed with valid data. This allows the OTP region of an existing board to be updated with future versions. It is recommended, but not required, that the version-specific bytes for all previous versions be programmed with valid data. OTP version 0 is not associated with an individual bit in the OTP version byte, so OTP version 0 must always be supported and its version-specific bytes programmed. If the version-specific bytes of earlier (>0) versions are not programmed, the OTP version bits for the earlier version should be left at '1'.
OTP Version 0
OTP version 0 defines five version-specific bytes in the OTP region for holding board serial number information. These bytes immediately follow the OTP version byte so they at stored at offsets 1, 2, 3, 4, 5.
Byte 1 - Manufacturer
Byte 1 is an 8 bit manufacturer code that indicates the entity that built the board. The values currently defined are:
Mfg Code Manufacturer
---------- ------------
0x44 ('D') Digicom
Byte 2 - Board Type
Byte 2 is an 8 bit board code that indicates the board type of the system. The interpretation of the board code depends on the manufacturer code (see Byte 1 above). The values currently defined are:
Mfg Code Board Code Board Type
---------- ---------- ----------
0x44 ('D') 0x00 ROACH1
0x44 ('D') 0x01 ROACH2
0x44 ('D') 0x02 SNAP
The ROACH1 and ROACH2 entries are for historical context only. Those boards do not support this specification.
Byte 3 - Board Revision
Byte 3 is the 8 bit board revision number that indicates the revision of the board design specified by bytes 1 and 2.
Because the number of board revisions is expected to be small, only a few low end bits of this byte are likely to be used. To preserve the upper bits for future possibilities, this byte should be stored as the two's complement negative of the board revision number.
Currently defined values are:
Mfg Code Board Code Revision Byte Value
---------- ---------- -------- -------------
0x44 ('D') 0x02 1 11111111 (-1)
0x44 ('D') 0x02 2 11111110 (-2)
Byte 4 - Production Run
Byte 4 is the 8 bit production run number (production batch code) for the manufacturer, board, and board revision specified in bytes 1, 2, 3.
Because the number of production runs is expected to be small, only a few low end bits of this byte are likely to be used. To preserve the upper bits for future possibilities, this byte should be stored as the two's complement negative of the production run number.
Byte 5 - Serial Number
Byte 5 is the board's serial number within the production run specified by bytes 1 through 4. Each production run can have a maximum of 99 serial numbers. If a single production run ever exceeds 99 boards, it will have to be treated as more than one production runs for serial number purposes.
Because the number of boards produced per production run is expected to be small, only a few low end bits of this byte are likely to be used. To preserve the upper bits for future possibilities, this byte should be stored as the two's complement negative of the board serial number within the production run.
OTP Memory Map
The current OTP memory map is shown here. All reserved bits are shown as 'R' and must remain in their un-programmed '1' state. Programmed data bits ('0' or '1') are shown as '+' if they are stored as a positive value or '-' if they are stored as a two's complement value.
Offset 0 : 11111111 : Version byte (version 0)
Offset 1 : ++++++++ : Version 0 - Manufacturer code
Offset 2 : -------- : Version 0 - Board code
Offset 3 : -------- : Version 0 - Board revision number
Offset 4 : -------- : Version 0 - Production run number
Offset 5 : -------- : Version 0 - Serial number within production run
Offset 6 : RRRRRRRR : Reserved for future use
... : RRRRRRRR : Reserved for future use
Offset 63 : RRRRRRRR : Reserved for future use
For SNAP boards produced by Digicom, the current OTP memory map looks like this:
Offset 0 : 11111111 : Version byte (version 0)
Offset 1 : 01000100 : Version 0 - Manufacturer code = 0x44 ('D')
Offset 2 : 11111110 : Version 0 - Board code = 2 (SNAP)
Offset 3 : -------- : Version 0 - Board revision number
Offset 4 : -------- : Version 0 - Production run number
Offset 5 : -------- : Version 0 - Serial number within production run
Offset 6 : RRRRRRRR : Reserved for future use
... : RRRRRRRR : Reserved for future use
Offset 63 : RRRRRRRR : Reserved for future use