No part of this document may be reproduced without the prior written consent of Elprotronic Inc.
The information in this document is subject to change without notice and does not represent a
commitment on any part of Elprotronic Inc. While the information contained herein is assumed to
be accurate, Elprotronic Inc. assumes no responsibility for any errors or omissions.
In no event shall Elprotronic Inc, its employees or authors of this document be liable for special,
direct, indirect, or consequential damage, losses, costs, charges, claims, demands, claims for lost
profits, fees, or expenses of any nature or kind.
The software described in this document is furnished under a licence and may only be used or copied
in accordance with the terms of such a licence.
Disclaimer of warranties: You agree that Elprotronic Inc. has made no express warranties to You
regarding the software, hardware, firmware and related documentation. The software, hardware,
firmware and related documentation being provided to You “AS IS” without warranty or support
of any kind. Elprotronic Inc. disclaims all warranties with regard to the software, express or implied,
including, without limitation, any implied warranties of fitness for a particular purpose,
merchantability, merchantable quality or noninfringement of third-party rights.
Limit of liability: In no event will Elprotronic Inc. be liable to you for any loss of use, interruption
of business, or any direct, indirect, special incidental or consequential damages of any kind
(including lost profits) regardless of the form of action whether in contract, tort (including
negligence), strict product liability or otherwise, even if Elprotronic Inc. has been advised of the
possibility of such damages.
2
END USER LICENSE AGREEMENT
PLEASE READ THIS DOCUMENT CAREFULLY BEFORE USING THE SOFTWARE AND
THE ASSOCIATED HARDWARE. ELPROTRONIC INC. AND/OR ITS SUBSIDIARIES
(“ELPROTRONIC”) IS WILLING TO LICENSE THE SOFTWARE TO YOU AS AN
INDIVIDUAL, THE COMPANY, OR LEGAL ENTITY THAT WILL BE USING THE
SOFTWARE (REFERENCED BELOW AS “YOU” OR “YOUR”) ONLY ON THE CONDITION
THAT YOU AGREE TO ALL TERMS OF THIS LICENSE AGREEMENT. THIS IS A LEGAL
AND ENFORCABLE CONTRACT BETWEEN YOU AND ELPROTRONIC. BY OPENING THIS
PACKAGE, BREAKING THE SEAL, CLICKING “I AGREE” BUTTON OR OTHERWISE
INDICATING ASSENT ELECTRONICALLY, OR LOADING THE SOFTWARE YOU AGREE
TO THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO
THESE TERMS AND CONDITIONS, CLICK ON THE “I DO NOT AGREE” BUTTON OR
OTHERWISE INDICATE REFUSAL, MAKE NO FURTHER USE OF THE FULL PRODUCT
AND RETURN IT WITH THE PROOF OF PURCHASE TO THE DEALER FROM WHOM IT
WAS ACQUIRED WITHIN THIRTY (30) DAYS OF PURCHASE AND YOUR MONEY WILL
BE REFUNDED.
1. License.
The software, firmware and related documentation (collectively the “Product”) is the property of
Elprotronic or its licensors and is protected by copyright law. While Elprotronic continues to own
the Product, You will have certain rights to use the Product after Your acceptance of this license.
This license governs any releases, revisions, or enhancements to the Product that Elprotronic may
furnish to You. Your rights and obligations with respect to the use of this Product are as follows:
YOU MAY:
A.use this Product on many computers;
B.make one copy of the software for archival purposes, or copy the software onto the hard disk
of Your computer and retain the original for archival purposes;
C.use the software on a network
YOU MAY NOT:
A.sublicense, reverse engineer, decompile, disassemble, modify, translate, make any attempt
to discover the Source Code of the Product; or create derivative works from the Product;
B.redistribute, in whole or in part, any part of the software component of this Product;
3
C.use this software with a programming adapter (hardware) that is not a product of
Elprotronic Inc or Texas Instruments Inc.
2. Copyright
All rights, title, and copyrights in and to the Product and any copies of the Product are owned by
Elprotronic. The Product is protected by copyright laws and international treaty provisions.
Therefore, you must treat the Product like any other copyrighted material.
3. Limitation of liability.
In no event shall Elprotronic be liable to you for any loss of use, interruption of business, or any
direct, indirect, special, incidental or consequential damages of any kind (including lost profits)
regardless of the form of action whether in contract, tort (including negligence), strict product
liability or otherwise, even if Elprotronic has been advised of the possibility of such damages.
4. DISCLAIMER OF WARRANTIES.
You agree that Elprotronic has made no express warranties to You regarding the software, hardware,
firmware and related documentation. The software, hardware, firmware and related documentation
being provided to You “AS IS” without warranty or support of any kind. Elprotronic disclaims all
warranties with regard to the software and hardware, express or implied, including, without
limitation, any implied warranties of fitness for a particular purpose, merchantability, merchantable
quality or noninfringement of third-party rights.
4
This device complies with Part 15 of the FCC Rules.
Operation is subject to the following two conditions:
(1) this device may not cause harmful interference and
(2) this device must accept any interference received,
including interference that may cause undesired
operation.
NOTE: This equipment has been tested and found to comply with the limits for a Class B digital devices,
pursuant to Part 15 of the FCC Rules. These limits are designed to provide reasonable protection against harmful
interference in a residential installation. This equipment generates, uses, and can radiate radio frequency energy
and, if not installed and used in accordance with the instruction manual, may cause harmful interference to
radio communications. However, there is no guarantee that interference will not occur in a particular
installation. If this equipment does cause harmful interference to radio or television reception, which can be
determined by turning the equipment off and on, the user is encouraged to try to correct the interference by one
of more of the following measures:
*Reorient or relocate the receiving antenna
*Increase the separation between the equipment and receiver
*Connect the equipment into an outlet on a circuit different from that to which the receiver is connected
*Consult the dealer or an experienced radio/TV technician for help.
Warning: Changes or modifications not expressly approved by Elprotronic Inc. could void the user’s authority
to operate the equipment.
This Class B digital apparatus meets all requirements of the Canadian
Interference-Causing Equipment Regulations.
Cet appereil numerique de la classe B respecte toutes les exigences du
Reglement sur le material brouilleur du Canada.
MSP430FPA1.dll- required if the USB-MSP430-FPA adapter is used
MSPFET430UIF1.dll- required if the TI’s MSP-FET430UIF is used
config.ini- (optional) default configuration file for the FPAs
The FlashPro-Multi-FPA-Demo.exe program contains GUI (Figure 2.3) that allows to activate
one or more Flash Programming Adapters (FPA), TI’s MSP-FET430UIF adapter or mixed like in
an example below - USB-MSP430-FPA and MSP-FET430UIF adapters . When one adapter is used
then the button Open Instances And FPA (“*# *”) should be pressed. The first detected FPA
24
adapter connected to USB port(s) will be activated. If the USB-MSP430-FPA adapter is not present,
then software is searching for the MSP-FET430UIF adapter. If more then one adapter are connected,
then only fisrt will be used, all others adapters will be ignored. When the adapter is accepted by
software, then the 1. Initialization button must be pressed. When the 1. Initialization button is
pressed then communication with the programming adapter is initialized. Now the desired
configuration setup should be downloaded to DLLs and programming adapters (using button ‘2.
Setup File’ ), code file with data to be downloaded to target devices (using button ‘3. Open Code’)
Figure 2.4 Demo program dialogue screen using DLLs.
and password file, if required (using button ‘Open Password’ ). Setup file can be created using
standard FlashPro430 programming software. Setup file used in the FlashPro430 has the same
format as the configuration file used in the application DLL.
25
All other buttons used in the demo program are calling one API-DLL function per one button.
For example button ‘Autoprogram’ is calling
F_Autoprogram(1);
function, button ‘Open Target’ is calling
F_OpenTarget();
function etc. Using any button pressing sequence it is possible to test how the application dll is
responding for these combinations. Some of the buttons assigning extra data to be able to simulate
some write/erase procedures as follows.
*button ‘Erase segment’ allows to erase segment located on address 0x1000 to 0x107F.
*button ‘Blank Check Segm.’ allows to check the segment defined in the ‘Erase segment’
button.
*button ‘Write Flash Block’ allows to write block data
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08
to flash location starting from 0x1020.
*button ‘Read Flash Block’ allows to read data from flash addresses 0x1000 to 0x103F.
When the check mark named ‘Use address/data from example (see manual) ’ in the ‘Edit’ frame
is unmarked, then edit fields becomes active and addresses to the function described above can
customized and defined in the ‘RAM Address (HEX)’ or ‘Flash Address (HEX)’. Content of data
can be specified in the ‘Data (HEX)’ field. All data should be separated by white character (space).
Maximum size data should be specified in the ‘size (max 32 bytes)’ fields (RAM or Flash).
When any button related to encapsulated functions is used ( ‘Autoprogram’, ‘Erase Flash’, ‘Blank
Check’, ‘Write Flash’, ‘Verify Flash’ ) then data taken from the code file is used ( press button ‘3.
Open Code’ to take desired code data).
Described demo program allows to understand how to use the dll functions in the application
software.
When more then one adapter is connected to PC, then the Multi-FPA API-DLL feature should be
activated. Currently up to 64 adapters can be controlled from one application software. For simplicity
the presented demo program can control up to eight adapters only. The Multi-FPA API-DLL can
assign specified FPA serial number to desired FPA index or specified COM port or eq. serial number
for the MSP-FET430UIF, where index can be from 1 up to 64 (1 to 8 in presented demo software).
At the startup software is scanning all available FPAs and MSP-FET430UIFs and assigning adapters
according to defined FPA’s serial number list. See the F_OpenInstancesAndFPAs(..) Instruction for
details. Configuration will be always the same regardless used the FPA vs USB port location. All
26
adapters not specified in the desired FPA list will be ignored. Make sure that the desired list uses
correct FPAs serial numbers. The FPA serial number is printed in the FPA’s label. When the MSP-
FET430UIF is used then check the assigned port for particular adapter (use FET-Pro430 software
for it) or use the UIF definition to accept any UIF-MSP430UIF adapter. Note, that only one MSP-
FET430UIF can be used, so definition UIF can be used for simplicity.
Assume, that we are using one USB-MSP430-FPA programming adapter and one MSP-FET430UIF
adapter. In the next step, the configuration file should be created, that contains list off all FPA’s used
in the application. Using the Notepad editor open the default FPA’s configuration file ‘FPAs-
setup.ini’ taken from your destination location (copied before from Elprotronic’s directory) and write
the serial numbers or IDs of used adapters. Take a serial numbers from the FPAs labels and write
it on the desired FPAs locations FPA-1 up to FPA-8. For two adapters as above the configuration
file can use an IDs - FPA and UIF only as follows:
;===================================================================
; USB-MSP430-FPA configuration setup *
; Elprotronic Inc. *
;------------------------------------------------------------------; up to eight FPA can be specified and connected via USB to PC *
; syntax: *
; FPA-x Serial Number *
; where FPA-x can be FPA-1, FPA-2, FPA-3 .... up to FPA-8 *
; Serial number - get serial number ir ID from the desires *
; adapter's label *
; Minimum one FPA's must be specified *
; FPA-x order - any *
; *
; e.g (without semicolon - comment) *
; Available options for Elprotronic's FPA's: *
; ANY adapter FPA or UIF - * *
; or ANY FPA adapter - FPA *
; or FPA with serial number only eg. - 20080123 *
; *
; Available options for TI's MSP-FET430UIF *
; ANY adapter FPA or UIF - * *
; or ANY UIF adapter - UIF *
; or UIF used COM x port - COM4 *
; or UIF used HID x port - HID3 *
; *
;FPA-1 20050116 *
;FPA-3 20050199 *
;FPA-5 20050198 *
;===================================================================
FPA-1 FPA
FPA-2 UIF
27
Note, that only lines without comments (without semicolon on the front ) are used by software. All
lines with comment are ignored. The FPA’s serial numbers and FPA’s indexes can be listed in any
order and with gap like FPA-1, FPA-5 etc. without FPA-2, 3 etc. Minimum one valid FPA with
correct ID or SN must be specified. Up to sixteen adapters can be declared. When the FPA’s
configuration file is created then file should be saved using name starting from FPA and with
extention ini e.g FPAs-setup.ini.
Connect all required adapters to USB connectors and run the FlashPro-Multi-FPA-Demo.exe demo
software. First the DLL instances should be opened and all connected FPA’s should be assigned to
desired FPA’s indexes. When the button ‘FPA assigment’ is pressed, then the DLL function named
F_OpenInstancesAndFPAs( FileName );
is called. This function is taking list of defined FPA’s numbers or IDs from the FPAs configuration
file and assigning all adapters to desired FPA indexes (1 to64). Number of instances to be opened
is calculated automatically, one per available and valid adapter. On described example with two
asdapters in the ‘FPAs selector’ will display two valid adapters with list of used FPAs’ serial
numbers or COM port for the MSP-FET430UIF. All, others FPA-x fields will be disabled. In this
example only two DLL instances becomes opened. Valid FPA indexes becomes 1,2 and ALL.
When the dll instances becomes opened and FPA adapter assigned to desired FPA’s indexes, then
the initialization procedure F_Initialization() must be called. It is recommended to initialize all
opened instances by calling function
F_Set_FPA_index(ALL_ACTIVE_FPA);
when more then one FPA adapter is used, or
F_Set_FPA_index(1);
when one FPA (assigned to index 1 by default) is used
prior to initialization function
F_Initialization();
On the demo program initialization procedure all these procedures are called when the button ‘1.
Initialization’ is pressed. Now adapters are ready to take other commands. In the demo above the
‘Autoprogram’ button has been used to download code simultaneously to two target devices
MSP430F1232 via two types of programming adapters - USB-MSP430-FPA and TI’s MSP-
FET430UIF. See programming report in the Report window - under FPA-#1 report taken from first
adapter, and under FPA #2 - report taken from the second adapter. In reality always the same type
adapters will be used, but this example showing flexibility of the API-DLL, that allows to swap
adapters and use application software with different adapters without modifying an application
software.
28
3. Example with API DLL
3.1 Example with single FPA
The code example described below uses one programming adapter. The Multi-FPA API-DLL
selector should be select for FPA-1 only. The fpa_index should be set to 1 or should be unmodified.
The default value of the fpa_index when one adapter is detected only is 1.
Initialization opening procedure for the USB-FPA can be as follows:
response = F_OpenInstancesAndFPAs( “*# *” );
// DLL and FPA (one only) initialization
if( response == 0 )
{
//The FPA has not been found. Exit from the program.
{
//The FPA has not been found. Exit from the program.
}
F_Set_FPA_index( 1 ); // select FPA 1 only
F_Initialization( ); // init FPA
//– functions above initialized at the startup only --- F_ReadConfigFile( filename ); // read configuration data and save
// to API-DLLs
F_ReadCodeFile( format, filename ); // read code data and save to DLL
do
{
status = F_AutoProgram( 1 );//start autoprogram
if ( status != TRUE )
{
..............................
}
else
29
{
................................................
}
} while(1); //make an infinite loop until last target device programmed
{
//The FPA has not been found. Exit from the program.
}
F_Set_FPA_index( ALL_ACTIVE_FPA ); // select all FPA’s
F_Initialization( ); // init all FPA’s
F_ReadConfigFile( filename ); // read configuration data and save
// to all API-DLLs
F_ReadCodeFile( format, filename ); // read code data and save to all
// API-DLLs
do
{
status = F_AutoProgram( 1 );
//start autoprogram-to program all targets simultaneously with
//the same downloaded data to all target devices.
if ( status != TRUE )
{
if ( status == FPA_UNMACHED_RESULTS )
{
for (n=1; n<=MAX_FPA_INDEX; n++ ) status[n] = = F_LastStatus( n);
................................................
}
else
{
................................................
}
}
} while(1); //make an infinite loop until last target device programmed
See source code in the DEMO program written in Visual C++, Visual Basic or LabView for more
detail.
32
4. List of the DLL instructions
Application DLLs files are the same for the application software written under Visual C++,
Visual Basic, LabView etc. From that reason the API-DLL not transfers the pointers from the API-
DLL to application, because Visual Basic (or other software) will not be able to use these functions.
When a lot of data are transferred from API-DLL to application, then these data should be read item
by item.
All DLL instructions are divided to four groups - related to Multi-FPA selector, single FPA
generic, single FPA encapsulated and single FPA sequential instructions. Multi-FPA specific
instructions are related to the Multi-FPA DLL only. Generic instructions are related to initialization
programmer process, while encapsulated and sequential instructions are related to target device’s
function. Encapsulated and sequential instructions can write, read, and erase contents of the target
device’s flash memory.
Multi-FPA specific instructions are related to load and release the single-FPA dlls, selection
of the transparent path and sequential/simultaneous instructions transfer management. All other
instructions are related to single FPAs.
Generic instructions are related to initialization programmer process, configuration setup and
data preparation, Vcc and Reset to the target device. Generic instructions should be called first,
before encapsulated and sequential instruction.
Encapsulated instructions are fully independent executable instructions providing access to
the target device. Encapsulated instructions can be called at any time and in any order. When called
then all initialization communication with the target device is starting first, after that requested
function is executed and at the end communication with the target device is terminated and target
device is released from the programming adapter.
The encapsulated functions should be mainly used for programming target devices. These
functions perform most tasks required during programming in an easy to use format. These functions
use data provided in Code Files, which should be loaded before the encapsulated functions are used.
To augment the functionality of the encapsulated functions, sequential functions can be executed
immediately after to complete the programming process.
33
Sequential instructions allow access to the target device in a step-by-step fashion. For
example, a typical sequence of instructions used to read data from the target device would be to open
the target device, then read data and then close the target device. Sequential instruction have access
to the target device only when communication between target device and programming adapter is
initialized. This can be done when Open Target Device instruction is called. When communication
is established, then any number of sequential instruction can be called. When the process is finished,
then at the end Close Target Device instruction should be called. When communication is
terminated, then sequential instructions can not be executed.
Note: Inputs / outputs has been defined as INP_X, and LONG_X. Both of them are defined as 4
bytes long (see MSPPrg-Dll.h header file )
#define INP_X _int32
#define LONG_X _int32
Make sure that an application using the DLL file has the same length of desired data.
Figure 4.1 shows the structure of the Multi-FPA API-DLL. It shows that the Multi-FPA DLL is used
to communicate with the user application as well as the target devices. Each of the target devices is
accessed by a single DLL associated with it. When more then one FPA is needed, up to 64 DLLs can
be created to communicate with up to 64 devices at a time. Each instance of an FPA-DLL contains
its own copy of buffers, as shown in Figure 4.2
Figure 4.1 Multi-FPA API-DLL diagram.
34
Figure 4.2 - API-DLL block diagram.
35
4.1 Multi-FPA instructions
The Multi-FPA API-DLL instructions are related to Multi-FPA selector only. These
instructions allows to initialize all single applications dlls and select the instruction patch between
application software and desired FPA and sequential/simultaneous instructions transfer management
Up to sixteen independent FPAs can be remotely controlled from the application software. All
instructions from application software can be transferred to one selected FPA or to all FPAs at once.
That feature allows to increase programming speed and also allows to have individual access to any
FPA is required.
F_Trace_ON
F_Trace_ON - This function activate the tracing.
The F_Trace_ON() opens the DLLtrace.txt file located in the current directory and records all API-
DLL instructions called from the application software. This feature is useful for debugging. When
debugging is not required then tracing should be disabled. Communication history recorded in the
in the last session can be viewed in the DLLtrace.txt located in the directory where the API-DLL
file is located. When the new session is established then the file DLLtrace.txt is erased and new
trace history is recorded.
Note: Tracing is slowing the time execution, because all information passed from application
software to API-DLL are recorded in the dlltrace.txt file.
Syntax:
void MSPPRG_APIF_Trace_ON( void );
F_Trace_OFF
F_Trace_OFF- Disable tracing, See F_Trace_ON for details.
Syntax:
void MSPPRG_APIF_Trace_OFF( void );
36
F_OpenInstances
F_OpenInstances - API-DLL initialization in the PC.
Instruction must be called first - before all other instruction. Instead this function the
F_OpenInstancesAndFPAs is recommended.
Important:It is not recommended to use this function. Function used only for compatible with
the old software. Use the F_OpenInstancesAndFPAs instead.
Do not use the F_OpenInstances or F_Check_FPA_access after using the
F_OpenInstancesAndFPAs. The F_OpenInstancesAndFPAs is assigning the FPAs to
USB ports and it is not recommended to reassign once again the USB port using the
F_Check_FPA_access function. To check the communication activity with FPA use the
F_Get_FPA_SN function that allows to check te communication with the FPA adapter
without modifying the USB ports assignment.
DO NOT use this instruction for activating connection with the MSP-FET430UIF adapter.
Use the F_OpenInstancesAndFPAs for it.
Syntax:
INT_XMSPPRG_APIF_OpenInstances ( BYTE no );
Parameters:
no -> number of the single API-DLL to be open
no -> 1 to MAX_USB_DEV_NUMBER
where MAX_USB_DEV_NUMBER = 64
Return value:
number of opened instances
F_CloseInstances
F_CloseInstances - Close all active API-DLLs and free system memory.
Syntax:
INT_XMSPPRG_APIF_CloseInstances ( void );
Parameters:
void
Return value:
TRUE
37
F_OpenInstancesAndFPAs, F_OpenInstances_AndFPAs
F_OpenInstancesAndFPAs - API-DLL initialization in the PC and programming adapters
or F_OpenInstances_AndFPAsscan and assignment to desired USB port according to
contents of the FPA’s list specified in the string or FPA’s
configuration file.
Instruction must be called first - before all other instruction. Function is opening the number
of the desired API-DLL and assigning the desired adapters to available USB ports. Regardless of the
USB port open sequence and connection of the USB-FPA or MSP-FET430UIF to USB ports, the
F_OpenInstancesAndFPAs instruction is reading the FPA’s list, scanning all available adapters
connected to any USB ports and assigning the indexes to all adapters according to contents of the
FPA list (from string or configuartion file). All adapters not listed in the FPA configuration file and
connected to USB ports are ignored.
Important:Do not use the F_Check_FPA_access after using the F_OpenInstancesAndFPAs.
The F_OpenInstancesAndFPAs is assigning the FPAs to USB ports and it is not
Syntax:
INT_XMSPPRG_APIF_OpenInstancesAndFPAs( char * List );
INT_XMSPPRG_APIF_OpenInstances_AndFPAs( CString List );
Parameters:
1. When the first two characters in the List string are *#, then reminding characters of the
string contain a list of desired FPAs serial numbers or IDs assigned to FPA-1, -2, ...-n
indexes, eg.
2. When the first two characters in the List string are not *#, then the string contain file name
or full path of the file with a list of the FPA’s serial numbers, eg.
Return value:
number of opened instances
recommended to reassign once again the USB port using the F_Check_FPA_access
function. To check the communication activity with FPA use the F_Get_FPA_SN
function that allows to check te communication with the FPA adapter without
modifying the USB ports assignment.
“*# 20060123, 20060234, 20060287"
“C:\Program Files\Elprotronic\FPAs-setup.ini”
38
1. The FPA list in the string:
String -> “*# SN1, SN2, SN3, SN4, SN5...”
Where the
SN1- FPA’s serial number that should be assigned to FPA-1 index
SN2- FPA’s serial number that should be assigned to FPA-2 index
etc.
As a delimiter the comma ‘,’ or white space ‘ ’ can be used.
Example:
“*# 20060123, 20060346, 20060222, 20060245"
or
“*# 20060123 20060346 20060222 20060245"
List of the acceptable numbers or IDs for USB-MSP430_FPA adapters:
1. FPAs serial number - 8 digits eg. 20060222
eg, “*# 20060123 20060346 20060222 20060245"
Four USB-MSP430-FPA will be used with SN as listed above
FPA-1 20060123
FPA-2 20060346
FPA-3 20060222
FPA-4 20060245
If from any reason the listed adapter is not found, then the FPA-x becomes empty. All other
adapters will have the same FPA-x indexes as specified in the list eg if the FPA SN is
missing, then only the FPA-3 will be empty. The FPA-4 will have the same position as
before.
FPA-1 20060123
FPA-2 20060346
FPA-3 Empty
FPA-4 20060245
2. ID FPA- to select any USB-MSP430-FPA only. No FPA’s serial number can be
specified after this definition.
eg, “*# 20060123 20060346 20060222 FPA"
Last one will be an any adapter USB-MSP430-FPA not listed before.
3. ID ‘*’- to select any adapter - USB-MSP430-FPA or MSP-FET430UIF. No other
adapters can be specified after this definition.
39
eg, “*# 20060123 20060346 20060222 *"
Last one will be any adapter USB-MSP430-FPA or MSP-FET430UIF not listed before.
List of the acceptable numbers or IDs for the MSP-FET430UIF adapter:
When the MSP-FET430UIF adapter is used, then fro compatibility with the USB-MSP430-
FPA adapters software is assigning the serial number for these adapters. Serial number for
these adapters is created with following formula
SN = 20010000 + 200 * HID + 100 * COM + port_number
For example if adapter is using COM port # 6 then the eq. serial number is calculated as
SN = 20010000 + 200 * 0 + 100 * 1 + 6 = 20010106
Assigned serial number allows to use application software without modification for the USB-
MSP430-FPA and MSP-FET430UIF adapters. No modification of the application software
is required. However, for simplicity the current API-DLL software can accept also other,
more convenient definition for the MSP-FET430UIF adapters .
1. FPAs serial number - 8 digits eg. 20010106
eg, “*# 20060123 20060346 20060222 20010106"
Four USB-MSP430-FPA will be used with SN as listed above
FPA-1 20060123- USB-MSP430-FPA
FPA-2 20060346- USB-MSP430-FPA
FPA-3 20060222- USB-MSP430-FPA
FPA-4 20010106- MSP-FET430UIF
2. ID UIF- to select any MSP-FET430UIF only. No UIF’s serial number can be
specified after this definition.
eg, “*# 20060123 20060346 20060222 UIF"
Last one will be an any adapter MSP-FET430UIF.
eg, “*# UIF"
The MSP-FET430UIF adapter only.
3. ID ‘*’- to select any adapter - USB-MSP430-FPA or MSP-FET430UIF. No other
adapters can be specified after this definition.
eg, “*# 20060123 20060346 20060222 *"
Last one will be any adapter USB-MSP430-FPA or MSP-FET430UIF not listed before.
Note:If it is used one any MSP-FET430UIF adapter, then it is recommended to use definition “*# UIF"
instead “*# *". With the first definition software will search only the MSP-FET430UIF adapter. With
the second definition software will search the USB-MSP430-FPA adapter first, and if this adapter is
40
not found, then the MSP-FET430UIF will be searched. So - the first declaration is faster, the second
is slower, but more universal - any adapter can be used without definition modification
Initialization examples:
1.F_OpenInstances_AndFPAs( “*# *” ); // only one any adapter
or
2.F_OpenInstances_AndFPAs( snlist ); // hardcoded SN list
The FPA list can be specified in the file using the same rules as the definitions described above.
Each defined adapter is listed after FPA-index s below eg:
;===================================================================
; USB-MSP430-FPA configuration setup *
; Elprotronic Inc. *
;------------------------------------------------------------------; up to eight FPA can be specified and connected via USB to PC *
; syntax: *
; FPA-x Serial Number *
; where FPA-x can be FPA-1, FPA-2, FPA-3 .... up to FPA-8 *
; Serial number - get serial number ir ID from the desires *
; adapter's label *
; Minimum one FPA's must be specified *
; FPA-x order - any *
; *
; e.g (without semicolon - comment) *
; Available options for Elprotronic's FPA's: *
; ANY adapter FPA or UIF - * *
; or ANY FPA adapter - FPA *
; or FPA with serial number only eg. - 20080123 *
; *
; Available options for TI's MSP-FET430UIF *
; ANY adapter FPA or UIF - * *
; or ANY UIF adapter - UIF *
; or UIF used COM x port - COM4 *
; or UIF used HID x port - HID3 *
; *
;FPA-1 20050116 *
;FPA-3 20050199 *
;FPA-5 20050198 *
;===================================================================
FPA-1 20060123
FPA-2 20070234
41
; NotePad editor can be used to create the FPA configuration file.
When the ‘*’ is used instead FPA’s SN, then any FPA will be accepted. The ‘*’ can be used only
once and on the end of the FPA’s list eg.
FPA-1 20050116
FPA-2 20050199
FPA-3 *
or
FPA-1 *
when only one adapter (any adapter) is used.
Example:
1. Only one FPA is used:
F_OpenInstancesAndFPAs( “*# *” ); //DLL startup and FPA assignment
//by default - FPA-1 is selected.
//The F_Set_FPA_index(1) is not required.
F_Initialization(); //FPA 1 initialization
F_ReadConfigFile( filename ); //download configuration to DLLs.
F_ReadCodeFile( format, filename ); //download code file to DLLs.
do
{
status = AutoProgram(1);//start autoprogram
if( status != TRUE )
{
// service software when results from FPAs are not the same
}
else
{
}
.......................
{
.......................
} while(1);
F_CloseInstances();
// release DLLs from memory
2. More then one FPA is used.
F_OpenInstancesAndFPAs( FPAs-setup.ini );
//DLL startup and FPA assignment
F_Set_FPA_index (ALL_ACTIVE_FPA);
//select all available FPAs
F_Initialization();
//init all FPAs
42
F_ReadConfigFile( filename );
//download the same configuration to all DLLs.
F_ReadCodeFile( format, filename );
//download the same code file to all DLLs.
do
{
status = AutoProgram(1);
//start autoprogram to all FPAs simultaneously.
if( status != TRUE )
{
if( status == FPA_UNMATCHED_RESULTS )
{
// service software when results from FPAs are not the same
}
else
{
}
.......................
{
.......................
} while(1);
F_CloseInstances();
// release DLLs from memory
F_Set_FPA_index
F_Set_FPA_index - Select desired FPA index (desired DLL instance)
VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs).
Syntax:
INT_XMSPPRG_APIF_Set_FPA_index ( BYTE fpa );
Parameters:
fpa -> 1 to MAX_FPA_INDEX where MAX_FPA_INDEX = 64
or 0 -> ALL_ACTIVE_FPA
note: instead of ‘0' value it can be used global defined
ALL_ACTIVE_FPA that is defined as
#define ALL_ACTIVE_FPA 0
in the header file
Return value:
TRUE - if used fpa index is valid
FPA_INVALID_NO - if used fpa index is not activated or out of range
note: FPA_INVALID_NO -> -2 (minus 2)
43
IMPORTANT:When any function is trying to access the invalid FPA, then return value
from this function is -2 (FPA_INVALID_NO)
Note:When index ALL_ACTIVE_FPA (0) is used, then all data can be transferred from application to all active
FPA’s (API-DLLs). However, when the data is transferred from FPA (or API-DLLs) to the application, then
the FPA index CANNOT be ALL_ACTIVE_FPA (0). Index must select desired FPA. When the simultaneous
process is required eg. reading flash contents from all target devices, then the F_Copy_All_Flash_to_Buffer()
should be called after the F_Set_FPA_index( ALL_ACTIVE_FPA ). When finished, the contents of each
buffer (inside each API-DLLx) can be read using the F_Set_FPA_index( 1 ), F_Set_FPA_index( 2 ) ....., and
F_Get_Byte_from_Buffer(..). See below.
F_Set_FPA_index (ALL_ACTIVE_FPA); //select all available FPAs
F_Copy_All_Flash_to_Buffer(); //simultaneous process
}
F_CloseInstances();// DLL initialization - one instance
F_OpenInstances( n );// Open ‘n’ instances - one per FPA
// Find desired FPAs SN and assign the FPAs serial number every time to the same
// FPA-index.
// For example if the
// SN[1]= 20060123
// SN[2]= 20060147
// SN[3]= 0- adapter not present
// SN[4]= 20060135
// and desired assignment
// FPA-1 20060123
// FPA-2 20060135
// FPA-3 20060147
// then following sequence instructions can be used
F_Set_FPA_index( 1 ); // select access to the first instance
F_Check_FPA_access( 1 ); //assign FPA SN[1] = 20060123 to FPA-1
F_Set_FPA_index( 2 ); // select access to the second instance
F_Check_FPA_access( 4 ); //assign FPA SN[4] = 20060135 to FPA-2
F_Set_FPA_index( 3 ); // select access to the third instance
F_Check_FPA_access( 2 ); //assign FPA SN[2] = 20060147 to FPA-3
F_Set_FPA_index( ALL_ACTIVE_FPA ); // select all active instances
F_Initialization()// All FPAs initialization
............................
F_Initialization
F_Initialization - Programmer initialization.
VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed sequentially.
49
F_Initialization function should be called after the communication with the FPA adapter is
established. To make a Multi-FPA software back compatible, the F_Initialization procedure is calling
the function F_OpenInstancesAndFPAs(“*# *”) if none of the instances has not been activated
before. Also the FPA index is selected to 1 by default. That allows to use old application software
without calling the new type of Multi-FPA functions.
When the F_Initialization is called then:
-all internal data is cleared or set to the default value,
-initial configuration is downloaded from the config.ini file,
-USB driver is initialized if has not been initialized before.
Programming adapter must be connected to the USB to establish communication between PC and
programming adapter. Otherwise the F_Initialization will return FALSE result.
VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed sequentially.
The F_ConfigSetup can modify configuration of the programmer. When the F_ConfigSetup is called,
then the structure data block is transferred from the software application to the programmer software.
Current programmer setup can be read using function setup F_GetSetup. When data block is taken
from the programmer, then part or all of the configuration data can be modified and returned back
to programmer using F_ConfigSetup function. Configuration data structure and available data for
all listed items in this structure are defined below. Listed name and indexes in the [] brackets are
related to the F_SetConfig and F_GetConfig instructions.
Note: See the MSPPRG-Dll.h header file for the list of the latest indexes,
definitions etc.
NoteCurrently number of parameters used in configuration exceed the structure
created for this goal. The configuration structure is not modified that
allows to use the new API-DLL with customer’s old application software
without modifying it. The new API-DLL is back-compatible with the old
ones. The new configuration data are accessible via F_SetConfig and
F_GetConfig instructions.
etc.
See the latest MSP430 list and indexes in the FlashPro430 (GUI) software.
Run software -> list available under pull down menu
Setup-> MSP list
Also the MCU index and MCU names can be taken from the instruction
F_Get_Device_Info(). See description of this instruction in this manual
for details.
[ CFG_POWERTARGETEN 2 ]
PowerTargetEn- Power Target from the Programming Adapter
0 - disable
1 - enable
[ CFG_COMMSPEED 3 ]
CommSpeedIndex- BSL communication speed
COMM_SPEED_9k6_INDEX0
COMM_SPEED_75k_INDEX1- 90 kB/s -> USB
COMM_SPEED_300k_INDEX2- 350kb/s -> USB
[ CFG_RESETTIME 4 ]
ResetTimeIndex- Reset Pulse time setup
RESET_50MS_INDEX0- USB->10ms, PP->50ms Reset Pulse time
RESET_100MS_INDEX1- 100 ms Reset Pulse time
RESET_200MS_INDEX2- 200 ms Reset Pulse time
RESET_500MS_INDEX3- 500 ms Reset Pulse time
RESET_CUSTOM_INDEX4
RESET_TOGGLE_VCC_INDEX5
RESET_SOFT_JTAG_INDEX6
[ CFG_FLASHERASEMODE 5 ]
FlashEraseModeIndex- Flash Write/Erase/Verify mode index
ERASE_NONE_MEM_INDEX 0 - Write and verify only. No erase flash
ERASE_ALL_MEM_INDEX 1 - Erase/Write/Verify all memory
ERASE_PRG_ONLY_MEM_INDEX 2 - Erase/Write/Verify program memory only
(without info segments A abd B)
56
ERASE_INFILE_MEM_INDEX 3 - Erase only segments used by the code taken
from the file.
Leave other segment unmodified.
ERASE_DEF_CM_INDEX 4 - Erase/Write/Verify only specified by data
READ_ALL_MEM_INDEX0- Read all Flash memory
READ_PRGMEM_ONLY_INDEX1- Read only program memory (0x1100-0x1FFFF)
READ_INFOMEM_ONLY_INDEX 2- Read only Info Flash memory (0x1000-
0x10FF)
READ_DEF_MEM_INDEX3- Read Flash memory defined by
ReadSegmA, B, C, D
ReadStartAddr and ReadStopAddr
[ CFG_READINFOA 11 ]
57
ReadSegmA- Read from the Info Segment A
[ CFG_READINFOB 12 ]
ReadSegmB- Read from the Info Segment B
[ CFG_READINFOC 22 ]
ReadSegmC- Read from the Info Segment B
[ CFG_READINFOC 23 ]
ReadSegmD- Read from the Info Segment B
if FlashReadModeIndex = READ_DEF_MEM_INDEX
[ CFG_READSTARTADDR 13 ]
ReadStartAddr0x1100 to 0x1FFFE ;see above
[ CFG_READSTOPADDR 14 ]
ReadStopAddr0x1101 to 0x1FFFF ;see above
[ CFG_VERIFYMODE 15 ]
VerifyModeIndex- Program Verification method
VERIFY_NONE_INDEX 0- no verification
VERIFY_STD_INDEX1- standard verification (read and verify)
VERIFY_FAST_INDEX 2- fast verification (calculate CS and verify)
[ CFG_BLOWFUSE 16 ]
BlowFuseEn- Blow the security fuse - only using JTAG/SBW interface
0- disable
1- enable when called from F_Blow_Fuse()
3- enable when called from F_Blow_Fuse() or F_Autoprogram(..)
[ CFG_APPLSTARTEN 17 ]
ApplicationStartEn- reset and start the microcontroller’s
(See FlashPro430 Manual - chapter 9)
BSL_ENH_DISABLE0Disable access via BSL
BSL_ENH_NONE1Do not erase flash if the BSL password is invalid
(allows to make a next try)
BSL_ENH_ERASE2Erase whole flash if the BSL password is invalid
(one try only)
[ CFG_RETAIN_CAL_DATA_INDEX34 ]
59
(See FlashPro430 Manual - chapter 6)
0 - Disable retain the DCO Calibration Data for the F2xx family.
1 -Enable retain the DCO Calibration Data for the F2xx family. Data are
saved in the INFO flash memory at location 0x10F8 to 0x10FF
[ CFG_RETAIN_DEF_DATA_INDEX35 ]
(See FlashPro430 Manual - chapter 6)
0 - Disable retain the user defined data in flash.
1 -Enable retain the user defined data in flash. Data specified in the
user defined location (see indexes below) will be restored after
erase and program.
[ CFG_RETAIN_START_ADDR_INDEX 36 ]
start address - start address for the user defined retain data
(protected data) in flash.
Size of protected data can not exceed 256 bytes.
[ CFG_RETAIN_STOP_ADDR_INDEX37 ]
stop address - stop address for the user defined retain data
(protected data) in flash.
Size of protected data can not exceed 256 bytes.
[ CFG_APPLPRGRUNTIME38]
data 0 - unlimited time
1 to 120 seconds - (limited time)
F_Get_Device_Info - Get information related to selected microcontroller.
VALID FPA index - ( 1 to 64 )
Syntax:
MSPPRG_APIINT_X F_Get_Device_Info( INT_X index );
where index:
DEVICE_NAME0
DEVICE_NAME_SIZE20
DEVICE_MAIN_FLASH_START_ADDR20
DEVICE_MAIN_FLASH_END_ADDR21
DEVICE_INFO_START_ADDR22
DEVICE_INFO_SEGM_SIZE23
DEVICE_NO_INFO_SEGMENTS24
DEVICE_RAM_SIZE25
Return value:
-1 (0xFFFFFFF) - invalid data
-2 (0xFFFFFFFE) - FPA_INVALID_NO
or
65
index - 0 to 19 ->device name - char by char starting from index->0
=> M eg. MSP430F149
index 0 -> 'M'
index 1 -> 'S'
index 2 -> 'P'
index 3 -> '4'
index 4 -> '3'
index 5 -> '0'
index 6 -> 'F'
index 7 -> '1'
index 8 -> '4'
index 9 -> '9'
index 10 -> 0x0000 -> end of string
index 11 to 19 -> after end of string - irrelevant data.
index 20 -> MAIN Flash Start Address eg 0x1100 (for F149)
index 21 -> MAIN Flash End Address eg 0xFFFF (for F149)
index 22 -> INFO start address eg 0x1000
index 23 -> INFO segment size eg 0x0080 (for F149)
index 24 -> No of INFO segments eg 0x0002 (for F149)
index 25 -> RAM size eg 0x0800 (for F149)
Note: The device info is related to selected microprocessor. Desired index processor should be
first set in the configuration using F_SetConfig( CFG_MICROCONTROLLER, uP_index);
Below is an example of the procedure that can take names of all supported devices by the API-DLL.
The max size can be tested from the API-DLL, until device name is empty when the microprocessor
index is incremented from the zero up to max value. In the example below is assumed that te max
number of supported devices is 300, however this value can be dynamically modified if required.
In the procedure below the names and uP index are saved in the DEVICELIST structure, where the
name and index pair are kept in the same DEVICELISTDeviceList[] element. When the
DeviceList[] is created, then all names are kept in the alphabetic order. Microprocessor name and
corresponded microprocessor index used by the API-DLL can be taken from following elements:
Microprocessor name (string) <- DeviceList[k].name;
Microprocessor index (int)<- DeviceList[k].index;
int n,k, st, index_bak, max_up_index;
DEVICELIST tmp;
tmp.index = 0; *tmp.name = '\0';
index_bak = F_GetConfig( CFG_MICROCONTROLLER ); //get current uP index
for(k=0; k<MAX_NO_OF_DEVICES; k++)
DeviceList[k] = tmp; //clr device list
max_up_index = 0;
for(k=0; k<MAX_NO_OF_DEVICES; k++)
{
F_SetConfig( CFG_MICROCONTROLLER, k ); //set new uP index
for( n = 0; n<DEVICE_NAME_SIZE; n++ )
{
DeviceList[k].name[n] = char(0xFF & F_Get_Device_Info( DEVICE_NAME+n ));
}
if( DeviceList[k].name[0] == 0 ) break; //break if name is empty
DeviceList[k].index = k;
max_up_index = k;
}
F_SetConfig( CFG_MICROCONTROLLER, index_bak ); //restore uP index
//sort names in the table from min to max.
if( max_up_index > 0 )
for( k=0; k<max_up_index; k++ )
{
st = FALSE;
for( n=1; n <= max_up_index; n++ )
{
if( strcmp( DeviceList[n-1].name, DeviceList[n].name ) >=0 )
F_DLLTypeVer- Get information about DLL software type and software revision.
VALID FPA index - ( 1 to 64 )
70
F_DLLTypeVer function returns integer number with DLL ID and software revision version and
copying text message to report message buffer about DLL ID and software revision. Text content
can downloaded using one of the following functions
F_GetReportMessageChar( index )
or F_ReportMessage( text )
Syntax:
MSPPRG_APIINT_X F_DLLTypeVer( void );
Return value:
VALUE = (DLL ID) | ( 0x0FFF & Version)
DLL ID = 0x1000 - Single-DLL for the FlashPro430 - Parallel Port
DLL ID = 0x2000 - Single-DLL for the FlashPro430 - USB
DLL ID = 0x3000 - Single-DLL for the GangPro430 - USB
DLL ID = 0x6000 - Multi-DLL for the FlashPro430
DLL ID = 0x7000 - Multi-DLL for the GangPro 430
Version = (0x0FFF & VALUE)
-2 (0xFFFFFFFE) - FPA_INVALID_NO
Example:
INT_X id;
.......................
.......................
id = F_DLLTypeVer();
Disp_report_message();
//see F_ReportMessage or F_GetReportMessage for details
.......................
F_ConfigFileLoad, F_Config_FileLoad
F_ConfigFileLoad- Modify programmer’s configuration setup according to data taken
or F_Config_FileLoad from the specified configuration file.
VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed sequentially.
The F_ConfigFileLoad function can download the programmer setup from the external setup file.
Setup file can be created using standard MSP430 Flash Programmer software. When setup from the
file is downloaded, then old configuration setup is overwritten. New setup can be modified using
F_GetSetup and F_ConfigSetup functions.
Location path and file name of the config file must be specified.
All data coming to of from target device can be saved in the temporary buffers (see Figure 4.2)
located inside the API-DLL. The data saved in these buffers can be copied to target devices using an
encapsulated or sequential functions. When the full block of data is ready to be saved (eg. code data),
then the part of the data buffers can be modified by adding some unique data like serial numbers,
calibration data etc. to each target before executing the flash programming process. Data buffers can
be modified at any time, as long as the F_OpenInstancesAndFPAs(..) and F_Initialization() have
been executed successfully. When more then one FPA are used then it is recommended to use only
an executable instructions uses the data buffers for read and write. For example when the read process
is used with external data buffer like it is in instruction F_Memory_Read( BYTE * data), then the
simultaneous process can not be used and data from each targets must be read sequentially. Using for
this purpose instruction F_Copy_All_Flash_to_Buffer() allows to make this process simultaneously.
Results from each targets are saved in a Read Data buffers - one Read Buffer per one API-DLL. When
the simultaneous process is done, then the content from each buffers can be individually read. The
API-DLL contains four buffers (see Figure 4.2) - Code, Password, Write Data and Read Data
buffers. Contents for the Code and Password buffers can be taken from the files, or data can be
written directly to the specified buffer location. Data to the Write Data buffer can be written directly
only, while data from the Read Data buffer can be read directly only. The FLASH memory can be
programmed using contents taken from the Code buffer or from the Write Data buffer. Data to
RAM, registers, I/O (seen as RAM) can be taken from Write Data buffer only. Contents from RAM,
registers, I/O and flash are saved in Read Data buffer.
Note: The Code buffer contains two items inside - data and flag in each address location. Data is
related to the written value 0 to 0xFF, while flag - used or empty informs is the particular byte
is used and should be programmed, verified etc, or if it is empty and should be ignored even
if data is 0xFF. All flags are cleared when the new code from the file is downloaded, or if the
F_Clr_Code_Buffer() instruction is used.
Below are listed the data buffers access between an application and API-DLL buffers instruction.
F_ReadCodeFile, F_Read_CodeFile
F_ReadCodeFile - Read code data from the file and download it to internal buffer.
or F_Read_CodeFile
VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed sequentially.
Function F_ReadCodeFile downloads code from the file to internal memory buffer. Code file format
and file name and location path of the desired file must be specified. Three file formats are supported
75
- Texas Instruments text format, Motorola *.s19 format and Intel *.hex format. When file is
downloaded then contents of this file is analysed. Only code memory location valid for the MSP430
microcontroller family will be downloaded to the internal Code buffer. Any code data located outside
memory space of the MSP430 microcontroller will be ignored and warning message will be created.
When the F_ReadCodeFile function is used then the full Code buffer is filled with data 0xFF and
all flags are cleared (empty flag) first. When the valid data are taken from the code buffer, the data
is saved in buffer and flag modified from empty to used.
Syntax:
MSPPRG_APIINT_X F_ReadCodeFile( int file_format, char * FileName );
MSPPRG_APIINT_X F_Read_CodeFile( int file_format, CString FileName );
file_format:
FILE_TI_FORMAT(1) for TI (*.txt) format
FILE_MOTOROLA_FORMAT(2) for Motorola (*.s19, *.s28 or *.s37)
FILE_INTEL_FORMAT(3) for Intel (*.hex)
FILE_IAR_D43_FORMAT(4) for IAR (UBROF9) *.d43 format
orFILE_DEBUG_A43_FORMAT(5) for IAR HEX or Motorola debug format
FileName: file name including path, file name and extention
note: F_Read_CodeFile is available only when the Multi-FPA dll is used.
Return value:
(0xFFFe & info) | state
where state is defined as follows:
0 - FALSE
1 - TRUE
-2 (0xFFFFFFFE) - FPA_INVALID_NO
info is defined as follows:
warning ->CODE_IN_ROM
CODE_IN_RAM
CODE_OUT_OF_FLASH
CODE_OVERWRITTEN
error ->INVALID_CODE_FILE
OPEN_FILE_OR_READ_ERR
Example:
int st;
....................
st = F_ReadCodeFile( FILE_TI_FORMAT, “c:\test\demofile.txt” );
if(( st & 1 ) == TRUE )
{
....................
}
76
else
{
if ( st & CODE_IN_ROM ) {......}
if ( st & CODE_OUT_OF_FLASH ) {......}
if ( st & INVALID_CODE_FILE ) {......}
if ( st & OPEN_FILE_OR_READ_ERR ) {......}
....................
....................
}
F_Get_CodeCS
F_Get_CodeCS- Read code from internal code buffer and calculate the check sum.
VALID FPA index - ( 1 to 64 ).
Syntax:
MSPPRG_API LONG_X F_Get_CodeCS( int index );
index - index of the desired code
Index = 1 - Calculate check sum of the code from internal code buffer.
2 - Return Code Cs used in the last Autprogram session.
3 - Return Memory Cs used in the last Autprogram session.
Other Index values - reserved for the future option.
Return value:
Calculated check sum or
-2 (0xFFFFFFFE) - FPA_INVALID_NO
F_ReadPasswFile, F_Read_PasswFile
F_ReadPasswFile- Read code password data from the file and download it to internal buffer.
or F_Read_PasswFile
VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed sequentially.
Function F_ReadPasswFile downloads part of the code from the file to internal memory buffer. From
the code file only data related to the password data (location 0xFFE0 to 0xFFFF) are stored in the
password memory buffer. All other data is ignored. Code file format and file name and location path
of the desired file must be specified. Three file formats are supported - Texas Instruments text
format, Motorola *.s19 format and Intel *.hex format.
file_format -> specify code file format - TI (*.txt), Motorola (*.s19, *.s28,
*.s37), Intel (*.hex), IAR UBROF9 (*.d43) or IAR debug (*.a43) format
FILE_TI_FORMAT(1) for TI (*.txt) format
FILE_MOTOROLA_FORMAT(2) for Motorola (*.s19, *.s28 or *.s37)
FILE_INTEL_FORMAT(3) for Intel (*.hex)
FILE_IAR_D43_FORMAT(4) for IAR (UBROF9) *.d43 format
orFILE_DEBUG_A43_FORMAT(5) for IAR HEX or Motorola debug format
FileName -> full file name including path, file name and extention
note: F_Read_PasswFile is available only when the Multi-FPA dll is used.
Return value:
(0xFFFe & info) | state
where state is defined as follows:
0 - FALSE
1 - TRUE
-2 (0xFFFFFFFE) - FPA_INVALID_NO
info is defined as follows:
error ->INVALID_CODE_FILE
OPEN_FILE_OR_READ_ERR
PASSWORD_NOT_FOUND
Example:
st = F_ReadPasswFile( FILE_TI_FORMAT, “c:\test\demofile.txt” );
if(( st & 1 ) == TRUE )
{
....................
}
else
{
Info = st & 0xFFFE;
....................
....................
}
F_Clr_Code_Buffer
F_Clr_Code_Buffer- Clear content of the Code buffer.
VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed sequentially.
78
Function fill the full Code buffer with data 0xFF and clear all flags to empty value.
Syntax:
MSPPRG_API INT_X F_Clr_Code_Buffer( void );
Return value:
0 - FALSE
1 - TRUE
-2 - FPA_INVALID_NO
Example:
.....................
F_Clr_Code_Buffer();
.....................
F_Put_Byte_to_Code_Buffer
F_Put_Byte_to_Code_Buffer- Write code data to Code buffer.
VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed sequentially.
Instruction allows to write contents of the code to code buffer instead using the F_ReadCodeFile
instruction. Contents of the downloaded code data can be modified or filled with the new data, if code
buffer has been cleared first (using F_Clr_Code_Buffer function).
Instruction write the data to Code buffer in specified address location and set the used flag in that
location.
Note: Writing the 0xFF to the specified location where the other then the 0xFF data was located do
not remove the contents from the buffer in fully. The new data (0xFF) will be written to Code
buffer location, but flag still will be set to used. Use the F_Clr_Code_Buffer() instruction
to fully clear the Code buffer before writing the new data block.