NSZ FilesDownload Source Code SDK
NSZ files are used for serial programming. An NSZ file is a collection of records. Each record is unique (serial number, unique Id, encryption key or other unique information). When the NSZ file is used for programming, a record is extracted from the NSZ file and programmed to a device. Each device is programmed with its own record. This makes each programmed device unique.
Each record occupies a continuous span of memory up to 127 bytes long. Any programmable memory area can be used. The address where the record is located is stored within the NSZ file and is the same for all records. Each record has the same length. There is no restriction on the contents of the records.
NSZ files may be used by nsprog or NSDS Gang Programmer. The same NSZ file can be accessed simultaneously by different programing tools or by different instances of the same tool. Before programming a chip, the programming tool extracts a single record and merges it with the information received from the HEX file, then uses it to perform programming and verification. If an error occurs, the programming tool returns the record back to the NSZ file. In case of catastrophic failure, such as power loss in the middle of the programming, a record may be lost.
Simple NSZ files can be generated by NSDS Gang Programmer, but if you want more complicated information, you can create your own NSZ files according to the NSZ file format specifications.
NSZ File Format
NSZ files are binary files. NSZ file consists of the NSZ header, which is located at the beginning of the file, followed by a number of records. All multi-byte numbers inside the header are in little-endian format - the least significant byte first. The header has the following format:
|0||2||Signature - 0x5a4e - ASCII letters N and Z.|
|2||1||Length of the record. 1 to 255 bytes. Cannot be 0. The length is in the same units as in HEX file. The length must represent the whole number of instruction. In PIC10/12/16/18, one instruction occupies 2 bytes, in PIC24/30/33/32, one instruction occupies 4 bytes.|
|3||1||Offset of the first record from the beginning of the file in bytes.|
|4||4||Address where a record needs to be programmed on a device. It is the same as in HEX file. For PIC18/32, it is the same as physical memory address. For PIC10/12/16/24/30/33, it is the physical memory address multiplied by 2.|
Storage specifier. Used by programming tools to correctly show the record to the operator.
Bits 0-3 represent architecture.
Bits 4-7 represent storage.
Presentation specifier. Used by programming tools to correctly show the record to the operator.
Bits 0-3 represent the format.
Bit 4 is only used when BCD or decimal format is specified. This bit must be set to 1 for big-endian numbers, or to 0 for little-endian mumbers. This bit does not affect data in ASCII or binary format, for which the symbols stored at the lower addresses are always displayed on the left side.
Bits 5-7 are reserved for internal use. Set to 0.
|10||2||Reserved. Set to 0|
Records follow the header. The first recod is located at the offset specified by the header. Records are all the same length. Programming tools determine the size of the file and retrieve records from the end of the file. If the record needs to be returned, it is appended to the end of the file. Therefore, it is very important that the file contains the whole number of records and there's nothing extra past the last record.
You can download an example C source code which can be used as a template for your custom NSZ generation program.
© 2007-2021 Northern Software Inc. All Rights Reserved.