Flasher Hub - Serial number programming

From SEGGER Wiki
Revision as of 16:06, 6 May 2024 by Leon (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A Flasher Hub based system supports programming of serial numbers. In order to use the serial number programming feature, the project to be used as well as some files on the Flasher Compacts connected to the Flasher Hub (depending on the configuration) need to be configured first.

In general, a Flasher Hub based system supports two ways of programming a serial number into the target:

    • Programming continuous serial numbers.
    • The serial number is 1-4 bytes in size.
    • The start serial number, increment, serial number size, and address are configured in the J-Flash project.
    • Programming custom serial numbers from a serial number list file.
    • The start line within the serial number list file to get the next serial number bytes, line increment, serial number size, and address is configured in the J-Flash project.
    • The serial number list file needs to be specified and created by the user.


Settings

In order to enable the programming of serial numbers in stand-alone mode, the J-Flash project has to be configured to enable programming a serial number at a specific address. This is done by enabling the Program serial number option as shown in the screenshot and table below:

UM08039 SN Sample JFlashSettings.png

Setting Meaning
Address The address the serial number should be programmed at.
Length

The length of the serial number (in bytes) that should be programmed.

  • If no serial number list file is given, J-Flash allows to use a 1-4 byte serial number. In case 8 is selected as length, the serial number and its complement are programmed at the given address.
  • In case a serial number list file is given, the Flasher Hub will take the serial number bytes from the list file. If a serial number in the list file does not define all bytes of Length, the remaining bytes are filled with 0s. No complements etc. are added to the serial number.
Next SN
  • In case no serial number list file is given, Next SN is the next serial number which should be programmed. The serial number is always stored in flash memory in little-endian format.
  • In case a serial number list file is given, Next SN describes the line of the serial number list file where to read the next serial number bytes from. The Flasher Hub starts counting at line 0, so in order to start serial number programming with the first line of the SNList.txt, Next SN needs to be set to 0.
Increment Specifies by how much Next SN is incremented.

Serial number file

When selecting File -> Download serial number file to Flasher, J-Flash will create a serial number file named as <JFlashProjectName>_Serial.txt. This file is downloaded as Serial.txt on the selected Flasher Compacts connected to the Flasher Hub. The file is generated based on the serial number settings in the J-Flash project and will contain the value defined by the Next SN option. The serial number file can also be manually edited by the user since the serial number is written ASCII encoded in the Serial.txt file.

Continuous serial numbers

Projects for the Flasher Hub can be configured to use the serial number feature (see Settings). The serial number is stored in the Serial.txt file on each Flasher Compact module. Therefore, the serial number is also power-cycle safe. If the file is missing at start up time, a Serial.txt with serial number 0 will be created. The connected Flasher Compacts will use the current serial number found in Serial.txt for the programmed device. Then the increment is added to the serial number and the result is stored in the Serial.txt which is used for the next programming sequence.

To avoid duplication of serial numbers with the Flasher Hub using more than one Flasher Compact module, there are two options:

  • Use an increment of the number of connected Flasher Compact modules; e.g. if you have 5 Flasher Compacts connected, use an increment of 5 as well as 5 different Serial.txt files at the beginning of production.
  • Use different serial number areas; e.g. if you have 5 Flasher Compacts connected, use an increment of 1 as well as 5 different Serial.txt files at the beginning of production. For the first module, use the range from 1 to 1000, for the second 1001 to 2000, and so on.

The Serial.txt file contains the value Next SN in ASCII notation, e.g. 1234 if the next serial number is 1234.

Note:
The serial number in Serial.txt will also be incremented if serial number programming is disabled, to make sure that for the Flasher Hub log file there is a reference for which programming cycle passed and which did not. As long as serial number programming has not been enabled in the J-Flash project, the Flasher Hub does not merge any serial number data into the image data to be programmed.

Serial number list file

In order to program custom serial numbers which cannot be covered by the standard serial number scheme provided by J-Flash (e.g. when programming non-continuous serial numbers or having gaps between the serial numbers), a so called serial number list file needs to be created by the user.

When selecting File -> Download serial number file to Flasher, J-Flash will look for a serial number list file named as <JFlashProjectName>_SNList.txt in the directory where the J-Flash project is located. This file is downloaded as SNList.txt on the selected Flasher Compacts connected to the Flasher Hub. The serial number list file needs to be created manually by the user and has the following syntax:

  • One serial number per line
  • Each byte of the serial number is described by two hexadecimal digits.

Example
An 8-byte serial number should be programmed at address 0x08000000.

It should be programmed as follows in the memory:

0x08000000: 0x01 0x02 0x03 0x04 0x55 0x66 0x77 0x88

The associated serial number list in the file should look as follows:

UM08039 SN SNList.png

The number of bytes to read per line is configured via the Len option in J-Flash. For more information, please refer to Settings.

Which line Flasher will read at the next programming cycle is configured via the Next SN option in J-Flash. For more information, please refer to Settings. In this case, Next SN needs to be set to 0, since programming should start with the serial number bytes defined in the first line of the file.

Note:
If the number of bytes specified in a line of the serial number list file is less than the serial number length defined in the J-Flash project, the remaining bytes are filled with 0s by the Flasher Hub.
Note:
If the number of bytes specified in a line of the serial number list file is greater than the serial number length defined in the J-Flash project, the remaining bytes will be ignored by the Flasher Hub.

Programming process

The Flasher Compact modules connected to the Flasher Hub will increment the serial number in Serial.txt by the value defined in Increment after each successful programming cycle.

For each programming cycle, the Flasher.log file on the connected Flasher Compact modules is updated and contains the value from Serial.txt that has been used for the programming cycle.

Note:
The serial number in Serial.txt will also be incremented if serial number programming is disabled, to make sure that for the Flasher Compact logfile there is a reference for which programming cycle passed and which did not. As long as serial number programming has not been enabled in the J-Flash project, the Flasher Compacts do not merge any serial number data into the image data to be programmed.

Example setup

Below, a small example is given on how to set up the Flasher Compacts for serial number programming. In the following example, 4-byte serial numbers starting at 1234567 (0x12D687) shall be programmed at address 0x08001000.

Defining serial number address, length and start value
In the J-Flash project, the following needs to be defined:

  • Address is 0x08001000
  • Next SN is 1234567
  • Increment is 1
  • Len is 4 (bytes)

UM08039 SN Sample JFlashSettings.png

Downloading configuration, data, and serial number to the Flasher Compacts
After setting up the rest of the configuration (Target interface etc.) and selecting an appropriate data file, the configuration, data, and serial number file needs to be transferred to the associated Flasher Compact via the Flasher Hub, either using J-Flash, or using an FTP client, or using the file browser in the Flasher Hub's web interface.