PEmicro Blog

Cyclone Control SDK: Automated Flash Programming with LabVIEW®

Oct 08, 2018

April 2021 - We've updated this blog post with more information about gang operation.

PEmicro is excited to announce the release of a library of LabVIEW VI components as well as a sample project as part of the Cyclone Control Suite. This new feature facilitates easy integration of Cyclone stand-alone programmers into production applications developed in LabVIEW®. 

Cyclone Control Suite

The Cyclone Control Suite includes a Cyclone Control SDK which is a comprehensive API allowing multiple Cyclones to be managed simultaneously from a user-developed custom application that loads the provided Cyclone Control DLL. This blog post demonstrates how to utilize the SDK in LabVIEW®.

The Cyclone LC user manual and Cyclone FX user manual contain a full list and description of the Cyclone Control SDK API in detail.

What's Included

- Sample project (labview_demo.lvproj)

- Library (CycloneControlSDK.lvlib) and pre-built VIs

- C header (cyclone_control_api.h)

Using the Sample Project

The Cyclone Control Suite and this sample project is included with the Cyclone LC and Cyclone FX Programmer Installation Software.

The sample project was developed in National Instruments LabVIEW 2018. The main VI is The is the front panel of the project.

Figure 1: Front Panel (scroll to view complete image)

This is the block diagram.

Figure 2: Block Diagram (scroll to view complete image)

The Cyclone is selected by the port to which it is connected (USB1, ETHERNET1, or COM1) but the project can use other identifiers such as "Cyclone name" or "IP address" by modifying the Port Identifier indicator. The user should input the image number of the Cyclone that they want to launch to the Image ID box (the API also supports selecting an image by name). When the user presses the START button, the Cyclone will execute the specified image number. 

The application shows the typical steps in the programming procedure: port enumeration, Cyclone connection, image execution, check programming status, error retrieval, and connection disconnect. The four LEDs on the panel provide status information. If the user connects to a Cyclone and receives a valid handle, the Connect LED turns on. If they execute an image, the Launch LED turns on. If all programming steps execute correctly, the Success LED turns on; otherwise the Error LED turns on. 

Figure 3: Programming Success

When an error occurs, the error code and error message will be displayed on the front panel status indicators. Error checking is handled by the sub-VI This combines "get Number Of", "get Error", and "get Description Of Error" into one VI for easier error checking after each Cyclone operation.

Figure 4: Error Checking Block Diagram (scroll to view complete image)


Figure 5: Programming Failure Case

Building a New LabVIEW® Project

Building a new application is as easy as adding the library file (CycloneControlSDK.lvlib).  This library contains the collection of VIs generated from the DLL. The user can add the lvlib file to a project by right-clicking My Computer -> Add -> File -> CycloneControlSDK.lvlib within the Project Explorer window. The CycloneControlSDK.DLL and some system VIs will be added to the project dependencies.

Figure 6: Project Explorer With Dependencies

With the library added to the project, the user can just drag the pre-built CycloneControlSDK VIs into their block diagram to use their functionality. 

For example, opening a Cyclone by name is a common way to connect to a Cyclone. The "enumerate All" is executed first. The "connect To Cyclone.VI" block with the String constant containing the name of the Cyclone is executed next. This block returns a handle to the  "" where it will check if the user successfully connected to the Cyclone. 

Notice that the output error terminal of the previous block is connected to the input error terminal of the next block. There are two benefits to this connection scheme. It ensures the correct order of execution of each block (i.e. "connect To" can only execute after "enumerate All"). If an error occurred during the programming process, the error cluster will be passed down to error out.

Figure 7: Error Cluster Passed to Error Out

This example will be expanded further by including "add Cyclone" and another error handling block. Connect the error paths as before. Create a String constant for the file name and a numeric constant to select the media type. The specified image is then added to the Cyclone.

Figure 8: Connect Error Paths (scroll to view complete image)

Gang Programming

The previous example as well as the sample project control only one Cyclone but what if your production requires gang programming. The default setting of LabVIEW 2018 only allows one copy of a VI to execute at a time. When "start Image" is running for the first Cyclone, it can't run for another Cyclone until the first execution is complete. The VI has a setting that enables simultaneous execution of itself. This is done by re-configuring the VI for reentrant execution under VI Properties and Execution. After enabling reentrancy, the application can execute multiple copies of "connect To" and "start Image" simultaneously on several Cyclones for gang programming.  

Importing the DLL

If developers do not want to use the prebuilt VIs, they can import the DLL and modify them to meet their own requirements. The project includes a header file to import all the function calls available in the API into the application. The import tool is accessed under Tools -> Import -> Shared Library (.dll)

Figure 9: Importing the DLL (scroll to view complete image)

Choose "Create VIs for a shared library" and select the Cyclone Control DLL and header file. 

Figure 10: Select the Cyclone Control DLL and Header File

LabVIEW® will import all exported functions in the header file and generate VIs for each function.

Figure 11: VIs Generated for Each Function

Cyclone Control SDK and Licensing

PEmicro's Cyclone Control SDK is part of the Cyclone Control Suite, which is included as a standard feature with all models of Cyclone. No additional license is required.


PEmicro is confident that this new addition to the Cyclone Control SDK will allow LabVIEW®  application engineers and developers to decrease development time and improve results.

LabVIEW® is a registered trademark of National Instruments Corporation, Inc.

Tags related to this Blog Post

Cyclone     Cyclone FX     ARM     NXP     Production Programming     Automated Control