Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

9.1 Introduction


The programmer has the ability to automatically program the target device's serial number (SN) and save it in flash memory. New SNs can be created automatically by incrementing a starting base SN, or can be taken from a file created by the user. SNs that have been used are stored in separate data files to account for devices that have already been programmed. In addition to this SN, the model name, group, and revision number can also be programmed to the target device. The user can specify the display SN format and location in flash memory where this information will be stored.
The SN is programmed when "Auto Program" or "Write SN/Model" buttons are pressed and the SN feature is enabled. When the "Auto Program" function is activated the SN is programmed to the target's device memory after code data has been programmed. If "Auto Program" fails for any reason then the new SN is neither created nor programmed to the device. In the case of Gang programming, as many SNs will be used up as there are successfully programmed devices. If there are not enough SNs left to program all devices in the Gang programmer then an error will appear, and the procedure will abort resulting in no devices being serialized.
The software also allows the microcontroller to retain its SN if one has already been assigned to it. Every time a device is programmed and serialization is enabled the contents of the target's memory are scanned for an existing SN. If the SN is found at the specified location the message in Figure 9.1 will appear and allow the user to decide to keep the old SN, program a new SN from the list, or program a SN typed manually.

...

Anchor
_Toc452148557
_Toc452148557
Figure 9.1: If an MCU already contains serialization information at a specified location then a conflict window will appear giving the user the option to retain the old serial number, or program in a new one.

The Serialization Dialog screen, shown in Figure 9.2, allows the user to configure how serialization is done. Serialization can be enabled, or disabled, by selecting the check mark in the ENABLE Serialization check-box. When serialization is disabled all edit lines and check boxes are disabled. When serialization is enabled, most fields have to be set to ensure that the result will be as the user expects. The necessary fields include:

...

Anchor
_Toc452148558
_Toc452148558
Figure 9.2: Serialization options can be selected here.

Anchor
_Toc452148497
_Toc452148497
9.2 Serial Number Display Format


Programming software has eight formats for writing a serial number, referred to as Display Format, and three methods of storing the SN in memory, referred to as In Memory Format in the serialization dialog screen. When a serial number is created, the current date (if required) is taken from the PC timer, therefore ensure that your computer has the correct date and time.
Display Formats:

...


For SN display formats 1 to 6 above (logfile format F0 through F5), the non-date components can be entered using either decimal or hexadecimal notation. Normally only characters from 0 to 9 will be accepted unless a "0x" prefix is added informing the software that a hexadecimal number is begin entered, allowing the user to use A to F as well. All characters are subsequently converted to a chosen memory format, which can be HEX, BCD or ASCII, before they are saved to flash memory.
When a "Custom" (F6) or “from File" (F7) SN display format is selected then all characters can be accepted depending on the memory format chosen. Specifically, when the ASCII format is selected the SN can be comprised of any characters and is saved using 8-bits per character into flash memory. Conversely, when the HEX format is selected the SN can only be comprised of HEX characters (0...9,A...F) and is saved using 4-bits per character.

Anchor
_Toc452148498
_Toc452148498
9.3 Serial Number Memory Format


This section describes the different formats in which serial numbers can be stored in flash memory. These numbers can be stored using various types of byte-ordering schemes including:

...

Anchor
_Toc452148559
_Toc452148559
Figure 9.3: This window will appear when there is a conflict between memory allocated to code and the SN. To avoid this pop-up, select the option to "Remove code contents in the location where the serialization and model are defined" in Figure 9.2.
The location in the target device's flash memory where the SN will be stored is specified in the \Memory Location - SN Start Address in Memory" field of the serialization dialog screen (see Figure 9.3). Specified address must be even and should be specified in empty memory space, not used by program code or data block. However, if you'd like to integrate the SN with existing code, by programming the SN to a code location, then check the box Remove code contents in the location where the serialization and model are defined .
The SN memory formats will be described in the following subsections.

Anchor
_Toc452148499
_Toc452148499
9.3.1 HEX Memory Format


When this format is selected the serial number is encoded using hexadecimal (HEX) notation. In general, each sub-component of the SN written in base 10 is converted to an equivalent base 16 number. The number of bytes used varies depending on the display format (F0, F1, F2, F4, and F5 - 4 bytes; F3 - 2 bytes; F6, and F7 - between 2 to 128 bytes).
Display Format: YYYY-12345 - size in FLASH - 4 bytes
Can be stored using MSW, and LSW/LSB byte-ordering.
SN: 200300123 will be encoded as:
YYYY: 2003 = 0x07D3 (HEX)
12345: 00123 = 0x007B (HEX)
and combined into one 32-bit HEX number: 0x07D3007B
<-- Addr-->
00-01-02-03
D3 07 7B 00 -> HEX(MSW first)
7B 00 D3 07 -> HEX(LSW/LSB first)
Display Format: YYMM-12345 - size in FLASH - 4 bytes
Can be stored using MSW, and LSW/LSB byte-ordering.
SN: 030300123 will be encoded as:
YYMM: 0303 = 0x012F (HEX)
12345: 00123 = 0x007B (HEX)
and combined into one 32-bit HEX number: 0x012F007B
<-- Addr-->
00-01-02-03
2F 01 7B 00 -> HEX(MSW first)
7B 00 2F 01 -> HEX(LSW/LSB first)
Display Format: YYMMDD-1234 - size in FLASH - 4 bytes
Can be stored using MSW, and LSW/LSB byte-ordering.
The date component is compressed to fit into only two bytes as
follows:

...

SN: 041110123 will be encoded as:
YYDDD: 04111 = 0x086F (HEX)
1234: 0123 = 0x007B (HEX)
and combined into one 32-bit HEX number: 0x086F007B
<-- Addr-->
00-01-02-03
6F 08 7B 00 -> HEX(MSW first)
7B 00 6F 08 -> HEX(LSW/LSB first)
Display Format: 12345678 - size in FLASH - 4 bytes
Can be stored using MSB, MSW, and LSW/LSB byte-ordering.
SN: 12345678 will be encoded as:
12345678 = 0x00BC614E (HEX)
<-- Addr-->
00-01-02-03
00 BC 61 4E -> HEX(MSB first)
BC 00 4E 61 -> HEX(MSW first)
4E 61 BC 00 -> HEX(LSB/LSW first)
Display Format: 12345 - size in FLASH - 2 bytes
Can be stored using MSB, MSW, and LSW/LSB byte-ordering.
SN: 12345 will be encoded as:
12345 = 0x3039 (HEX)
<Addr>
00-01
30 39 -> HEX(MSB first)
39 30 -> HEX(MSW first)
39 30 -> HEX(LSB/LSw first)
Display Format: Custom - size in FLASH - between 2 to 128 bytes
Can be stored using MSB, and LSW/LSB byte-ordering. A SN entered using the "Custom" format is entered as a series of either an even number of HEX digits or any number of ASCII characters. This subsection deals only with storing the SN entered as a series of an even number of HEX digits, where two adjacent HEX digits comprise one byte (two digits are adjacent if they have the index j and k, where j=2*i and k=2*i+1, for all i where 0<i<N, where N_ {2:128}). The SN can be composed of anywhere between 4 and 256 characters.
SN sequence entered as ``0x12345678AABBCCDD'' will be stored as:
<--------Addr------->
00-01-02-03-04-05-06-07

12 34 56 78 AA BB CC DD -> HEX(MSB first)
DD CC BB AA 78 56 34 12 -> HEX(LSB/LSW first)
Display Format: from File - size in FLASH - between 2 to 128 bytes
Can be stored using MSB, and LSB/LSW byte-ordering. A SN entered using the "from File" format is read from the SN input file and can be a series of either an even number of HEX digits or any number of ASCII characters. Section 9.9 describes how to write a SN input file. This subsection deals only with storing the SN entered as a series of an even number of HEX digits, where two adjacent HEX digits comprise one byte (two digits are adjacent if they have the index j and k, where j=2*i and k=2*i+1, for all i where 0<i<N, where N_ {2:128}). The SN can be composed of anywhere between 4 and 256 characters.
SN sequence entered as ``0x12345678AABBCCDD'' will be stored as:
<---------Addr------>
00-01-02-03-04-05-06-07
12 34 56 78 AA BB CC DD -> HEX(MSB first)
DD CC BB AA 78 56 34 12 -> HEX(LSB/LSW first)

Anchor
_Toc452148500
_Toc452148500
9.3.2 BCD Memory Format


When this format is selected the serial number is encoded using binary-coded decimal (BCD) notation. In general, each digit of the SN written in base 10 is separately expressed using 4 bits such that the resulting HEX number reads like a decimal. This is in contrast to HEX notation where the value of the entire number is converted to base 16. The number of bytes used varies depending on the display format (F0, F1, F2, and F4 - 4 bytes; F5 - 5 bytes; F3 - 2; F6, and F7 - N/A). All BCD serial numbers are stored using MSB first byte-ordering scheme.
Display Format: YYYY-1234 - size in FLASH - 4 bytes
SN: 20030123 will be encoded as:
YYYY: 2003 = 0x20 0x03 (BCD)
1234: 0123 = 0x01 0x23 (BCD)
and combined into one 32-bit BCD number: 0x20030123
<-- Addr-->
00-01-02-03
20 03 01 23 -> BCD(MSB first)
Display Format: YYMM-1234 - size in FLASH - 4 bytes
SN: 21090123 will be encoded as:
YYMM: 2109 = 0x21 0x09 (BCD)
1234: 0123 = 0x01 0x23 (BCD)
and combined into one 32-bit BCD number: 0x21090123
<-- Addr-->
00-01-02-03
21 09 01 23 -> BCD(MSB first)
Display Format: YYMMDD-1234 - size in FLASH - 5 bytes
SN: 2109290123 will be encoded as:
YYMMDD: 210929 = 0x21 0x09 0x29 (BCD)
1234: 0123 = 0x01 0x23 (BCD)
and combined into one 32-bit BCD number: 0x2109290123
<---- Addr---->
00-01-02-03-04
21 09 29 01 23 -> BCD(MSB first)
Display Format: YYDDD-1234 - size in FLASH - 4 bytes
The date component is compressed to fit into only two bytes as
follows:

...

SN: 212730123 will be encoded as:
YYDDD: 21273 = 0x86 0x73 (BCD)
1234: 0123 = 0x01 0x23 (BCD)
and combined into one 32-bit BCD number: 0x86730123
<-- Addr-->
00-01-02-03
86 73 01 23 -> BCD(MSB first)
Display Format: 12345678 - size in FLASH - 4 bytes
SN: 12345678 will be encoded as:
12345678 = 0x12 0x34 0x56 0x78 (BCD)
and combined into one 32-bit BCD number: 0x12345678
<-- Addr-->
00-01-02-03
12 34 56 78 -> BCD(MSB first)
Display Format: 1234 - size in FLASH - 2 bytes
SN: 1234 will be encoded as:
1234 = 0x12 0x34 (BCD)
and combined into one 16-bit BCD number: 0x1234
<Addr>
00-01
12 34 -> BCD(MSB first)
Display Format: Custom - N/A
Display Format: from File - N/A

Anchor
_Toc452148501
_Toc452148501
9.3.3 ASCII Memory Format


When this format is selected the serial number is encoded using American Standard Code for Information Interchange (ASCII) notation. In general, each character of the SN is assumed to be an ASCII character and converted to its byte-code representative using the standard ASCII table (each character of the SN will occupy 1 byte). The number of bytes used is directly proportional to the number of characters used in the display format (F0, F1, and F2 - 8 bytes; F3 - 4 bytes; F4 - 9 bytes; F5 - 10 bytes; F6, and F7 - between 4 to 256 bytes). All ASCII serial numbers are stored one byte at a time, where the first ASCII character occupies the lowest byte address (first address).
Display Format: YYYY-1234 - size in FLASH - 8 bytes
SN: 20030123 will be encoded as:
YYYY: 2003 = 0x32 0x30 0x30 0x33 (ASCII)
1234: 0123 = 0x30 0x31 0x32 0x33 (ASCII)
<-----------Addr--------->
00-01-02-03-04-05-06-07
32 30 30 33 30 31 32 33 -> ASCII
Display Format: YYMM-1234 - size in FLASH - 8 bytes
SN: 03030123 will be encoded as:
YYMM: 0303 = 0x30 0x33 0x30 0x33 (ASCII)
1234: 0123 = 0x30 0x31 0x32 0x33 (ASCII)
<-----------Addr--------->
00-01-02-03-04-05-06-07
30 33 30 33 30 31 32 33 -> ASCII
Display Format: YYMMDD-1234 - size in FLASH - 10 bytes
SN: 0405110123 will be encoded as:
YYMMDD: 040511 = 0x30 0x34 0x30 0x35 0x31 0x31 (ASCII)
1234: 0123 = 0x30 0x31 0x32 0x33 (ASCII)
<--------------Addr------------->
00-01-02-03-04-05-06-07-08-09
30 34 30 35 31 31 30 31 32 33 -> ASCII
Display Format: YYDDD-1234 - size in FLASH - 9 bytes
SN: 042140123 will be encoded as:
YYDDD: 04214 = 0x30 0x34 0x32 0x31 0x34 (ASCII)
1234: 0123 = 0x30 0x31 0x32 0x33 (ASCII)
<-------------Addr----------->
00-01-02-03-04-05-06-07-08
30 34 32 31 34 30 31 32 33 -> ASCII
Display Format: 12345678 - size in FLASH - 8 bytes
SN: 12345678 will be encoded as:
12345678 = 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 (ASCII)
<-----------Addr--------->
00-01-02-03-04-05-06-07
31 32 33 34 35 36 37 38 -> ASCII
Display Format: 1234 - size in FLASH - 4 bytes
SN: 1234 will be encoded as:
1234 -> 0x31 0x32 0x33 0x34 (ASCII)
<---Addr-->
00-01-02-03
31 32 33 34 -> ASCII
Display Format: Custom - size in FLASH - between 4 to 256 bytes
A SN entered using the “Custom" format is entered as a series of either an even number of HEX digits or any number of ASCII characters. This subsection deals only with storing the SN entered as a series of ASCII characters. The SN can be composed of anywhere between 4 and 256 characters.
SN sequence entered as ``02WX24S234'' will be encoded as:
0x30 0x32 0x57 0x58 0x32 0x34 0x53 0x32 0x33 0x34
<---------------Addr------------->
00-01-02-03-04-05-06-07-08-09
30 32 57 58 32 34 53 32 33 34 -> ASCII
Display Format: from File - size in FLASH - between 4 to 256 bytes
A SN entered using the “from File" format is read from the SN input file and can be a series of either an even number of HEX digits or any number of ASCII characters. Section 9.9 describes how to write a SN input file. This subsection deals only with storing the SN entered as a series of ASCII characters. The SN can be composed of anywhere between 4 and 256 characters.

SN sequence entered as ``02WX24S234'' will be encoded as:
0x30 0x32 0x57 0x58 0x32 0x34 0x53 0x32 0x33 0x34
<---------------Addr------------->
00-01-02-03-04-05-06-07-08-09
30 32 57 58 32 34 53 32 33 34 -> ASCII

Anchor
_Toc452148502
_Toc452148502
9.4 Serial Number Output File


The Serial Number Output File field specifies the file where serialization information will be saved after successful programming. The SN file contains the following data separated by tabs:

...


Below is an example of a SN file containing information on three consecutively created serial numbers.
F0 200300011 m ( Sat, Mar 29,2003, 10:09 ) AS010X02-1v2.txt -01 R.0003-04-17
F0 200300012 . ( Sat, Mar 29,2003, 10:43 ) AS010X02-1v2.txt -01 R.0003-04-17
F0 200300013 u ( Sat, Mar 29,2003, 10:43 ) AS010X02-1v2.txt -01 R.0003-04-17
SNs can be saved as a unique SN per target device type, or saved as a unique SN across all devices type. When a unique SN per target device type is saved then a separate SN file should be used for each device type. If a unique SN across all device types is saved, then only one SN file name should be used.

Anchor
_Toc452148503
_Toc452148503
9.5 Model, Group, Revision


The software also allows the user to program each device with separate HEX or ASCII data. This information is saved at a different memory location from the SN, and does not change after each programming cycle. This is used to program static information that should be the same for each target device, like the software revision number, model, etc. This extra data can be composed of anywhere between 2 to 32 characters. This feature is enabled when the ENABLE check-box in the Model/Group/Revision group is selected (see Figure 9.2). When enabled, specify the number of bytes to be reserved for the desired text or data. Also, specify the memory address where this information will be stored on the target device (must be even address). Finally, enter the text or data to be saved and the format it should be stored in.

Anchor
_Toc452148504
_Toc452148504
9.6 BarCode Scanner Setup


The BarCode Scanner can be used as an input mechanism for new SNs. When enabled, scanning a barcode will set the Next SN to the value read by the BarCode Scanner. For convenience, the software can be configured to start the Auto Program procedure immediately after the BarCode Scanner reads a new number, by selecting the Start AUTOPROGRAM following BarCode scan check-box. The BarCode Scanner should be connected to the programming PC computer in series with the keyboard using the Y cable or to the USB port. Refer to your BarCode Scanner manual for setup details.
BarCode Scanner is enabled when the ENABLE check-box in the BarCode Scanner group is selected. Depending on the output from the scanner choose the right terminating character, although commonly the default CR (ENTER) character is used. Finally, change the Display Format to "Custom" and select the proper Memory Format as either HEX or ASCII.

Note: Only ASCII characters from 0x21 to 0xFE are accepted from the BarCode Scanner. Others characters like white characters (space, tab) are ignored. All characters are converted to lower case characters.

Anchor
_Toc452148505
_Toc452148505
9.7 Device Serialization box


The Device Serialization box, located on the main programming dialog screen and shown in Figure 9.4, contains SN and model information. The first two read-only lines contain information taken from the target device during the read process. The first line shows the Model/Group/Revision text and the second line shows the SN. The following two lines contain the SN and model information that will be programmed next generated automatically according to the Serialization setup.
The current target's SN and model information can be read at any time by pressing the "READ / COPY" button located in the Main GUI

...

Anchor
_Toc452148560
_Toc452148560
Figure 9.4: Seen in the Main GUI, this serialization status box will display the current device's serial number and the next serial number to be programmed.

Anchor
_Toc452148506
_Toc452148506
9.8 Serialization Report Dialog Screen


The Serialization Report Dialog Screen shows the results of the serialization procedure. The report contains detailed information on two SNs, specifically the highest SN and the one selected. The report also shows all programmed units along with their SN, and unmodified or overwritten SNs coming from reprogrammed units (New SN[.], unmodified SN[u], overwritten SN[o], manual SN[m]). Detailed information about all programmed units can be viewed using the Notepad text editor by pressing the Notepad button. A summary of created serial numbers is displayed in the white report box (see Figure 9.5). A SN entry can be removed from the database by pressing the Delete SN button (the delete operation is not reversible).

Anchor
_Toc452148561
_Toc452148561
Figure 9.5: Serialization report gives a summary of all the serial numbers programmed using the selected file.

Anchor
_Toc452148507
_Toc452148507
9.9 Serial Number Input File


The programmer can input serial numbers from user created data files. When the data file is used, change the Display Format to "from File" and select the proper Memory Format as either HEX or ASCII.
The SN data file should contain a proper header followed by a list of SNs specified using the following commands (a command is preceded by the # character). Any data entered after a semicolon (;) will be ignored and can be used for commenting. Use the following list of commands:

...

Anchor
_Toc452148562
_Toc452148562
Figure 9.6: Serial numbers read from a file.

9.10 Example Output

The screenshot below shows the example output of using the SN input file from Section 9.9.

...

The output above can be generated using the following setup shown in Figure 9.8 In this case the SN will be written to address 0x08001000; however this destination address can be changed at any time without modifying the SN input file or other settings.

...