Tips, Tools and Applications for the Electronic Industry in Europe

Posted on 2018/03/05 by Johan

Gang Programming with Cyclone Programmmers

A volume production solution often relies on simultaneous gang programming of different target boards to meet speed and throughput requirements. This programming scenario may integrate Cyclone programmers into a fixture which interfaces to a panel of boards to be programmed. Programming is commonly controlled and monitored from a local computer, especially when customized dynamic data is being added to the main binary image that is being programmed into each target.

PEmicro’s gang programming solution is to control many Cyclone programmers simultaneously via the Cyclone Control Suite. A mix of programming images, targets, and data can be simultaneously programmed into many devices while maintaining a high level of performance because each Cyclone is itself an independently operating programmer.  

The Cyclone Control Suite offers multiple means of controlling gang programming operations. The Cyclone Control Console is a scriptable command-line utility which makes gang programming extremely easy to set up and run. The Cyclone Control SDK is based around a dynamically linked library (DLL or SO) and allows detailed gang programming control from many tools, languages, and environments on the host PC. 

cyclone_fx_gang_programming.png

1. Gang Programming using the Cyclone Control Console 

The quickest way to accomplish gang programming is by using the Cyclone Control Console. The Cyclone Control Console is a powerful command-line application that allows simultaneous control of one or more Cyclones. Programming images can be added/removed, settings read/set, programming operations launched, and dynamic data programmed. The command-line application displays comprehensive status messages and also returns a result code indicating success or failure. The application can be launched from a script, a console, or another application

Connecting to multiple Cyclones

Opening multiple Cyclones with the Console is simple. Either pass a comma-delimited list of Cyclone names to the -cyclone= parameter (such as -cyclone=agnes,colossus,hal9000) or use multiple -cyclone parameters (such as -cyclone=agnes -cyclone=colossus -cyclone=hal9000). The other operations on the command-line will be executed on all open Cyclones, including programming launch, with the exception of dynamic data programming (where the Cyclone to which to apply the dynamic data is specified as part of the parameter). Here is an example of listing images on two Cyclones:

gang_programming_2.png

Launching main image programming on multiple cyclones

The same image can be launched on multiple Cyclones simultaneously simply by specifying multiple Cyclones on the command-line. If different image sets exist on each Cyclone, using condensed image descriptions is a good way to guarantee the appropriate programming image is launched. If the image set on each Cyclone is the same, the image number will match, and as such the image number is another way to launch the same image on multiple Cyclones. The following example launches the "Green Image v1.0" programming image on three different Cyclones simultaneously. The Cyclones are referenced by name (Agnes, Colossus, HAL9000) and the image is referenced by the condensed image description "GreenImagev1.0").

gang_programming_3.png

Providing additional dynamic data for each individual target being programmed

In addition to programming the data that's included as part of a programming image, additional data can also be programmed into each target device. This "dynamic" data can be specified each time a programming image is launched, so it can be customized on a target-by-target basis. Dynamic data has many use cases: customer driven serialization, configuration, tracking, date coding, etc. Multiple sets of dynamic data can be specified on the command-line. Data can be provided as an array of bytes or as a null-terminated string.

As part of the dynamic data programming parameter, the Cyclone handle number must be specified. This allows different dynamic data to be programmed into targets connected to each opened Cyclone. If only one Cyclone is being launched, the value used would be 1. If three Cyclones were specified on the command-line, they would be numbered in order from left to right on the command-line as 1, 2, and 3.

The syntax for programming dynamic data as an array of bytes is:

   -putdynamicdata=[cyclone number],[address],[data]

The syntax for programming dynamic data as a null terminated string is:

   -putdynamicstring=[cyclone number],[address],[string]

In the following example, we program both a unique user-generated serial number and a unique user-generated IP address string into two different targets, connected to two different Cyclones:

gang_programming_4.png

Recovering success/error result from python/bash/batch/etc.

In addition to displaying success and error information as strings written to the Console, the Cyclone Control Console also returns an appropriate error code to the operating system on the PC. An application or various scripting languages can be used to test for this error code. A zero error code indicates successful operation, and a non-zero error code indicates a failure.

Here is an example of a python script which can successfully recover success/error information from the Cyclone Control Console:

import subprocess
import sys
P = subprocess.run("cyclonecontrolconsole -cyclone=Agnes -launchimage=green_serial", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print("Printing STDOUT:")
print(P.stdout.decode())
if P.returncode == 0:
print("Successfully programmed!")
else:
print("Programming FAILED!!! with error code " + str(P.returncode))
sys.exit(1)

Here is an example of a Windows Batch file which can successfully recover success/error information from the Cyclone Control Console:

cyclonecontrolconsole -cyclone=Agnes -launchimage=green_serial
if ERRORLEVEL 1 goto errorOccurred
echo Successfully programmed!
goto done
:errorOccurred
echo Programming FAILED!!!!!
:done

Here is an example of a bash shell script which can successfully recover success/error information from the Cyclone Control Console:

#!/bin/bash  
cyclonecontrolconsole -cyclone=Agnes -launchimage=green_serial
errorReturn=$?
if [ $errorReturn == 0 ]; then
  echo 'Successfully programmed!'
else
  echo 'Programming FAILED!!!!! with error code '$errorReturn
  exit 1
fi

2. Gang Programming using the Cyclone Control SDK

PEmicro’s Cyclone Control SDK provides the developer with a dynamically loadable shared library (DLL or SO), example application code, and supporting documentation to allow custom software applications to directly control the Cyclone. Languages and environments such as C,C++, Delphi, C#, Java, Python, and Labview are supported.

Binary data information, algorithm information, programming operations, and other settings are stored together in a SAP image which is saved directly into the FLASH memory of the Cyclone. Programming operations can be initiated by the push of a button on the Cyclone, however, the SDK enables a PC to issue a command to the Cyclone to start the same programming sequence, and also to provide other capabilities, such as the ability to add dynamic data to each board being programmed, and the ability to recover error information.

Connecting to Multiple Cyclones and Launching a Programming Image

Connecting to multiple Cyclones using the SDK is very simple. Below is an example of what the code would look like in C:

gang_programming_5.jpg

Here, the programming operations are started on 3 separate Cyclone units that are connected to the host PC. This will work even if all the Cyclones are connected on a mix of different ports or remotely away from the PC. The program then waits for their completion before proceeding. In essence, 3 separate devices are programmed in parallel. Many Cyclone units can be controlled in parallel from a single host PC as the programming work is done on the Cyclones themselves.

Providing additional dynamic data for each individual target being programmed

In the example below a serial number is programmed into each of the targets connected to the three Cyclones. 

gang_programming_6.jpg

To do this, the code calls the “startDynamicDataProgram” routine. The arguments are the Cyclone handle returned from “connectToCyclone,” the address to be programmed (which is address 0 in this case), the length of the data to be programmed, and a char buffer. 

Checking for Errors

The Cyclone Control SDK gives the user the option to check for errors after the execution of a programming command has finished (indicated when checkCycloneExecutionStatus returns 0).

gang_programming_7.jpg

To check for errors, call the “getNumberOfErrors” routine with the Cyclone handle as the lone argument. The return value of this routine is the number of errors in the specified Cyclone. If this value is 0, there were no errors. By using the “getErrorCode” function with the Cyclone handle and the error number (1..the number of errors), the user can get the error code number of the error which occured. For more information, the error code and be passed to the “getDescriptionOfErrorCode” routine in the Cyclone Control SDK which returns a detailed text description of the error.

Conclusion

It is very easy to create a gang programming setup using PEmicro's Cyclone Control Suite in combination with multiple Cyclones. Since each Cyclone is itself an independently operating programmer, a mix of programming images, targets, and data can be simultaneously programmed into many devices while maintaining a high level of performance. The Cyclone Control Console makes gang programming extremely easy to set up, while the Cyclone Control SDK allows detailed customization of gang programming control from many tools, languages, and environments. 

 

Explore CYCLONE FX

 

Source: PeMicro.com

This entry was posted in ARM Debug, PE Micro, Cyclone FX, gang programming

by Johan