Buy(Cart) Contact NSDSP Home

NSZ Files

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:

OffsetLength Description
02 Signature - 0x5a4e - ASCII letters N and Z.
21 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.
31 Offset of the first record from the beginning of the file in bytes.
44 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.
81

Storage specifier. Used by programming tools to correctly show the record to the operator.

Bits 0-3 represent architecture.

  • 0 - unknown
  • 1 - PIC10/12/16 with 14-bit core
  • 2 - PIC18
  • 3 - PIC24/30/33
  • 4 - PIC32
  • 5 - PIC10/12/16 with 12-bit core
  • 6-15 - reserved

Bits 4-7 represent storage.

  • 0 - unknown
  • 1 - retlw instruction
  • 2 - PSV (2 bytes per instruction)
  • 3 - packed (all instruction bytes used)
  • 4-15 - reserved
91

Presentation specifier. Used by programming tools to correctly show the record to the operator.

Bits 0-3 represent the format.

  • 0 - unknown
  • 1 - binary
  • 2 - BCD
  • 3 - ASCII
  • 4 - decimal
  • 5-15 - reserved

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.

102 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.

Northern Software Home NSDSP Contact Us Purchase/Vew Cart

© 2007-2023 Northern Software Inc. All Rights Reserved.