PEmicro Blog

Cyclone FX: Using A Barcode Scanner to Select & Launch Programming Images

Automatic selection and launch of a specific flash programming image based on a scanned barcode can improve the speed and accuracy of production programming, especially when there is a varied product mix being programmed. Barcode scanning improves accuracy by making the process of selecting a programming image fast, automatic, and less vulnerable to user error. PEmicro's Cyclone FX programmers have the ability to use a barcode scanner, connected via the Cyclone's host USB port, to initiate programming. When a barcode is scanned, the Cyclone selects a specific programming image based on the barcode and programs the target board accordingly.

The barcode itself can optionally be programmed into the target device’s memory as part of this manufacturing process. The information that the barcode makes available to the device can make it easier to trace products, track product hardware versions, or provide a way to serialize production. This results in a more efficient manufacturing process.

1. How Does It Work?

After the Cyclone FX is configured (see section 3, "Using A Barcode Scanner," below), the barcode scanner is connected to the Cyclone's host USB port. The scanner is used in Wedge output mode, which emulates a USB keyboard. When the scanner scans a barcode, it transmits the barcode to the Cyclone. The Cyclone then analyzes the barcode and uses it to select a programming image.

To perform this analysis, all programming images on the Cyclone, in both internal and external memory, are reviewed. Each image may contain a set of rules to determine whether a scanned barcode corresponds to that particular image. This set of barcode analysis rules is referred to as an image's “barcode test." If the barcode passes the test on one and only one of the programming images on the Cyclone, that image is automatically selected and programming is initiated. Otherwise, if the scanned barcode does not pass the barcode test on any image, or if it passes the test on more than one image, an error will occur.

Barcode test rules include: barcode length, character type, specific characters, and numerical ranges. Fixed barcodes or barcodes which are unique to an individual product can be properly analyzed and used to select the appropriate programming image.

A logfile is generated to help the user understand how a scanned barcode auto-selects a specific image on the Cyclone (or yields an error).

Figure 1: CYCLONE FX With Barcode Scanner
CYCLONE FX With Barcode Scanner

2. How Is Barcode Scanning Beneficial? What Are Some Examples?

The use of a barcode scanner as part of the manufacturing process can boost productivity and reduce human error. When the user scans a barcode to select and launch the programming sequence, it frees that user from having to know any details about the product being programmed; point, shoot, and it programs. Programming multiple products with different data can be as simple as connecting each new target board and scanning a barcode that is printed on it.

A manufacturer might, for example, design their products such that every product has a unique barcode printed on it. Part of these barcodes might be a fixed string, and part of them might be changing (for example :WIDGET1-A00143, WIDGET1-A04325, WIDGET1-B03222). In this scenario, the barcode test for the WIDGET1 programming image could check that the barcode starts with the fixed string “WIDGET1-” (product identifier), the next character is an A or B (product version), and that the rest of the barcode is numeric (unique ID). If it passes, the WIDGET1 image would be selected and the target programmed.

This same manufacturer might also set up the programming process for each product to program the barcode itself at a specific point in memory. There are then many ways a device could leverage its barcode number. For example, the running application in the device could check the product version of the barcode to understand whether it is running on hardware revision A or B and make decisions based upon that information. The Unique ID could also be used for this purpose. E.g., if the number is less than 5000, then use high drive strength on the product's port X; otherwise use low drive strength on the product's port X. When connected later to the cloud, it can report its unique identifier back to its home base. Potentially it could use the barcode's Unique ID as part of setting up its MAC address for Ethernet.

Figure 2: Bar Code Scanner On Production Line
Bar Code Scanner On Production Line

In a completely different programming scenario the manufacturer might not want to place barcodes on the products themselves. E.g., it could be that they do not frequently switch from one product to another on the production line. In this case, they might prefer to create a separate set of directions for each product they manufacture which covers programming, test, and casing of the product. They could then include a fixed barcode as part of the programming instructions. The instructions might state that, before starting a production run of this product the barcode should be scanned by the Cyclone programmer. This removes the manual step of the operator choosing which image to use for each product. The Cyclone selects the image automatically by using the barcode in the instructions (and if there is not a unique match, an error is reported). This can help to reduce user error, particularly if the programming images on the Cyclone carry similar names.

3. Using A Barcode Scanner

To use the barcode scanner with a Cyclone FX, the scanner must first be enabled in the Cyclone menu by navigating to “Configure Cyclone” and then “Configure USB Host Device.” The user should click on “Enable USB Scanner”. The barcode scanner's instructions should be consulted to understand how to put the scanner into Wedge (keyboard emulation) mode, and to make sure that it terminates the barcode with a CR (carriage return) character. The scanner can then be plugged into the USB host mini connector on the side of the Cyclone. A USB-to-USB-Mini adapter may be necessary if the scanner uses a full size USB connector. When plugged into the Cyclone, the scanner will power up and the Scanner Active icon on the Cyclone LCD screen will illuminate.

Barcode Scanner Active icon:

4. Creating A Barcode Test

Whenever a programming image is created the user has the option to add a barcode test to the image. PEmicro provides a Barcode Test Generator utility to enable the user to creating these tests. The following steps demonstrate how to create a sample barcode test.

To begin, the user should launch the Barcode Test Generator utility. The user should then write a prototype of the expected barcode in the “Sample(ascii)” section. In this example, the prototype barcode is “P&E MICRO-TEST1-0000”. See Figure 3. Please note that this example only demonstrates one simple approach to creating a barcode; there are many methods available.

Figure 3: Create Prototype Barcode
Create Prototype Barcode

In this example, the “P&E MICRO” portion of the prototype barcode exists in every bar code the company produces - in this case, header characters that identify the company. Also for this example, a product identifier “TEST1” is in the bar code. Following the identifier, this product also has a 4-digit serial number. This completes the prototype bar code which is representative of this products barcodes.

The next step is to use this prototype barcode to create barcode tests which will be run against scanned barcodes. In this example, the first test should check the header (i.e. "P&E MICRO") at the beginning of the bar code. To enable this, the user should click the small down arrows corresponding to the header section of the barcode. This creates a character test for “P&E MICRO". This string will need to match exactly for the barcode test to pass. The "FC" designation on each character stands for "Fixed Character" with the actual value shown below it. See Figure 4.

Figure 4: Create Char Test For "P&E MICRO"
Create Char Test For Fixed Characters

The next test will check whether the scanned barcode matches the product identifier “TEST1” exactly. The user should click the small down arrows for the "TEST1" characters to bring them into the Char test section. See Figure 5.

Figure 5: Create Char Test For "TEST1"
Create Char Test For Numeric Character

The "1" in “TEST1” is by default treated as a "Numerical Character" for testing reasons ('NC'). This means it is required to have a value of '0'..'9'. To restrict the value of this character, it could either be change to a fixed character test or we can restrict the range of acceptable values. To do the latter, click on the down arrow below the character test and bring the "1" character into the Range-1 test area. Both the lower and upper bounds for this character can then be changed to “1” so that the match must be exactly the number 1. Refer to Figure 6.

The final step is to create a test for the 4-digit serial number part of the prototype. In this example only 501 units of this product will be manufactured which correspond to a specific programming image, each with a unique serial number from 0000 to 0500. The test should make sure that this limit is not exceeded. Therefore, the user should add “0000” to the Char Test by clicking on the small down arrows for the characters. This should then be converted this into a Range test by clicking on the new arrows to add these four characters to the Range-1 test area.

Figure 6: Create Range-1 Test
Create Range-1 Test

The default for the range test is 0000 to 9999, so after these numerals enter the Range-1 test area, the user should change the upper bound from 9999 to 0500. Any continuous numerical digits are considered to be one numerical value for the purpose of range comparison.

The result in the Barcode Test Generator utility should look like Figure 7:

Figure 7: Completed Barcode Test
Completed Barcode Test

This completes setup of the barcode test. The user should now click on “Save File As” on top and name the test “”. This test is now ready to be added to a programming image using the Cyclone Image Creation utility.

5. Adding A Barcode Test Into A Programming Image

Adding the barcode test into an image is done as part of the image creation process. The user should open the Cyclone Image Creation utility and follow the steps to create a programming image. The device should be selected, along with the algorithm, object file, and programming commands. This examples uses the commands EM, PM, VM.

The next step is to add the barcode file. In the “FX Special Features” section at the bottom of the utility, the user should check the “Use Barcode File” checkbox and browse for the appropriate created .bar file. See Figure 8.

Figure 8: FX Special Features (Add Barcode File To Image)
FX Special Features

After the programming image is stored in the Cyclone FX, it is ready to use. When a barcode is scanned the Cyclone will encounter this programming image, which will prompt it to test for the exact string “P&E MICRO-TEST1” and for the decimal numbers 0 to 500 on the last four characters of the barcode. If the barcode passes this test (and no other programming images on the Cyclone also pass) the image is executed.

6. Conclusion

Use of a barcode scanner during production programming can help manufacturers eliminate manual operator error. Configured barcode tests can also reduce the steps necessary for an operator to select and launch a programming session. PEmicro's Cyclone FX programmers, when configured with a bar code scanner, contribute toward a more efficient manufacturing process that can save critical production time.

For more information on using a bar code scanner with Cyclone FX programmers, please view the Cyclone FX User Manual.

Tags related to this Blog Post

Cyclone FX     Production Programming