Having correctly configured the top-level Multi API-DLL using Multi API-DLL Functions, the functions in this section can be used to initialize and configure each FPA individually (and it’s API-DLL instance).
Generic functions read and write the API-DLL’s configuration, access status messages and can instruct the FPA to power or reset the target device. The functions described in this section require that each FPA already be opened using Multi API-DLL Functions | F_OpenInstancesAndFPAs.
After the following functions have been used to configure each FPA correctly for its target device, use Data Buffer Functions to determine what code should be written during programming. Finally, Encapsulated Functions can perform the process of programming, writing, erasing, verifying, etc., according to the aforementioned settings.
1. F_Initialization
General Description
Initialize FPA after it has been successfully opened using Multi API-DLL Functions | F_OpenInstancesAndFPAs. F_Initialization performs the following tasks:
all internal data is cleared and set to default values,
USB driver is initialized if has not been initialized before.
Select which FPA to initialize, using the function Multi API-DLL Functions | F_Set_FPA_index with desired parameter (0-all, 1-64 for individual FPA). After successful initialization, call Generic Functions | F_ConfigFileLoad to read settings from file, or configure settings manually using the function Generic Functions | F_Set_Config_Value_By_Name.
For backwards compatibility, F_Initialization will call F_OpenInstancesAndFPAs(*# *) if no instances are currently opened, and perform initialization on FPA 1. If Multi API-DLL Functions | F_OpenInstancesAndFPAs was already invoked successfully then initialization is performed on the selected FPA index from the function Multi API-DLL Functions | F_Set_FPA_index.
Default config file used to perform initialization is config.ini (Use F_Use_Config_INI(FALSE) to disable automatic load of config.ini).
Syntax
INT_X F_Initialization( void );
Input
none.
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : result of operation
FALSE (0) : failed
TRUE (1) : succeeded
4 : Programming adapter not detected
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
2. F_Use_Config_INI
General Description
Configure Generic Functions | F_Initialization to use (default) or skip config.ini file. When skipping config.ini it is necessary to use Generic Functions | F_ConfigFileLoad or Generic Functions | F_Set_Config_Value_By_Name functions to configure the adapter.
Syntax
INT_X F_Use_Config_INI(BYTE use);
Input
BYTE use : 1 to use config.ini, 0 to skip
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : result of operation
FALSE (0) : failed
TRUE (1) : succeeded
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
3. F_Get_Config_Name_List
General Description
Iterate over configuration parameter names, starting from index 0. Increase index until return is null character. Will return a pointer to a character array with name of parameter or null character once index is too high.
Requires the target FPA to be opened using Multi API-DLL Functions | F_OpenInstancesAndFPAs and initialized using Generic Functions | F_Initialization.
Syntax
char * F_Get_Config_Name_List( INT_X index );
Input
INT X : configuration parameter index, starting from zero. Increment until return value is null character.
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64.
Output
char * : configuration parameter name
a valid character array pointer containing name of configuration parameter (do not free after use)
null character : end of parameter list
”” : invalid fpa index, cannot be zero
4. F_Get_Config_Value_By_Name
General Description
Access the current FPA’s configuration. Use Generic Functions | F_Get_Config_Name_List to get configuration parameter names, then use them as input to this function. Select input type to validate name, and get current, minimum, maximum, and default values.
Because normal return values from this function can be any value, from 0 to 0xFFFFFFFF, it is important to pick a correct fpa index (use Multi API-DLL Functions | F_Check_FPA_index to validate) and validate the configuration parameter name first (using CONFSEL_VALIDATE), before retrieving the current, minimum, maximum or default values. Unless all FPAs are to be configured identically, avoid using FPA index 0 to prevent confusion in results (when results don’t match using FPA index 0 (all FPAs) the result is simply FPA_UNMATCHED_RESULTS (-1)).
Requires the target FPA to be opened using Multi API-DLL Functions | F_OpenInstancesAndFPAs and initialized using Generic Functions | F_Initialization.
Syntax
unsigned int F_Get_Config_Value_By_Name(char *name, INT_X type);
Input
char * name : parameter name INT X type : select action
CONFSEL VALIDATE (0) : returns TRUE if name was found in configuration list
CONFSEL VALUE (1) : returns current value of configuration parameter
CONFSEL MIN (2) : returns minimum value that this configuration parameter can have
CONFSEL MAX (3) : returns maximum value that this configuration parameter can have
CONFSEL DEFAULT (4) : returns default value for this configuration parameter if not set by user/file
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
unsigned int : depends on input
FALSE (0) : failed name validation (CONFSEL_VALIDATE)
TRUE (1) : successful name validation (CONFSEL_VALIDATE)
any : actual parameter value, minimum and maximum bounds, and default value if not set by user/file (CONFSEL_VALUE, CONFSEL_MIN, CONFSEL_MAX, CONFSEL_DEFAULT)
-1 or 0xFFFFFFFF : name not found (avoid this by using CONFSEL_VALIDATE first)
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
Example
Use the example code below to read full configuration:
//#define CONFSEL_VALIDATE 0 //#define CONFSEL_VALUE 1 //#define CONFSEL_MIN 2 //#define CONFSEL_MAX 3 //#define CONFSEL_DEFAULT 4 stringstream msg; char *tmp=NULL; int i=0; while((tmp = F_Get_Config_Name_List(i++)) != NULL && strcmp(tmp, "\0") != 0) { //Check if parameter name is correct, should be redundant if(F_Get_Config_Value_By_Name(tmp, 0)) { unsigned int val = F_Get_Config_Value_By_Name(tmp, 1); unsigned int min = F_Get_Config_Value_By_Name(tmp, 2); unsigned int max = F_Get_Config_Value_By_Name(tmp, 3); unsigned int def = F_Get_Config_Value_By_Name(tmp, 4); msg << tmp << "=0x" << hex << val << ", 0x" << hex << min << "<=X<=0x" << hex << max << "(def=0x" << hex << def << ")\r\n"; //sanity check on current value if(val < min || val > max) { msg << "======= " << tmp << " value outside min/max =======\r\n"; msg << "DLL failed to trim\r\n"; } //sanity check on default value if(def < min || def > max) { msg << "======= " << tmp << " default outside min/max =======\r\n"; msg << "Param default OUT OF RANGE\r\n"; } } else { msg << "config parameter name invalid " << tmp << "\r\n"; } }
5. F_Set_Config_Value_By_Name
General Description
Set the current FPA’s configuration. Use Generic Functions | F_Get_Config_Name_List to get configuration parameter names, then use them as input to this function. New value for configuration parameter will be trimmed by minimum and maximum values allowed for this parameter. If not initialized, this parameter will have a default value. Double check parameters after configuration using F_Get_Config_Value_By_Name.
Requires the target FPA to be opened using Multi API-DLL Functions | F_OpenInstancesAndFPAs and initialized using Generic Functions | F_Initialization.
Syntax
INT_X F_Set_Config_Value_By_Name(char *name, unsigned int newValue);
Input
char * name : parameter name
unsigned int newValue : assign new configuration parameter value (will be trimmed by min/max if necessary)
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : result of operation
FALSE (0) : parameter name not found
TRUE (1) : name found and parameter value changed
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
6. F_Get_Device_Info
General Description
Get information about selected microcontroller.
Syntax
INT_X F_Get_Device_Info( INT_X index );
Input
INT_X : select type of information to receive
DEVICE_NAME (0) : get character 0, increase index up to 19 to get last character
DEVICE_FAMILY_INDEX (20) : Family Index (subset of MCU vendor, index 30)
DEVICE_GROUP_INDEX (21) : Group Index (subset of MCU family, index 20)
DEVICE_NAME_INDEX (22) : Name Index (subset of MCU group, index 21)
DEVICE_GROUP (23) : Obsolete
DEVICE_FLASH_START_ADDR (24) : Flash Start Address, i.e. 0x00000
DEVICE_FLASH_END_ADDR (25) : Flash End Address, i.e. 0x1FFFF
DEVICE_OTP_START_ADDR (26) : OTP Start Address, i.e. 0x400FE1E0
DEVICE_OTP_END_ADDR (27) : OTP End Address, i.e. 0x400FE1EF
DEVICE_RAM_START_ADDR (28) : RAM Start Address, i.e. 0x20000000
DEVICE_RAM_END_ADDR (29) : RAM Start Address, i.e. 0x20010000
DEVICE_VENDOR_INDEX (30) : Vendor Index (superset of all supported MCUs, i.e. company name)
DEVICE_EEPROM_START_ADDR (31) : EEPROM Start Address, i.e. 0x08080000
DEVICE_EEPROM_END_ADDR (32) : EEPROM End Address, i.e. 0x080803FF
DEVICE_COMM_INTERFACES (33) : MCU communication interfaces eg 0x30 ( COMM_JTAG | COMM_SWD
DEVICE_EXTFLASH_START_ADDR (34) : External Flash Start Address, i.e. 0x10000000
DEVICE_EXTFLASH_END_ADDR (35) : External Flash End Address, i.e. 0x1001FFFF
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64.
Output
INT_X : value dependent on input parameter
any : based on input parameter
-1 (0xFFFFFFFF) : invalid input parameter
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
Example
#define MCU_DATA_SIZE 20 typedef struct { char name[DEVICE_NAME_SIZE+1]; union { long data[MCU_DATA_SIZE]; struct { long FamilyIndex; long GroupIndex; long NameIndex; long GroupID; long FlashStartAddr; long FlashEndAddr; long OTPStartAddr; long OTPEndAddr; long RAMStartAddr; long RAMEndAddr; long VendorIndex; long EEPROMStartAddr; long EEPROMEndAddr; long CommInterface; long ExtFlashStartAddr; long ExtFlashEndAddr; }x; }u; }_MCU_INFO; _MCU_INFO MCU_Info; void Get_MCU_Info( void ) { int k; // get device info for( k=0; k<DEVICE_NAME_SIZE; k++) { //---------------------------------------------------- MCU_Info.name[k] = (char)F_Get_Device_Info( k ); //---------------------------------------------------- } MCU_Info.name[k] = '\0'; for( k=0; k<MCU_DATA_SIZE; k++) {//when going beyond valid indices, the function will return -1 //---------------------------------------------------- MCU_Info.u.data[k] = F_Get_Device_Info( DEVICE_NAME_SIZE + k ); //---------------------------------------------------- } }
7. F_Set_MCU_Name
General Description
Set target microcontroller name. A list of acceptable names can be obtained using the functions F_Set_MCU_Family_Group, F_Get_MCU_Name_list, and F_Search_MCU_Name.
Syntax
INT_X F_Set_MCU_Name( char *MCU_name );
Input
char * MCU_name: Exact name of target microcontroller.
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : microcontroller index if successful
microcontroller index if input name was found and set, index is greater than or equal to zero (0)
-1 (0xFFFFFFFF) : name not found (avoid by getting list of proper names using F_Get_MCU_Name_list)
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
8. F_Search_MCU_Name
General Description
Get microcontroller names that match regular expression from selected vendor.
Syntax
void* F_Search_MCU_Name( char *MCU_name_regex, char *Vendor_filter, int mode, int flags );
Input
char * MCU_name_regex : regular expression. i.e.:
'.' Dot, matches any character '^' Start anchor, matches beginning of string '$' End anchor, matches end of string '*' Asterisk, match zero or more (greedy) '+' Plus, match one or more (greedy) '?' Question, match zero or one (non-greedy) '[abc]' Character class, match if one of {'a', 'b', 'c'} '[a-zA-Z]' Character ranges, the character set of the ranges { a-z | A-Z } '\s' Whitespace, \t \f \r \n \v and spaces '\S' Non-whitespace '\w' Alphanumeric, [a-zA-Z0-9_] '\W' Non-alphanumeric '\d' Digits, [0-9] '\D' Non-digits
char * Vendor_filter : Preferably limit to one vendor only, to speed up search function especially in mode with more than first match result. i.e.:
NULL all enabled lists on this adapter "SPI Serial Flash" "Microchip/Atmel" "Renesas" "ST Microelectronics"
int mode : search mode
0, returns the first match to MCU_name_regex, a type (char *). Library will alloc and free this memory by itself, do not modify contents
1, returns the pointer to a list of matches to MCU_name_regex, a type (char **). Library will alloc and free this memory by itself, do not modify contents
int flags : used to control mode 1 search
for mode 0, not used
for mode 1, max number of results to return > 0
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64.
Output
void * : pointer to results
if mode 0 used, one char * name, or NULL if no match
if mode 1 used, a list of matches returned as (char **). The list will continue with string matches or NULL when search results have finished.
9. F_Reset_Config
General Description
Reset all configuration values to default values for selected MCU.
Syntax
void MSPPRG_API F_Reset_Config();
Input
none.
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
none.
10. F_Get_MCU_Name_list
General Description
Obtain a list of supported vendors, families, groups, and MCUs for the specified FPA. Use this function in conjunction with F_Set_MCU_Family_Group to get all supported MCU names. First obtain the names of supported vendors, then select one vendor. Then, for the selected vendor obtain the names of supported families, then select one family, etc.
The MCU names obtained from this function are the exact names used to configure the FPA using the function F_Set_MCU_Name for the target device you want to program.
Syntax
char * F_Get_MCU_Name_list( INT_X type, INT_X index );
Input
INT_X type : specify which list to get names from
MCU_VENDOR_LIST (0) : get name of vendors enabled on this FPA
MCU_FAMILY_LIST (1) : get name of MCU families supported from the selected vendor
MCU_GROUP_LIST (2) : get name of MCU groups supported from the selected MCU family
MCU_NAME_LIST (3) : get name of MCU supported from the selected MCU group
INT_X index : list index starting from zero, increment until returned string is null character.
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64.
Output
char * : Name of vendor, family, group, or MCU for the given index.
valid name : if correct parameters provided
”” : incorrect FPA index provided (avoid using F_Check_FPA index)
Example
Refer to F_Set_MCU_Family_Group.
11. F_Set_MCU_Family_Group
General Description
Select vendor, family, group and MCU index. Use this function in conjunction with F_Get_MCU_Name_list to get all supported MCU names. First obtain the names of supported vendors, then select one vendor. Then, for the selected vendor obtain the names of supported families, then select one family, etc.
Use MCU names to configure the FPA using the function F Set MCU Name. Use this function only to obtain the list of supported MCU names, not to configure the FPA. When NEW MCUs are supported then these indices will change.
Syntax
INT_X F_Set_MCU_Family_Group( INT_X type, INT_X index );
Input
INT_X type : specify which list to set index for
MCU_VENDOR_LIST (0) : set vendor index on this FPA
MCU_FAMILY_LIST (1) : set family index from the selected vendor
MCU_GROUP_LIST (2) : set group index from selected MCU family
MCU_NAME_LIST (3) : set MCU index from selected MCU group (use actual INT X index : set list index
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : result of operation
FALSE (0) : index parameter out of range
TRUE (1) : index parameter set correctly
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
Example
The code below is used to initialize the drop-down menus seen in the GUI demos that can be found in the install Elprotronic\M\API-DLL directory.
The sequence is as follows:
Get Vendor List
Call
F_Get_MCU_Name_list( MCU_VENDOR_LIST, k );
in a loop to read all supported vendorsThis generates a list of vendors but doesn’t actually select one, i.e. TI, ST, or NXP
Set current vendor using
F_Set_MCU_Family_Group( MCU_VENDOR_LIST, Vendor_list_index );
This function selects one vendor from the list, with given index, i.e. select ST vendor.
Get Family List from selected vendor:
Call
F_Get_MCU_Name_list( MCU_FAMILY_LIST, k );
in a loop to read all families in selected vendorThis generates a list of MCU families for one specific vendor, i.e. STM32-F0, STM32-F1, etc.
Set current family using
F_Set_MCU_Family_Group( MCU_FAMILY_LIST, Family_list_index );
This function selects one family from the list, with given index. At this point the code has selected one vendor and one family from that vendor, i.e. select STM32-F0 family.
Get Group List from selected family of selected vendor. Groups sub-divide families into similar MCUs.
Call
F_Get_MCU_Name_list( MCU_GROUP_LIST, k );
in a loop to read all groups in selected family in selected vendor.This generates a list of groups for selected family within selected vendor, i.e. STM32F0x0, STM32F0x1, STM32F0x2, and STM32F0x8
Set current group using
F_Set_MCU_Family_Group( MCU_GROUP_LIST, MCU_Group_list_index );
This functions selects one group from the list, with given index. At this point the code has selected one vendor, and one family, and one group, i.e. select STM32F0x8.
Get MCU part number list from selected group. This is the final MCU name actually used in the “MCU_name” parameter of the configuration file.
Call
F_Get_MCU_Name_list( MCU_NAME_LIST, k );
in a loop to read all MCUs in selected group, in selected family, in selected vendor.This generates a list of MCU part numbers, i.e. STM32F038C6, STM32F038E6, etc.
Select (not shown below) one MCU from the list by using
INT_X F_Set_MCU_Name(char *MCU_name );
This function selects one MCU, and changes the configuration of the library to program this specific MCU.
Snippet taken from Elprotronic\M\API-DLL\FP-M-Demo-C++:
//C++ and C# are available in the installation package //that implement this code //Example from demo included in installation package //Select one FPA index to perform this sequence on. //If all FPA are the same then iterating over other FPA indices is not necessary. //Iterate over supported vendors, then select vendor zero in this case //Pull-down menu in demo allows user to change selected vendor index void ProgDemoDlg::Init_MCU_Vendor_ComboBox( void ) { int k; char *name; SelMCU_Vendor->ResetContent();//Reset list of vendors k = 0; Vendor_list_size = 0; do { //---------------------------------------------------- name = F_Get_MCU_Name_list( MCU_VENDOR_LIST, k );//get name of vendor at index k if( strlen( name ) == 0 ) break; //reached end of list of vendors //---------------------------------------------------- if(SelMCU_Vendor) { //---------------------------------------------------- SelMCU_Vendor->AddString( name ); //add newly acquired vendor name to GUI list //---------------------------------------------------- Vendor_list_size++; } k++; }while(1); //Select vendor zero in demo GUI (will not affect DLL yet) SelMCU_Vendor->SetCurSel(0); //Select chosen vendor and read supported MCU families OnCbnSelchangeMcuVendor(); } //Initialize list of supported families for selected vendor void ProgDemoDlg::OnCbnSelchangeMcuVendor( void ) { Vendor_list_index = SelMCU_Vendor->GetCurSel(); //---------------------------------------------------- //Set vendor to selected index (during initialization this is usually zero) F_Set_MCU_Family_Group( MCU_VENDOR_LIST, Vendor_list_index ); //---------------------------------------------------- Init_MCU_Family_ComboBox(); } //Iterate over supported families for selected vendor, then select family zero in this case //Pull-down menu in demo allows user to change selected family index void ProgDemoDlg::Init_MCU_Family_ComboBox( void ) { int k; char *name; SelMCU_Family->ResetContent(); k = 0; Family_list_size = 0; do { //---------------------------------------------------- name = F_Get_MCU_Name_list( MCU_FAMILY_LIST, k ); //get name of family at index k if( strlen( name ) == 0 ) break; //reached end of list of families //---------------------------------------------------- if(SelMCU_Family) { //---------------------------------------------------- SelMCU_Family->AddString( name ); //add newly acquired family name to GUI list //---------------------------------------------------- Family_list_size++; } k++; }while(1); //Select family zero in demo GUI (will not affect DLL yet) SelMCU_Family->SetCurSel(0); //Select chosen family and read supported MCU groups OnCbnSelchangeMcuFamily(); } //Initialize list of supported groups for selected family void ProgDemoDlg::OnCbnSelchangeMcuFamily( void ) { Family_list_index = SelMCU_Family->GetCurSel(); //---------------------------------------------------- //Set family to selected index (during initialization this is usually zero) F_Set_MCU_Family_Group( MCU_FAMILY_LIST, Family_list_index ); //---------------------------------------------------- Init_MCU_Group_ComboBox(); } //Iterate over supported groups for selected family, then select group zero in this case //Pull-down menu in demo allows user to change selected group index void ProgDemoDlg::Init_MCU_Group_ComboBox( void ) { int k; char *name; SelMCU_Group->ResetContent(); MCU_Group_list_size = 0; k = 0; do { //---------------------------------------------------- name = F_Get_MCU_Name_list( MCU_GROUP_LIST, k ); //get name of group at index k if( strlen( name ) == 0 ) break; //reached end of list of groups //---------------------------------------------------- if(SelMCU_Group) { //---------------------------------------------------- SelMCU_Group->AddString( name ); //add newly acquired group name to GUI list //---------------------------------------------------- MCU_Group_list_size++; } k++; }while(1); //Select group zero in demo GUI (will not affect DLL yet) SelMCU_Group->SetCurSel(0); //Select chosen group and read supported MCUs OnCbnSelchangeMcuGroup(); } //Initialize list of supported MCUs for selected group void ProgDemoDlg::OnCbnSelchangeMcuGroup( void ) { MCU_Group_list_index = SelMCU_Group->GetCurSel(); //---------------------------------------------------- //Set group to selected index (during initialization this is usually zero) F_Set_MCU_Family_Group( MCU_GROUP_LIST, MCU_Group_list_index ); //---------------------------------------------------- Init_MCU_List_ComboBox(); } //Iterate over supported MCUs for selected group, then select MCU zero in this case //Pull-down menu in demo allows user to change selected MCU index void ProgDemoDlg::Init_MCU_List_ComboBox( void ) { int k; char *name; SelMCU_List->ResetContent(); MCU_Name_list_size = 0; k = 0; do { //---------------------------------------------------- name = F_Get_MCU_Name_list( MCU_NAME_LIST, k ); //get name of MCU at index k if( strlen( name ) == 0 ) break; //reached end of list of MCUs //---------------------------------------------------- if(SelMCU_List) { //---------------------------------------------------- SelMCU_List->AddString( name ); //add newly acquired MCU name to GUI list //---------------------------------------------------- MCU_Name_list_size++; } k++; }while(1); //Select MCU zero in demo GUI (will not affect DLL yet) SelMCU_List->SetCurSel(0); }
12. F_ReportMessage, F_Report_Message
General Description
Get the last report message from the programmer. When any of the DLL functions are called, an output message is usually created. The GUI uses these messages to print to the dialog box. The user application can use these messages to populate its own dialog box. The last report message can be read by user application using these functions.
When these functions are called, then a report message of up to REPORT_MESSAGE_MAX_SIZE characters is copied to the character array passed as input parameter, or in the case of the latter function, a pointer to a statically allocated character array is returned with the output message text.
Calling F_ReportMessage clears the message buffer. If F_ReportMessage is not called, then the report message will collect all reported information up to REPORT MESSAGE MAX SIZE most recent characters.
Syntax
void F_ReportMessage( char * text ); char* F_Report_Message( void );
Input
char * text : F_ReportMessage, allocated text buffer of up to REPORT_MESSAGE_MAX_SIZE (2000) characters.
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64.
Output
char * : F_Report_Message, pointer to statically allocated character array containing output message text
13. F_GetReportMessageChar
General Description
Get one character from the report message buffer.
Syntax
char F_GetReportMessageChar( INT_X index );
Input
INT_X index : character index, starting from 0 to REPORT_MESSAGE_MAX_SIZE - 1.
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64.
Output
char : character from report message buffer.
14. F_DLLTypeVer
General Description
Get information about DLL software type and version. This function returns integer number with DLL ID and software revision version and copies a text message to the report message buffer about DLL ID and software revision. Text content can als0 be read using F_ReportMessage, F_Report_Message, or F_GetReportMessageChar functions.
Syntax
INT_X F_DLLTypeVer( void );
Input
none.
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64.
Output
INT X : (DLL ID) | (0x0FFF & Version)
// return Type + Version // Type 0x1000 - Single FlashPro430 - Parallel Port type // 0x2000 - Single FlashPro430 - USB type // 0x3000 - Single GangPro430 - USB type // 0x4000 - Single FlashPro-CC - USB type // 0x5000 - Single GangPro-CC - USB type // 0xA000 - Single FlashPro2000- USB type // 0xB000 - Single GangPro2000 - USB type // 0xE000 - Single FlashPro-ARM - USB type // 0xF000 - Single GangPro-ARM - USB type // Version = 0x0FFF & version
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
15. F_ConfigFileLoad
General Description
Modify programmer’s configuration according to data taken from specified configuration file. This setup will override previous values and leave omitted parameters untouched. When loaded for the first time, unspecified configuration parameters take on default values as given by Generic Functions | F_Get_Config_Value_By_Name. When calling this function multiple times with different configuration files, make sure to specify all relevant configuration parameters.
A configuration file can be created using the FlashPro-ARM/GangPro-ARM GUI software, or use the functions Generic Functions | F_Get_Config_Name_List, Generic Functions | F_Get_Config_Value_By_Name to extract a list of configuration names and values. The Generic Functions | F_Set_Config_Value_By_Name function can be used to set configuration parameters instead of Generic Functions | F_ConfigFileLoad.
Requires the target FPA to be opened using Multi API-DLL Functions | F_OpenInstancesAndFPAs and initialized using Generic Functions | F_Initialization.
Syntax
INT_X F_ConfigFileLoad( char * filename );
Input
char * filename : path to configuration file including filename and extension
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT X : result of operation
FALSE (0) : failed
TRUE (1) : succeeded
STATUS_OPEN_FILE_ERROR (535) : could not open file
STATUS_CORRUPT_CONFIG_ERROR (554) : malformed configuration file (missing header, etc.)
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
16. F_Power_Target
General Description
Enable power from FPA to target device. For this function to have its desired effect, configuration settings “PowerFromFpaEn” must be set to 1. If “PowerFromFpaEn” is set to 0, then power from FPA is always off regardless of this function’s input parameter.
Syntax
INT X F_Power_Target( INT X OnOff );
Input
INT X : power setting
FALSE (0) : power off
TRUE (1) : power on
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : result of operation
FALSE (0) : failed
TRUE (1) : succeeded
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
17. F_Reset_Target
General Description
Generate short reset pulse on target device’s reset line. The length of the reset pulse can be selected using configuration options. The “ResetTimeIndex” is used to select pre-set times, or for custom setup select the last index and specify “ResetPulseTime”, and “ResetIdleTime”.
Syntax
INT_X F_Reset_Target( void );
Input
none.
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : result of operation
FALSE (0) : failed
TRUE (1) : succeeded
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
18. F_Get_Targets_Vcc
General Description
Get Vcc in millivolts as read from target device.
This function is supported on all adapters (USB-FPA 6.1, XStream-Iso, and XStreamPro-Iso).
Syntax
INT_X F_Get_Targets_Vcc( void );
Input
none.
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : returns target voltage in millivolts
value of zero or greater : voltage in millivolts
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
19. F_Get_Power_Results
General Description
Read detailed Voltage and Current measurement results based on General Configuration | Power Monitor. This function will query the adapter for the latest measurement sample and copy those results into the xs_adc structure.
This function is supported only on XStream-Iso, and XStreamPro-Iso adapters. The USB-FPA 6.1 adapter will return FALSE.
Syntax
INT_X F_Get_Power_Results(double *xs_adc);
Input
double *xs_adc : pointer to instance of XS_ADC and doubles array, i.e.
XS_ADC xs_adc; F_Get_Power_Results(xs_adc.members);
union XS_ADC { double members[ XS_ADC_NUM_MEMBERS ]; struct { double ExtVcc; //actual external Vcc value in V double Vcc; //actual Vcc from programmer value in V double Vpp; //actual Vpp for fuse blown from programmer value in V double ExtVccMin; //external Vcc value in V - min value from the last read up to now double ExtVccMax; //external Vcc value in V - max value from the last read up to now double VccMin; //Vcc value in V - min value from the last read up to now double VccMax; //Vcc value in V - max value from the last read up to now double Icc_mA; //Icc value in mA - current value double Icc_mA_av4; //Icc value in mA - average for last 4 read (interval ~ 10ms) double Icc_mA_av16; //Icc value in mA - average for last 16 read (interval ~ 10ms) double Icc_mA_min; //Icc value in mA - min value from the last read up to now double Icc_mA_max; //Icc value in mA - max value from the last read up to now double Temperature; //Temperature inside XStream in C deg double Icc_mA_av64; //Icc value in mA - average for alpha 1/64 double Icc_mA_av; //Icc value in mA - average for defined alpha 1/N } data; };
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64.
Output
INT_X : result of operation
FALSE (0) : failed - USB-FPA 6.1 adapter detected
TRUE (1) : succeeded - XStream-Iso, and XStreamPro-Iso adapter detected
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
Example
This code sequence is taken from the LinuxCommandLineDemo installation directory for Linux, however, the same sequence of calls will work in other environments:
The code sequence is as follows:
Find adapters and perform initialization using
F_OpenInstancesAndFPAs((char *)input.c_str())
andF_Initialization()
In this example,
F_Set_FPA_index (0)
is called, which means that all adapters will be initialized.
Select one adapter
F_Set_FPA_index (1)
, in this case FPA-1, since the measurement function cannot be called on all adapters.Read configuration and code files using input parameters, these are paths to local files,
F_ConfigFileLoad( argv[1] )
andF_ReadCodeFile( argv[2] )
respectively. If the config file already has code paths included, then the latter is not required.Standard Auto Program and print report message sequence,
F_AutoProgram()
followed byF_Report_Message()
The crux of this example is in the last loop. First clear sample history using
F_XS_Clr_ADC_av_history
and repeatedly callF_Get_Power_Results(xs_adc.members)
xs_adc
will contain the details of the last sample taken.
Some optional code can be added before the loop depending on settings to improve monitoring:
//turn on target if config file did not select "Start Application Program" F_Power_Target(1); //tri-state pins to minimize leakage F_Set_fpa_io_state( DEFAULT_JTAG_3ST, DEFAULT_RESET_3ST, 1 ); //XStreamPro-Iso only //disable pull-up to minimize leakage //max. 10nA leakage F_XS_Update_HW_State(MODE_XS_IO_CLR_FLAGS, IO_PULLUP_EN);
Demo code:
#include <stdio.h> #include <string> #include <iostream> #ifdef FLASHPROM #include "../FlashProM-Dll.h" #endif #ifdef GANGPROM #include "../GangProM-Dll.h" #endif using namespace std; union XS_ADC { double members[ XS_ADC_NUM_MEMBERS ]; struct { double ExtVcc; //actual external Vcc value in V double Vcc; //actual Vcc from programmer value in V double Vpp; //actual Vpp for fuse blown from programmer value in V double ExtVccMin; //external Vcc value in V - min value from the last read up to now double ExtVccMax; //external Vcc value in V - max value from the last read up to now double VccMin; //Vcc value in V - min value from the last read up to now double VccMax; //Vcc value in V - max value from the last read up to now double Icc_mA; //Icc value in mA - current value double Icc_mA_av4; //Icc value in mA - average for last 4 read (interval ~ 10ms) double Icc_mA_av16; //Icc value in mA - average for last 16 read (interval ~ 10ms) double Icc_mA_min; //Icc value in mA - min value from the last read up to now double Icc_mA_max; //Icc value in mA - max value from the last read up to now double Temperature; //Temperature inside XStream in C deg double Icc_mA_av64; //Icc value in mA - average for alpha 1/64 double Icc_mA_av; //Icc value in mA - average for defined alpha 1/N } data; }; int main(int argc, char* argv[]) { int st; string input = "*# *"; if(argc < 3) { cout<< "Usage: <config> <code>" << endl; return 1; } F_Trace_ON(); cout << "F_OpenInstancesAndFPAs : " << dec << F_OpenInstancesAndFPAs((char *)input.c_str()) << endl; cout << "F_Get_FPA_SN : " << F_Get_FPA_SN(1) << endl; cout << "F_Set_FPA_index : " << dec << F_Set_FPA_index (0) << endl; cout << "F_Initialization : " << dec << F_Initialization() << endl; cout << "API Version " << hex << (0xFFF & F_DLLTypeVer()) << endl; cout << "Multi Version " << hex << (0xFFF & F_Multi_DLLTypeVer()) << endl; F_Set_FPA_index(1); cout << "F_ConfigFileLoad : " << dec << F_ConfigFileLoad( argv[1] ) << endl; cout << "F_ReadCodeFile : " << dec << F_ReadCodeFile( argv[2] ) << endl; cout << "F_Clear_Locked_Device : " << dec << F_Clear_Locked_Device() << endl; cout << "F_AutoProgram : " << dec << F_AutoProgram() << endl; F_Trace_OFF(); cout << F_Report_Message() << endl; cout << "Press any key to continue power measurement in infinite loop" << endl; char c = getchar(); F_XS_Clr_ADC_av_history(); F_Set_fpa_io_state( DEFAULT_JTAG_3ST, DEFAULT_RESET_3ST, 1 ); F_XS_Update_HW_State(MODE_XS_IO_CLR_FLAGS, IO_PULLUP_EN); XS_ADC xs_adc; while(1) { F_Get_Power_Results(xs_adc.members); cout << "ExtVcc= " << xs_adc.data.ExtVcc; cout << " Vcc= " << xs_adc.data.Vcc; cout << " Vpp= " << xs_adc.data.Vpp; cout << " ExtVccMin= " << xs_adc.data.ExtVccMin; cout << " ExtVccMax= " << xs_adc.data.ExtVccMax; cout << " VccMin= " << xs_adc.data.VccMin; cout << " VccMax= " << xs_adc.data.VccMax; cout << " Icc_mA= " << xs_adc.data.Icc_mA; cout << " Icc_mA_av4= " << xs_adc.data.Icc_mA_av4; cout << " Icc_mA_av16= " << xs_adc.data.Icc_mA_av16; cout << " Icc_mA_min= " << xs_adc.data.Icc_mA_min; cout << " Icc_mA_max= " << xs_adc.data.Icc_mA_max; cout << " Temperature= " << xs_adc.data.Temperature; cout << " Icc_mA_av64= " << xs_adc.data.Icc_mA_av64; cout << " Icc_mA_av= " << xs_adc.data.Icc_mA_av; cout << endl; cout.flush(); } return 0; }
20. F_Get_Last_Power_Results_data
General Description
This function is almost identical to F_Get_Power_Results
except that the adapter is not queried. The value returned is simply the last value saved in memory from the last F_Get_Power_Results
call.
This function is supported only on XStream-Iso, and XStreamPro-Iso adapters. The USB-FPA 6.1 adapter will return FALSE.
Syntax
INT_X F_Get_Last_Power_Results_data(double *xs_adc);
Input
double *xs_adc : pointer to instance of XS_ADC and doubles array, i.e.
XS_ADC xs_adc; F_Get_Last_Power_Results_data(xs_adc.members); union XS_ADC { double members[ XS_ADC_NUM_MEMBERS ]; struct { double ExtVcc; //actual external Vcc value in V double Vcc; //actual Vcc from programmer value in V double Vpp; //actual Vpp for fuse blown from programmer value in V double ExtVccMin; //external Vcc value in V - min value from the last read up to now double ExtVccMax; //external Vcc value in V - max value from the last read up to now double VccMin; //Vcc value in V - min value from the last read up to now double VccMax; //Vcc value in V - max value from the last read up to now double Icc_mA; //Icc value in mA - current value double Icc_mA_av4; //Icc value in mA - average for last 4 read (interval ~ 10ms) double Icc_mA_av16; //Icc value in mA - average for last 16 read (interval ~ 10ms) double Icc_mA_min; //Icc value in mA - min value from the last read up to now double Icc_mA_max; //Icc value in mA - max value from the last read up to now double Temperature; //Temperature inside XStream in C deg double Icc_mA_av64; //Icc value in mA - average for alpha 1/64 double Icc_mA_av; //Icc value in mA - average for defined alpha 1/N } data; };
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64.
Output
INT_X : result of operation
FALSE (0) : failed - USB-FPA 6.1 adapter detected
TRUE (1) : succeeded - XStream-Iso, and XStreamPro-Iso adapter detected
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
Example
21. F_XS_Clr_ADC_av_history
General Description
Clear values accumulated in measurement history. Useful for resetting long running averages.
This function is supported only on XStream-Iso, and XStreamPro-Iso adapters. The USB-FPA 6.1 adapter will return FALSE.
Syntax
INT_X F_XS_Clr_ADC_av_history();
Input
none.
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : result of operation
FALSE (0) : failed - USB-FPA 6.1 adapter detected
TRUE (1) : succeeded - XStream-Iso, and XStreamPro-Iso adapter detected
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
Example
22. F_XS_Update_HW_State
General Description
Set pull-up resistor mode and current measurement sensitivity.
This function is supported only on the XStreamPro-Iso adapter. The USB-FPA 6.1 and XStream-Iso adapter will return FALSE.
Syntax
INT_X F_XS_Update_HW_State(BYTE mode, INT_X data);
Input
BYTE mode : set, or clear flag
MODE_XS_IO_SET_FLAGS (0x12) - set flag chosen in data
MODE_XS_IO_CLR_FLAGS (0x13) - clear flag chosen in data
INT_X data : bit-wise OR of bits to affect (set or clear)
IO_PULLUP_EN (1) - change pull-up resistor mode, disable for current measurement
FORCE_ICC_LOW_SENSITIVITY (2) - Low Sensitivity only (20uA - 200mA)
FORCE_ICC_HI_SENSITIVITY (4) - Hi Sensitivity only (50nA - 0.6mA)
NOTE: If FORCE_ICC_LOW_SENSITIVITY and FORCE_ICC_HI_SENSITIVITY flags are cleared then adapter is in Automatic (50nA - 200mA) mode. If both flags are set, adapter will default to Low Sensitivity mode.
Automatic mode is generally preferred, but in automatic mode, around 5 samples will be lost if current fluctuations cause the adapter to switch from Hi-to-Low, or Low-to-Hi mode. If the user is only interested in measuring small currents, then setting to Hi Sensitivity is preferred. In Hi Sensitivity mode samples above 0.6mA will saturate at that value. In Low Sensitivity mode samples below 20uA will be noise.
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64.
Output
INT_X : result of operation
FALSE (0) : failed - USB-FPA 6.1, or XStream-Iso adapter detected
TRUE (1) : succeeded - XStreamPro-Iso adapter detected
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
Example
23. F_XS_Current_zeroing
General Description
Calibration function that can be used to improve the results of Current measurement. No targets should be connected to the adapter.
This function is supported only on XStream-Iso, and XStreamPro-Iso adapters. The USB-FPA 6.1 adapter will return FALSE.
Syntax
INT_X F_XS_Current_zeroing( int state, char *txt );
Input
int state: calibration steps, from 0 to 100 (inclusive)
char *txt : comment related to currently executing part of zeroing procedure - the same as it is displayed in GUI
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64.
Output
INT_X : result of operation
FALSE (0) : failed - USB-FPA 6.1 adapter detected
TRUE (1) : succeeded - XStream-Iso, and XStreamPro-Iso adapter detected
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
Example
This code sequence is taken from the LinuxCommandLineDemo installation directory for Linux, however, the same sequence of calls will work in other environments:
The code sequence is as follows:
Find adapters and perform initialization using
F_OpenInstancesAndFPAs((char *)input.c_str())
andF_Initialization()
In this example,
F_Set_FPA_index (0)
is called, which means that all adapters will be initialized.
Select one adapter
F_Set_FPA_index (1)
, in this case FPA-1, since the calibration function cannot be called on all adapters.Perform a sequence of calibration steps, from 0 to 100, and print report messages.
F_XS_Current_zeroing( i, msg );
the msg buffer is written into by the library with status messages. Msg can be printed to follow the calibration process.
This calibration sequence can take several minutes.
Demo code:
#include <stdio.h> #include <string> #include <iostream> #ifdef FLASHPROM #include "../FlashProM-Dll.h" #endif #ifdef GANGPROM #include "../GangProM-Dll.h" #endif using namespace std; int main(int argc, char* argv[]) { int st; string input = "*# *"; cout << "F_OpenInstancesAndFPAs : " << dec << F_OpenInstancesAndFPAs((char *)input.c_str()) << endl; cout << "F_Get_FPA_SN : " << F_Get_FPA_SN(1) << endl; cout << "F_Set_FPA_index : " << dec << F_Set_FPA_index (0) << endl; cout << "F_Initialization : " << dec << F_Initialization() << endl; cout << "API Version " << hex << (0xFFF & F_DLLTypeVer()) << endl; cout << "Multi Version " << hex << (0xFFF & F_Multi_DLLTypeVer()) << endl; F_Set_FPA_index(1); char msg[1000]; for(int i=0; i<=100; i++) { cout << "Step: " << dec << i << " Result: "; cout.flush(); F_XS_Current_zeroing( i, msg ); cout << msg << endl; } return 0; }
24. F_Set_fpa_io_state
General Description
Set state of the Reset, Vcc and JTAG lines after programming is finished.
Syntax
INT_X F_Set_fpa_io_state( BYTE jtag, BYTE reset, BYTE VccOn );
Input
BYTE jtag : set JTAG lines (TMS, TCK, TDI)
DEFAULT_JTAG_3ST (0) : JTAG lines set to tri-state
DEFAULT_JTAG_HI (1) : JTAG lines set to Vcc
DEFAULT_JTAG_LO (2) : JTAG lines set to GND
BYTE reset : set reset line
DEFAULT_RESET_LO (0) : reset line set to GND
DEFAULT_RESET_HI (1) : reset line set to Vcc
DEFAULT_RESET_3ST (2) : reset line to tri-state
BYTE VccOn : set Vcc line from adapter
0 : set to tri-state
1 : set to configured Vcc (configuration parameter VccFromFPAin mV)
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : result of operation
FALSE (0) : failed
TRUE (1) : succeeded
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
25. F_Get_Sector_Size
General Description
Will return the segment/sector size for memory region that contains given address. This function will access the FPA’s meta-data for the target device specified in configuration options. No communication with target device actually takes place.
Syntax
INT_X F_Get_Sector_Size( INT_X address );
Input
INT X address : address contained by segment/sector
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : result of operation
FALSE (0) : address out of range
positive number : actual sector size
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range