Numberedheadings | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||
IntroductionThis document describes the FlashPro-ARM and GangPro-ARM 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 ARM FPAs to program a board with multiple ARM microcontroller units (MCUs). An example hardware setup is shown |
...
below: Figure 1.1 |
...
The FlashPro-ARM API-DLL is actually 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 actually performs programming for each MCU. The user only directly interacts with the Multi API-DLL.
Initializing multiple FPAs using the Multi API-DLL is easy. Only specify the index and serial numbers (SNs) of the FPAs you wish to control, and the Multi API-DLL will create enough API- DLL instances to accomplish the task automatically. Using the Multi API-DLL, select which FPA you wish to control (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).
...
: Multiple FlashPro-ARM adapters controlled from one user application Figure 1.2: Multiple GangPro-ARM adapters controlled from one user application Software InstallationFlashPro-ARM or GangPro-ARM Programmer package contains:
The FlashPro-ARM/GangPro-ARM software runs under Windows (x86/x64) and Linux (amd64/armhf). Follow instructions below to install the software:
Driver InstallationThe 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".
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
Hardware Setup
|
...
|
...
DLL OverviewThe FlashPro-ARM/GangPro-ARM 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 EnvironmentAfter installation, the relevant files are found in the directory:
The relative directories FlashPro-ARM and GangPro-ARM will contain the FlashPro-ARM and GangPro-ARM 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:
Running Demo ApplicationsThe FlashPro-ARM and GangPro-ARM 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-ARM or GangPro-ARM libraries are not available. The code examples provided illustrate how to use most, but not all available DLL functions. C/C++ Basic demo code sequenceThe aforementioned code snippet works both with the FlashPro-ARM and GangPro-ARM libraries because those functions are common to both adapters. For specific functions exclusive to the FlashPro-ARM or GangPro-ARM please consult the DLL functions chapter within this guide. Required filesThe following files should be placed within the current working directory of the application executable:
C++ Demo SpecificsWhen a C++ demo application is created, the following files should be added to the project:
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 SpecificsWhen the C# demo application is created, the following files should be added to the project (taken from any C# demo directory):
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 sequenceData and Control FlowThe Multi API-DLL (FlashProARM-FPAsel.dll, and GangProARM-FPAsel.dll) forwards calls coming from application software to individual API-DLL instances (FlashProARM-FPA1.dll to FlashProARM-FPA64.dll, and GangProARM-FPA1.dll to GangProARM-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. |
When the FPA index is 0 (ALL-FPAs) then almost all functions are executed simultaneously. Less critical functions are executed sequentially from FPA-1 up to FPA-64 but this distinction cannot be seen from the application software. The longest running programming functions, Encapsulated Functions i.e. F_AutoProgram, are all executed fully in parallel. When different configurations are used for each FPA (i.e. if FPA-1 programs 10kB of data and FPA-2 programs 20kB of data) then the Multi API-DLL function call will return when all API-DLL function calls have finished.
When an inactive FPA index is selected (FPA not initialized), then the return value from selected function is FPA_INVALID_NO (-2 or 0xFFFFFFFE). When all FPA has been selected (FPA index == 0) then only active FPAs will be called. For example if only one FPA is active and FPA index == 0, then only one FPA will be used.
All API-DLL instances used by the Multi API-DLL are fully independent with respect to each other. Data transferred to one FPA does not have to be the same as the data transferred to other FPAs. For example, code data programmed using FPA-1 will use the buffers from API-DLL 1, and code data programmed using FPA-2 will use buffers from API-DLL 2. Once the different code buffers are setup, programming can be done simultaneously using FPA index 0 and the function F_AutoProgram. To configure the data buffers shown in Figure 1.8 use Data Buffer Functions
The major features supported by the API-DLL are:
Initialize and terminate communication with FPA and target device,
Configure settings from file or using functions,
Program code data from file or modify code buffer using functions,
Return string report message generated for most actions,
Reset target device,
Program target device ( erase, blank check, program, verify, lock, and unlock ),
Erase all or selected part of memory,
Blank check all or selected part of memory,
Write code file contents,
Verify code file contents,
Read all or selected part of memory,
Lock memory protection bits and debug access (if supported on device),
Unlock device to return memory to factory settings (if supported on device).