Elprotronic MSP430 User Manual

The MSP430 Flash Programmer
Multi-FPA API-DLL User’s Guide
for the USB-MSP430-FPA and MSP-FET430UIF Adapters
Software version 4.5
PM010A05 Rev.22
April-05-2010
Elprotronic Inc.
Elprotronic Inc.
Richmond Hill, Ontario, L4E-5C9 CANADA
Web site: www.elprotronic.com E-mail: info@elprotronic.com Fax: 905-780-2414 Voice: 905-780-5789
Copyright © Elprotronic Inc. All rights reserved.
Disclaimer:
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.
5
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.1 Using TI’s MSP-FET430UIF adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2. Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.1 Self Test Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2 MyMSP430Prg Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.3 API DLL Demo Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3. Example with API DLL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.1 Example with single FPA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.2 Example with Multi-FPA API DLL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4. List of the DLL instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.1 Multi-FPA instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
F_Trace_ON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
F_Trace_OFF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
F_OpenInstances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
F_CloseInstances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
F_OpenInstancesAndFPAs, F_OpenInstances_AndFPAs . . . . . . . . . . . . . . 38
F_Set_FPA_index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
F_Get_FPA_index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
F_Check_FPA_index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
F_Disable_FPA_index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
F_Enable_FPA_index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
F_LastStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
F_Multi_DLLTypeVer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
F_Get_FPA_SN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.2 Generic instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
F_Check_FPA_access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
F_Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
F_API_DLL_Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
F_Close_All . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
F_GetSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6
F_ConfigSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
F_SetConfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
F_GetConfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
F_Set_MCU_Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
F_Get_Device_Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
F_DispSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
F_ReportMessage, F_ReportMessage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
F_GetReportMessageChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
F_DLLTypeVer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
F_ConfigFileLoad, F_Config_FileLoad . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
F_Power_Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
F_Reset_Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
F_Get_Targets_Vcc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
F_Set_fpa_io_state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.3 Data Buffers access instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
F_ReadCodeFile, F_Read_CodeFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
F_Get_CodeCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
F_ReadPasswFile, F_Read_PasswFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
F_Clr_Code_Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
F_Put_Byte_to_Code_Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
F_Get_Byte_from_Code_Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
F_Put_Byte_to_Password_Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
F_Get_Byte_from_Password_Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
F_Put_Byte_to_Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
F_Get_Byte_from_Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.4 Encapsulated instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
F_AutoProgram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
F_VerifyFuseOrPassword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
F_Memory_Erase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
F_Memory_Blank_Check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
F_Memory_Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
F_Memory_Verify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
F_Memory_Read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
F_Copy_All_Flash_to_Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
F_Restore_JTAG_Security_Fuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.5 Sequential instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
F_Open_Target_Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
F_Close_Target_Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
7
F_Segment_Erase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
F_Sectors_Blank_Check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
F_Write_Word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
F_Read_Word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
F_Write_Byte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
F_Read_Byte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
F_Memory_Write_Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
F_Memory_Read_Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
F_Copy_Buffer_to_Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
F_Copy_Flash_to_Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
F_Copy_Buffer_to_RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
F_Copy_RAM_to_Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
F_Set_PC_and_RUN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
F_Capture_PC_Addr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
F_Synch_CPU_JTAG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
F_Blow_Fuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
F_Adj_DCO_Frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
F_Test_DCO_Frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
4.6 Customized JTAG instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
F_init_custom_jtag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
F_custom_jtag_stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
4.7 UART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
F_Custon_Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Appendix A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
FlashPro430 Command Line interpreter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
8
1. Introduction
The FlashPro430 (USB-MSP430-FPA) or TI’s MSP-FET430UIF adapter can be remotely
controlled from other software applications (Visual C++, Visual Basic etc.) via a DLL library. The
Multi-FPA - allows to remotely control simultaneously up to sixteen Flash Programming Adapters
(USB-MSP430-FPAs) significantly reducing programming speed in production. When the MSP-
FET430UIF adapter is used then the only one adapter can be connected.
Figure 1.1 shows the connections between PC and up to sixteen programming adapters. The
FPAs can be connected to PC USB ports directly or via USB-HUB. Direct connection to the PC is
faster but if the PC does not have required number of USB ports, then USB-HUB can be used. The
USB-HUB should be fast, otherwise speed degradation can be noticed. When the USB hub is used,
then the D-Link’s Model No: DUB-H7, P/N BDUBH7..A2 USB 2.0 HUB is recommended.
Figure 1.1
9
Block diagram of the Multi-FPA application DLL is presented on the Figure 1.2.
Figure 1.2
To support this new Multi-FPA API-DLL feature, the software package contains seventeen dll files
- the Multi-FPA API-DLL selector
- sixteen standard single FPAs API-DLLs (or one UIF API-DLL)
Figure 1.3 shows the logical connections between these dll files.
The main Multi-FPA file (FPA-selector - MSP430FPA.DLL) allows to transfer API-DLL functions
coming from application software to desired single application dll (MSP430FPA1.DLL to
MSP430FPA64.DLL or MSPFET430UIF1.DLL).
The MSP430FPA.DLL file is transparent for all API-DLL functions implemented in the single FPA
API-DLLs functions. Desired destination FPA can be selected using the function
F_Set_FPA_index( fpa );
where the
fpa = 1 to 64 when only one desired FPA required to be selected
or fpa = 0 when ALL active FPAs should be selected.
10
The selected FPA index modified by the F_Set_FPA_index( fpa ) instruction can be modified at any
time. By default, the FPA index is 1 and if only one FPA is used then fpa index does not need to be
initialized or modified. When the fpa index 1 to 64 is used, then the result is coming back to
application software from the single API-DLL via transparent Multi-FPA dll. When fpa index is 0
(ALL-FPAs) and results are the same from all FPAs, then the same result is passing back to
application software. If results are not the same, then the Multi-FPA dll is returning back value -1
Figure 1.3
(minus 1) and all recently received results can be read individually using function
F_LastStatus( fpa )
Most of the implemented functions allows to use the determined fpa index 1 to 64 or 0 (ALL-FPAs).
When functions return specific value back, like read data etc, then only determined FPA index can
be used ( fpa index from 1 to 64). When the fpa index is 0 (ALL-FPAs) then almost all functions are
executed simultaneously. Less critical functions are executed sequentially from FPA-1 up to FPA-64
but that process can not be seen from the application software.
11
When the inactive fpa index is selected, then return value from selected function is -2 (minus 2).
When all fpa has been selected (fpa index = 0) then only active FPAs will be serviced. For example
if only one FPA is active and fpa index=0, then only one FPA will be used. It is save to prepare the
universal application software that allows to remote control up to sixteen FPAs and on the startup
activate only desired number of FPAs.
It should be noticed, that all single API-DLLs used with the Multi-FPA DLL are fully independent
to each other. From that point of view it is not required that transferred data to one FPA should be
the same as the transferred data to the others FPAs. For example code data downloaded to FPA-1
can be different that the code data downloaded to the FPA-2, FPA-3 etc. But even in this case the
programming process can be done simultaneously. In this case the desired code should be read from
the code file and saved in the API-DLL-1, next code file data should be saved in the API-DLL-2 etc.
When it is done, then the F_AutoProgram can be executed simultaneously with selected all active
FPAs. All FPAs will be serviced by his own API-DLL and data packages saved in these dlls.
The following commands are supported in the DLL library:
Initialization and termination communication with the programming adapter,
Programmer configuration setup,
Programming report message,
Code data and password data read from the file,
DC power target from the programming adapter,
Reset target device,
Auto program target device ( erase, blank check, program and verify),
Password or fuse verification,
All or selected part of memory erase,
All or selected part of memory blank check,
All or selected part of memory write,
All or selected part of memory verify,
All or selected part of memory read,
Open or close communication with the target device,
Selected memory segment erase,
Selected part of memory blank check,
Selected part of memory segment write,
Selected part of memory segment read,
Security fuse blow.
12
The MSP430 Flash Programmer software package contains all required files to remotely control
programmer from a software application. When software package is installed then by default the
DLL file, library file and header file are located in:
C:\Program Files\Elprotronic\MSP430\USB FlashPro430\API-DLL
MSP430FPA.dll - Multi-FPA selection/distribution DLL
MSP430FPA1.dll - DLL for Elprotronic’s USB-MSP430-FPA
MSPFET430UIF1.dll - DLL fro TI’s MSP-FET430UIF
MSPPrg-Dll.h - header file for MS VC++
MSPPrg-Dos-Dll.h - header file for Borland, DOS etc.
MSP430FPA-BC.lib - lib file for Borland VC++
MSP430FPA.lib - lib file for MS VC++
config.ini - default configuration file for the FPAs
FPAs-setup.ini - FPAs- vs USB / UIF ports configuration file
or
C:\Program Files\Elprotronic\MSP430\FET-Pro430\API-DLL
MSP430FPA.dll - Multi-FPA selection/distribution DLL
MSPFET430UIF1.dll - DLL fro TI’s MSP-FET430UIF
MSPPrg-Dll.h - header file for C++
MSPPrg-Dos-Dll.h - header file for Borland, DOS etc.
MSP430FPA.lib - lib file for MS VC++
MSP430FPA-BC.lib - lib file for Borland VC++
config.ini - default configuration file for the FPAs
FPAs-setup.ini - FPAs- vs UIF ports configuration file
The API-DLL package in the USB FlashPro430 and in the FET-Pro430 subdirectories are exactly
the same. However for the simplicity the dll file for the USB-MSP430-FPA adapter is not included
in the FET-Pro430 package, since the only MSP-FET430UIF adapter will be used. Make sure that
your application software will not call the USB-MSP430-FPA adapter if the dll for this adapter is
not present. When the USB-MSP430-FPA adapter is used, then the package from the first
subdirectory that contains the MSP430FPA1.dll for the USB-MSP430-FPA adapter should be used.
In this package the MSPFET430UIF1.dll for the MSP-FET430UIF adapter is also included and
allows to use the USB-MSP430-FPA adapter (or adapters) only, the MSP-FET430UIF adapter or
both type of adapters at the same time. The entry dll (MSP430FPA.dll - dll selector) is selecting the
desired dll vs used adapter.
The entry dll (MSP430FPA.dll) contains two groups of the same functions used in C++
application and Visual Basic applications All procedure names used in the Visual Basic are starting
13
from VB_xxxx, (and have the _stdcall calling declaration) when procedure names used in the C++
are starting from F_xxxx (and have the _Cdecl calling declaration).
Reminding files listed above are required in run time - to initialize the flash programming
adapter. The config.ini is optional, if not present then default configuration is created.
When the MS VC++ application is created, then following files should be copied to the source
application directory:
MSPPrg-Dll.h - header file for C++
MSP430FPA.lib - lib file for C++
and to the release/debug application directory
MSP430FPA.dll - Multi-FPA selection/distribution DLL
MSP430FPA1.dll - DLL for Elprotronic’s USB-MSP430-FPA
MSPFET430UIF1.dll - DLL fro TI’s MSP-FET430UIF
config.ini - default configuration file for the FPAs
FPAs-setup.ini - (optiona) FPAs- vs USB ports configuration file
Executable application software package in C++ the requires following files
MSP430FPA.dll - Multi-FPA selection/distribution DLL
MSP430FPA1.dll - DLL for Elprotronic’s USB-MSP430-FPA
MSPFET430UIF1.dll - DLL fro TI’s MSP-FET430UIF
config.ini - default configuration file for the FPAs
FPAs-setup.ini - (optiona) FPAs- vs USB ports configuration file
When application in Visual Basic is created, then following files should be copied to the source or
executable application directory:
MSP430FPA.dll - Multi-FPA selection/distribution DLL
MSP430FPA1.dll - DLL for Elprotronic’s USB-MSP430-FPA
MSPFET430UIF1.dll - DLL fro TI’s MSP-FET430UIF
config.ini
FPAs-setup.ini - FPAs- vs USB ports configuration file
When LabView application is created, then following files taken form the location
C:\Program Files\Elprotronic\MSP430\USB FlashPro430\LabView
should be copied to the source or executable application directory:
FlashPro430-Labview.dll - LabView library
MSP430FPA.dll - Multi-FPA selection/distribution DLL
MSP430FPA1.dll - DLL for Elprotronic’s USB-MSP430-FPA
MSPFET430UIF1.dll - DLL fro TI’s MSP-FET430UIF
14
config.ini
FPAs-setup.ini - FPAs- vs USB ports configuration file
All these files ‘as is’ should be copied to destination location, where application software using DLL
library of the MSP430 Flash programmer is installed. The config.ini file has default setup
information. The config.ini file can be modified and taken directly form the MSP430 Flash
Programmer application software. To create required config.ini file the standard MSP430 Flash
programmer software should be open and required setup (memory option, JTAG/SBW/BSL interface
select etc) should be created. When this is done, programming software should be closed and the
config.ini file with the latest saved configuration copied to destination location. Note, that the
configuration setup can be modified using DLL library function.
Software package has a demo software written under Visual C++.net , Visual Basic.net and
LabVIEW - version 7.1. All files and source code are located in:
C:\Program Files\Elprotronic\MSP430\USB FlashPro430\API-DLL-Demo\Cpp C:\Program Files\Elprotronic\MSP430\USB FlashPro430\API-DLL-Demo\VBnet C:\Program Files\Elprotronic\MSP430\USB FlashPro430\API-DLL-Demo\VB6 C:\Program Files\Elprotronic\MSP430\USB FlashPro430\LabView
1.1 Using TI’s MSP-FET430UIF adapter
The Multi-FPA API-DLL version 4.0 and higher allows to control the TI’s MSP-FET430UIF
or EZ430 stick adapter with the same list of instructions as are used for the MSP-MSP430-FPA
adapters. The API-DLL is prepared mostly for the flash programming only and from that reason an
available list of instructions in the MSP-FET430UIF used for debugging are not used in the API-
DLL. The care should be taken, that some of the features available in the USB-MSP430-FPA
adapters are not supported in the MSP-FET430UIF adapters and vice-verse. The MSP-FET430UIF
does not support the BSL communication interface and also does not allow to calibrate the DCO
frequency. These option should be disabled in software (see software configuration) if the MSP-
FET430UIF adapter is used.
The API-DLL structure and list of instructions for the MSP-FET430UIF allows to use current
application software used for the USB-MSP430-FPA adapters without modification. Only the latest
DLLs should replace the old dlls. Also the MSPFET430UIF1.dll file should be plased with the other
dlls if the MSP-FET430UIF is used. When the USB-MSP430-FPA adapter is not used, then the
MSP430FPA1.dll can be removed. Make sure that the main dll - MSP430FPA.dll is always
installed. The MSPFET430UIF1.dll file is protected and can work without access key only first 30
15
days after first activation. After this time the access key is required. If the TI’s MSP-FET430UIF
adapter is not used, then the MSPFET430UIF.dll file can be removed to avoid the pop-up messages
with information regarding access key installation, or in the start-up definition the option - ANY
adapter should not be used. Use the FPAs serial number or FPA definition to avoid activation the
API-DLL servicing the TI’s MSP-FET430UIF adapter, or vice-verse - when the MSP-FET430UIF
adapter is used only, then do not use ANY adapter definition. Use the UIF definition instead ANY
adapter (‘*’).
When the access key for the MSPFET430UIF.dll file is not installed, then the following pop-
up message will be displayed every time when the dll is activated.
Figure 1.4
Since the application software can install and close the dll a few times on the startup then the pop-up
messages can be reentered even - 2-4 times on the startup. Press OK button and go head. After expire
time the dll without valid access key will reject the communication with application software. When
the access key is installed, then the pop-up messages are not displayed any more.
16
2. Getting Started
2.1 Self Test Program
The software package contains the FlashPro430 Self Test program, that allows to test functionality
of the ONE flash programming adapter, users target device and connections between these units.
Software package use the Multi-FPA API-DLLs. In the test results printout are listed the DLL
functions with syntax, that has been used. This printout is useful to find-out source of the problems,
as well as can be used at the startup when your application software uses one programming adapter
only. Software can be activated from the Start menu
Start -> Programs -> Elprotronic-Flash Programmers -> (MSP430) FlashPro430 -> FlashPro430 Self Test
or by running the program FlashPro430SelfTest.exe from the location
C:\Program Files\Elprotronic\MSP430\USB FlashPro430\SelfTest
The same software package can be found in the FET-Pro430 subdirectory, if the FET-Pro430
software is installed.
The Figure 2.1 presents the GUI of the FlashPro430 / FET-Pro430 Self Test.
Connect the Flash Programming Adapter (USB-MSP430-FPA or MSP-FET430UIF) to PC (USB
port), connect your target device to adapter, select desired options in following selectors (see Figure
2.1) - “Target Device”, “Target’s Vcc” “Interface” and “Reset Pulse width”. When it is done
then press the button “TEST”. When test is finished, then check if there is no any errors. Detailed
test report is displayed. The test report can be paste to Notepad and saved if required.
Note: When the MSP-FET430UIF adapter is used then only two interface can be selected
- JTAG or Spy-Bi-Wire with fixed communication speed. The BSL interface is not
supported in this adapter.
Following conditions are used during the test:
1. JTAG and Spy-Bi-Wire interface is used:
* Erased and programmed MAIN memory only. The info memory (0x1000 to 0x10FF)
is not erased and not modified. The DCO calibration data in the F2xx are not
modified. During the test it can be displayed warning that All memory blank check
failed, that of course is normal. But selected memory blank check must be OK (the
full MAIN memory in this case).
17
Figure 2.1
* All bytes of the main memory are erased, blank checked and programmed with the
randomly generated data used as a code data. Whole MAIN memory content is
verified (check sum) and also read whole data and verified byte by byte.
* One sector (location 0xFC00 to 0xFDFF) is erased and blank checked. Also contents
of the two closer sectors are verified if there are not erased. Small block of data are
saved and verified in the mentioned sector.
* Word write/read to TACCR0 (0x172) register.
* Byte/Word manipulation are used in the part of the RAM.
2. BSL interface is used (not supported in the MSP-FET430UIF):
* Due to unknown access password, the whole Flash memory - MAIN and INFO are
erased. In the F2xx microcontrollers the DCO calibration data will be erased. There
is no way to save the DCO data if the BSL password is unknown. The DCO data can
18
be calibrated using the FlashPro430 GUI package software when the JTAG or Spy-
Bi-Wire access is available (when the JTAG fuse is not blown). See the FlashPro430
manual for details.
* All MAIN memory is tested in the same way as it is used with the JTAG/Spy-Bi-
Wire interface
* Word write/read to TACCR0 (0x172) register.
* Access to RAM if size of the RAM if higher then 256 bytes. Access to RAM space
0x200 to 0x2FF is blocked due to stack and firmware located in this RAM location.
Note: The first test (Vcc value when the power is OFF) can be failed, if the external power is
connected or if the blocking capacitor on your target device connected to the Vcc line if high.
The Vcc should be below 0.4V when the power is OFF, tested 2 seconds after switching-off
the power from FPA, otherwise test failed.
The Self Test programming software package is located in directory
C:\Program Files\Elprotronic\MSP430\USB FlashPro430\SelfTest
or
C:\Program Files\Elprotronic\MSP430\FET-Pro430\SelfTest
and contains following files
MSP430FPA.dll - Multi-FPA selection/distribution DLL
MSP430FPA1.dll - USB-FPA DLL
MSPFET430UIF1.dll - DLL fro TI’s MSP-FET430UIF
config.ini - default configuration file for the FPAs
FlashPro430SelfTest.exe - executable file
To run the executable file FlashPro430SelfTest.exe it in the other location the files listed above
should be copied “as is” to destination directory.
2.2 MyMSP430Prg Projects
The MyMSP430Prg projects are examples of using the Multi-FPA API-DLL with Microsoft Visual
Studio 7.0 (2002) and for Microsoft Visual Basic 6.0. They are intended to help users create their
own application that uses the API-DLL by providing a simple starting point. When using Visual
Studio C++ include the following files should be included to your program:
MSP430FPA.lib
MSPPrg-Dll.h
MspFPA-Lib.h
19
MspFPA-Lib.cpp
MSP430SamplePrg.h
MSP430SamplePrg.cpp
The above files are located in the following directory:
...\Elprotronic\MSP430\USB FlashPro430\API-DLL-MyPrg\Cpp\scr or ...\Elprotronic\MSP430\FET-Pro430\API-DLL-MyPrg\Cpp\scr
Files MSP430SamplePrg.cpp and MSP430SamplePrg.h can be modified in a way that suits your
application. However, the remaining files should not be modified.
To run your application you will need to allow your application access to the Multi-FPA dynamically
linked library. A simple way to do this is to copy the following files into your directory where
executable file is located:
MSP430FPA.dll
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)
The easy demo project MyMSP430Prg uses API-DLLs and files listed above is located in directory
...\Elprotronic\MSP430\USB FlashPro430\API-DLL-MyPrg\Cpp\MyMSP430Prg
or
...\Elprotronic\MSP430\FET-Pro430\API-DLL-MyPrg\Cpp\MyMSP430Prg
and are included for demonstration purposes only. The sample project can be opened by selecting
the project file MyMSP430Prg.vcproj located in directory
...\Elprotronic\MSP430\USB FlashPro430\API-DLL-MyPrg\Cpp\MyMSP430Prg
or
...\Elprotronic\MSP430\FET-Pro430\API-DLL-MyPrg\Cpp\MyMSP430Prg
The following dialogue box will be displayed when project executed (see figure 2.2).
Dialogue box contains few buttons, that call procedures listed in the mentioned above files. See
contents in the MyMSP430Prg.cpp file located in the project directory, how these procedures are
called from application software. There are several useful procedures located in the MspFPA-
20
Figure 2.2
Lib.cpp file that significantly simplify the FPA initialization process. See comments for each
procedures located in this file.
The first procedure named
get_FPA_and_MSP_list(..........)
searches all FPAs connected to your PC via USB ports. As the results, adapter serial numbers of the
detected FPAs are located in the FPA_SN_list[k] where k = 0 up to 15. Up to sixteen FPA SN can
be located in this data block. SN list are located starting from FPA_SN_list[0]. The same procedure
also takes a list of supported MSP microcontrollers containing MCU name, flash start and end
addresses etc. from API-DLL .The MCU list is saved in the following structure
typedef struct {
char name[DEVICE_NAME_SIZE]; int index; long flash_start_addr; long flash_end_addr; long info_flash_start_addr;
21
long info_segm_size; long no_of_info_segm; long RAM_size; int group; int double_ID;
} DEVICELIST; DEVICELIST DeviceList[300];
Up to 300 MCUs can be saved in DeviceList. When required, the size of this data block can be
increased in the future. Currently, device list contains about 130 MCUs. The MCU names in the
DeviceList are sorted in alphabetic order. Alphabetical order is convenient for users, however the
API-DLL requires fixed MCU index when selecting the particular MCU. In the structure above the
MCU index required by API-DLL is located in
DeviceList[k].index
and procedure setting the required MCU becomes as follows
F_SetConfig( CFG_MICROCONTROLLER, DeviceList[k].index );
The second procedure that can be called after the get_FPA_and_MSP_list(..........) procedure has
finished successfully, is the AssignFPAs( ......... ) procedure that activates the DLLs and assign
desired FPAs. When these two procedures are finished successfully, the programmer is ready to
work. See procedure
FP430_FPA_initialization()
located in MyMSP430SamplePrg.cpp file how to call procedures above and what the next step
should be.
The same procedures as described above have been implemented in the software package using
Visual Basic 6.0. When the Visual Basic 6.0 is used, then the following files should be included to
your program
FlashPro430Def.bas
MspFPA-Lib.bas
MSP430SamplePrg.bas
The above files are located in the following directory
22
...\Elprotronic\MSP430\USB FlashPro430\API-DLL-MyPrg\VB6
When running your application, remember tp place the following files in the same directory as your
executable file:
MSP430FPA.dll
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)
You can modify file MSP430SamplePrg.bas to best fit into your application needs. Other files should
not be modified. The remaining files in this project are located in directory
...\Elprotronic\MSP430\USB FlashPro430\API-DLL-MyPrg\VB6
and are included for demonstration purposes only. Project can be activated by selecting the project
file MyMSP430Prg.vbp located in directory
...\Elprotronic\MSP430\USB FlashPro430\API-DLL-MyPrg\VB6
All procedures implemented in Visual Basic 6.0 are the same as those implemented in Visual C++.
See description above. Procedures written in VB6 are located in the MspFPA-Lib.bas file. Example
how to use these procedures are located in the MSP430SamplePrg.bas file. API-DLL function
declaration and constant definition are located in the FlashPro430Def.bas file.
2.3 API DLL Demo Program
Application DLLs files are the same for the application software written under Visual C++, Visual
Basic, LabView etc. First should be created destination directory, where the executable files and
DLLs will be located. Make a copy off all required files from the Elprotronic’s directory to your
destination directory. The files described in the chapter 1 should be copied to the executable
destination directory. It is recommended to use the demo program to verify if the setup in your PC
and destination directory is done correctly.
The Demo program is small GUI program with a lot of buttons allowing to separately call
functions using DLL library package software. Source code and all related project files are located
in the following directory:
C:\Program Files\Elprotronic\MSP430\USB FlashPro430\API-DLL-Demo\Cpp\Exe
VBnet version
23
C:\Program Files\Elprotronic\MSP430\USB FlashPro430\API-DLL-Demo\VBnet
VB6 version
C:\Program Files\Elprotronic\MSP430\USB FlashPro430\API-DLL-Demo\VB6
Labview (ver 7.1)
C:\Program Files\Elprotronic\MSP430\USB FlashPro430\LabView
when the FlashPro430 package is used, or in directory
C:\Program Files\Elprotronic\MSP430\FET-Pro430\API-DLL-Demo\Cpp\Exe
VBnet version
C:\Program Files\Elprotronic\MSP430\FET-FlashPro430\API-DLL-Demo\VBnet
VB6 version
C:\Program Files\Elprotronic\MSP430\FET-FlashPro430\API-DLL-Demo\VB6
Labview (ver 7.1)
C:\Program Files\Elprotronic\MSP430\FET-FlashPro430\LabView
when the FET-Pro430 package is used.
It is recommended to also copy the demo software
FlashPro-Multi-FPA-Demo.exe
taken from the Elprotronic’s directory (default location)
C:\Program Files\Elprotronic\MSP430\USB FlashPro430\API-DLL-Demo\Cpp\Exe
To make a run the demo program, then the following files should be located in the same directory
where the executable program in located. Assume that the demo program
FlashPro-Multi-FPA-Demo.exe
is used, then also the following files should be located in the same directory
MSP430FPA.dll - Multi-FPA selection/distribution DLL
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.
} F_Set_FPA_index( 1 ); // select FPA 1 for F_Initialization( ); // init FPA
Below is an example of the simplified (without error handling procedures) application
program written in C++ that allows to initialize one FPA, and run an autoprogram with the same
features like an autoprogram in the standard FlashPro430 (GUI) software.
1. Download data to target device
F_OpenInstancesAndFPAs( “*# *” ); // DLL and FPA (one only) initialization if( response == 0 )
{ //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
.................................................................
//– functions below called at the end of session F_CloseInstances();
Note: The F_OpenInstancesAndFPAs(..) and F_Initialization() functions should be called once
and the startup and the F_CloseInstances() function should be called as the last one after all
functions are finished in similar way like the FlashPro430 GUI software is opening once
and closed at the end when job is finished. The startup initialization take few seconds (when
the F_OpenInstancesAndFPAs(..) and F_Initialization() are executed) until dll
installation is established and desired firmware downloaded to FPA adapter(s). Application
software should call the initialization procedures at the startup only, and close access to API-
DLL at the end, when all tests of a lot of units are finished. Closing instances and opening
it again is a waist a time.
3.2 Example with Multi-FPA API DLL
The code example described below uses Multi-FPA API-DLL. The multi-FPA API-DLL is a shell
that allows to transfer incoming instructions from application software to desired FPA’s. All
instructions related to single FPA are detailed described in the chapters 4.2, 4.3, 4.4 and 4.4.
Instructions specific to Multi-FPA features described in the chapter 4.1.
Application DLL should be initialized first, before other DLLs instruction can be used.
response = F_OpenInstancesAndFPAs( FPAs-setup.ini );
// DLL and FPA initialization if( response == 0 )
{ //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
In example above number of the opened USB-FPAs are specified in the ‘FPAs-setup.ini’
Below is an example of the simplified (without error handling procedures) application program
written in C++ that allows to initialize all dlls and FPA, and run an autoprogram with the same
features like autoprogram in the standard FlashPro430 application software.
30
Loading...
+ 89 hidden pages