This document describes the FlashPro-M and GangPro-M API-DLL, and explains how to use it. The API-DLL is a dynamic library that can control multiple Flash Programming Adapters (FPAs) simultaneously. It is intended for users that need to use multiple M FPAs to program a board with multiple target devices. An example hardware setup is shown below:
Figure 1.1: Multiple FlashPro-M adapters controlled from one user application
Figure 1.2: Multiple GangPro-M adapters controlled from one user application
Software Installation
FlashPro-M or GangPro-M Programmer package contains:
One FlashPro-M or GangPro-M programming adapter.
One 6 feet long USB-A to USB-B cable.
FlashPro-M programmer allows to program one target device from one adapter.
GangPro-M programmer allows to program up to six(6) target devices from one adapter.
FPA to ARM 14-pin to 20-pin adapter (PE036X01) and ribbon cable.
For Linux installation, follow included README.txt file which will provide instructions on how to run .deb auto installer package.
For Windows, run setup.exe and the setup wizard appears automatically. Click Install to begin the process.
Once the installation program starts, on-screen instructions will guide you through the remainder of the installation. You must accept the license agreement before using this software.
Driver Installation
The Linux installation relies on the default libusb-1.0 packages that can be installed using apt.
The Windows installation will install the Elprotronic USB driver files in Windows directories "Windows\inf" and "Windows\system32\drivers".
Plug in the FlashPro-M/GangPro-M Programmer to the PC USB Port, using provided cable extender (USB-A to USB-B).
For Windows XP, Vista, 7, 8, 10. The "New hardware has been found - USB-FPA-BOOT" window should be displayed. Follow wizard instructions to install the drivers.
In the first Wizard dialog screen (see Figure 3.1) select the "Yes, this time only" option.
_Toc452148527_Toc450742556Figure 1.3:New Hardware Wizard, step 1. Select "Yes, this time only."
In the second Wizard dialog screen (see Figure 3.2) select the "Install the software automatically (Recommended)" option and press NEXT button.
Software will search for the USB-FPA-BOOT driver. It can take a few minutes to find the necessary files. When the driver is found then the following warning will be displayed (Figure 3.3).
_Toc452148529_Toc450742558Figure 1.5:New Hardware Wizard, step 3. Ignore this warning.
Ignore this message and press button "Continue Anyway". The first USB-FPA-BOOT driver should be installed and the following message will be displayed (Figure 3.4).
After a few seconds, a second "New hardware" window will appear regarding the adapter with the name (Elprotronic). Repeat procedures described above to install the Elprotronic driver (see Figure 3.5). If for any reason the wizard cannot find the USB driver's location then use the manual browse option to locate driver files in the software directory "C:\Program Files (x86)\Elprotronic\Drivers USB-FPA\XP,Vista,Win-7,8,10". For Windows 2000, 98-SE, ME. The "New hardware has been found" window will be displayed instead. Follow wizard instructions to install the drivers.
Press "Next" when the Device Wizard Driver screen appears.
Select the following option on the wizard screen: select a suitable driver for my device (recommended) and press "Next".
Select the third option – "Specify a location" for a location of the driver files.
In the application software directory "C:\Program Files (x86)\Elprotronic\Drivers USB-FPAnW2K, W98SE, WinME" and press "Next".
Driver installation process will start.
Driver installation procedures should be done twice to install two USB drivers - the Boot driver and the Application driver.
Reboot computer if necessary.
Hardware Setup
Connect programmer to target device:
Connect the programming adapter to the PC USB Port or via USB-HUB using provided cable extender (USB-A to USB-B) (see Figure 1.1 or 1.2).
Target Connection:
Plug in 14-pin ribbon cable to FlashPro-M programmer and then the ARM 14-pin to 20-pin adapter (PN: PE036X01) to the end of the ribbon cable. Connect target device to the 20-pin end of the adapter. Make sure that pin 1 on your device board's header is connected to pin 1 of the socket connector (red cable).
Alternatively, connect the GangPro-M programmer to the GangSplitter-ARM, and then connect each GangSplitter-ARM socket to target device using a 20-pin ARM ribbon cable.
DLL Overview
The FlashPro-M/GangPro-M DLL setup is implemented using two DLLs, the Multi API-DLL and the API-DLL. One instance of the top-level Multi API-DLL controls multiple instances of the API-DLL. The Multi API-DLL manages all global meta-data and control flow while the API-DLL controls one adapter individually. The user interacts only with the Multi API-DLL.
Initializing multiple FPAs using the Multi API-DLL is straightforward. The top-level function F_OpenInstancesAndFPAs() accepts a string or file input path that specifies the index and serial numbers (SNs) of all the FPAs the user wishes to control. With this input the Multi API-DLL will create enough API-DLL instances to manage all FPAs automatically. Afterwards, the Multi API-DLL has several functions which allow the user to select which FPA is controlled (or all at once), and issue commands that will be automatically forwarded to the corresponding API-DLL. Currently, up to 64 individual FPAs can be controlled using the Multi API-DLL (these would normally be connected using USB hubs connected to the host computer’s USB port).
Setting up DLL Demo Environment
After installation, the relevant files are found in the directory:
32-bit installation (x86): C:\Program Files (x86)\Elprotronic\8-32b-MCU, or
The relative directories FlashPro-M and GangPro-M will contain the FlashPro-M and GangPro-M executables.
The API-DLL directory contains all the demo applications, and the bin and debug directories that have the Multi API-DLL and API-DLL files.
The easiest way to get started using the DLL is to run the executable code examples. To run the examples:
Copy the 8-32b-MCU directory out of the Program Files directory to a work directory. The target directory should be a place where files can be freely modified without administrator privileges. This is important for compiling Visual Studio examples and because as mentioned in the previous section, the Multi API-DLL will attempt to create enough copies of the API-DLLs to have one for each adapter. If there are more than one adapter, then the Multi API-DLL will fail in creating FlashProM-FPA2.dll or GangProM-FPA2.dll within the Program Files directory (those files get placed in the hidden C:\Users\AppData directory) and those adapters will not respond.
Start any of the executables, for example FP-M-Demo-C#.exe, or GP-M-Demo-C++.exe
If using one adapter, press the “Open One Instance and FPA (“*# *”)” button followed by Initialization button.
Next Open Setup File and Open Code File as in the Main GUI.
Subsequently use the Auto Program or other buttons to call DLL functions.
Running Demo Applications
The FlashPro-M and GangPro-M installation package has demos in C++, C#, Python and Labview. The projects have already been compiled and the executables are available in the API-DLL\bin\ and API-DLL\debug directories. The demo projects have been configured such that they will build their executables to the bin directory for release build and debug directory for debug build. Debug symbols for FlashPro-M or GangPro-M libraries are not available.
The code examples provided illustrate how to use most, but not all available DLL functions. The pull-down menus that list MCU vendors, families, groups, and names are intended to be used for each individual FPA separately (index 1 to 64), not for FPA index 0 (ALL FPAs) since each FPA can be configured to program different vendors depending on configuration.
C/C++ Basic demo code sequence
The aforementioned code snippet works both with the FlashPro-M and GangPro-M libraries because those functions are common to both adapters. For specific functions exclusive to the FlashPro-M or GangPro-M please consult the DLL functions chapter within this guide.
Required files
The following files should be placed within the current working directory of the application executable:
FlashPro-M
FlashProM-FPAsel.dll, and FlashProM-FPA1.dll
GangPro-M
GangProM-FPAsel.dll, and GangProM-FPA1.dll
C++ Demo Specifics
When a C++ demo application is created, the following files should be added to the project:
FlashPro-M
FlashProM-Dll.h - header file (from \include)
FlashProM-FPAsel.lib - Multi API lib file (from \bin or \debug)
GangPro-M
GangProM-Dll.h - header file (from \include)
GangProM-FPAsel.lib - Multi API lib file (from \bin or \debug)
The source code is also available for the provided demo executables; if converting from the current Visual Studio 2005 project, to newer versions, sometimes incorrect conversions can break intended GUI dimensions.
C# Demo Specifics
When the C# demo application is created, the following files should be added to the project (taken from any C# demo directory):
FlashPro-M
FLASHPROM_API.cs - DLL Import definitions
FLASHPROM_DLL.cs - Definitions used by DLL
GangPro-M
GANGPROM_API.cs - DLL Import definitions
GANGPROM_DLL.cs - Definitions used by DLL
The source code is also available for the provided demo executables; if converting from the current Visual Studio 2005 project, to newer versions, sometimes incorrect conversions can break intended GUI dimensions.
Python Basic demo code sequence
Data and Control Flow
The Multi API-DLL (FlashProM-FPAsel.dll, and GangProM-FPAsel.dll) forwards calls coming from application software to individual API-DLL instances (FlashProM-FPA1.dll to FlashProM-FPA64.dll, and GangProM-FPA1.dll to GangProM-FPA64.dll respectively). A representation of the control and data flow is shown in Figure 1.8 and Figure 1.9. The desired destination FPA can be selected using the function F_Set_FPA_index( fpa ) where indices 1 to 64 select only one desired FPA. Select index 0 when ALL FPAs should be selected.
The selected FPA index modified by the F_Set_FPA_index( fpa ) function can be modified at any time. By default, the FPA index is 1 and if only one FPA is used then FPA index does not need to be modified. When FPA index 1 to 64 is used, then the result of any forwarded function call will be directly returned to application software from the single API-DLL instance being invoked transparently. When FPA index 0 is used (ALL-FPAs) and results are the same from all FPAs, then the same result is passed back to application software. If results are not the same, then the Multi API-DLL will return value FPA UNMATCHED RESULTS (-1 or 0xFFFFFFFF). To obtain individual results per API-DLL instance use the function F_LastStatus( FPA ). This function will read back the results of the previously called API-DLL function, which was stored internally in the Multi API-DLL's result buffer. This temporary result buffer will be overwritten on the next call to each API-DLL instance.