Flash programmer for the ti's msp430fxx microcontrollers, command line interpreter (14 pages)
Summary of Contents for Elprotronic FlashPro-CC
Page 1
FlashPro-CC Flash Programmer for the CC series devices - Chipcon product from TI Remote Control Programming User’s Guide PM024A02 Rev.2 December-17-2007 Elprotronic Inc.
Page 2
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.
Page 3
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.
Page 4
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.
Page 5
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.
1. Introduction FlashPro-CC Flash Programmer (USB ) 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 eight Flash Programming Adapters (FPAs) significantly reducing programming speed in production.
Page 11
Figure 1.2 Block diagram of the Multi-FPA application DLL is presented on the Figure 1.2. To support the Multi-FPA API-DLL feature, the software package contains nine dll files - the Multi-FPA API-DLL selector - eight standard single FPAs API-DLLs Figure 1.3 shows the logical connections between dll files. Remote Control Programming User’s Guide PM024A02 Rev.2...
Page 12
Figure 1.3 The main FlashProCC-FPAsel.dll (Multi-FPA selector) allows to transfer API-DLL functions coming from an application software to desired single application dll (FlashProCC- FPA1.dll to FlashProCC-FPA8.dll). Note: Software package contains one FlashProCC-FPA1.DLL. Files FlashProCC- FPA2.DLL to FlashProCC-FPA8.DLL will be copied automatically if required. The FlashProCC-FPAsel.dll is transparent for all API-DLL functions implemented in the single API-DLLs functions.
Page 13
fpa = 1 to 8 when the only one desired FPA required to be selected fpa = 0 when ALL active FPAs should be selected. 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.
Page 14
The FlashPro-CC 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\CCxx\USB FlashPro-CC\API-DLL FlashProCC-FPAsel.dll...
Page 15
DLL library. The config.ini file has default setup information. This file can be modified and taken directly form the FlashPro-CC Flash Programmer application software. To create required config.ini file the standard FlashPro-CC Flash programmer software should be open and required setup (memory option, communication speed etc) should be created.
C:\Program Files\Elprotronic\CCxx\USB FlashPro-CC\API-DLL-Demo\Cpp Program can be activated by selecting the FlashProCC-DLL-DemoCpp.exe located in the \release subdirectory. This demo program can also be activated from the windows menu: Start->Program->Elprotronic-Flash Programmer->(CCxx) USB FlashPro-CC->FlashProCC-DLL-Demo- Remote Control Programming User’s Guide PM024A02 Rev.2...
Page 17
FPA-8. If for example two FPAs will be used with SN 20070031 and 20070032 then the contents of the FPA’s configuration file will be as follows: ;=================================================================== ; USB-FPA configuration setup ; Elprotronic Inc. ;------------------------------------------------------------------- Figure 2.1 Demo program dialogue screen using DLLs.
Page 18
; 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 from the desires FPA's label * Minimum one FPA's must be specified FPA-x order - any (without semicolon - comment) ;FPA-1 20050116...
Page 19
FlashPro-CC Flash Programming software (GUI) is executed. Also buttons Power ON/OFF, RESET has the same action as related buttons in standard programmer. Refer to the FlashPro-CC Flash Flash Programmer for the CC series devices - User’s Manual for details of these functions.
Page 21
Read XRAM Block Read 16 bytes XRAM starting from address at 0xF000. On the report screen 16 bytes from each target devices taken from addresses 0xF000 to 0xF00F are displayed Write direct RAM Write 16 bytes to direct RAM at location 0x60 to 0x6F using function F_Copy_Buffer_to_direct_RAM( 0x60, 16);...
Page 22
is executed. When program is finished, then XRAM at location should be modified. XRAM contents can be read by pressing the Read XRAM Block button. To make a test do following steps (from the beginning): 1. FPA List 2. Initialization 3.
It is recommended to start the standard FlashPro-CC (GUI) programming software to verify if the hardware and the drivers setup are correct. Using the FlashPro-CC programming software the fully functional setup that satisfy desired requirements should be created. When it is done then using the “File->Save Setup as..”...
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 FlashPro-CC (GUI) software. 1. Download data to target device F_OpenInstancesAndFPAs( “*# *”...
Page 25
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 an autoprogram in the standard FlashPro-CC (GUI) software. 1. Download data to all target devices (uses USB-FPAs) F_OpenInstancesAndFPAs( FPAs-setup.ini);...
Page 26
(but it is not required) as code data downloaded to the target devices connected to second FPA etc. In the example below the downloaded code to target devices are not the same . 2. Download independent data to target devices (uses USB-FPAs) F_OpenInstancesAndFPAs( FPAs-setup.ini);...
4. List of the DLL instructions 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.
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 eight independent FPAs can be remotely controlled from the application software.
F_OpenInstances - API-DLL initialization in the PC. Instruction must be called first - before all other instruction. Instead this function the F_OpenInstancesAndFPAs can be used. Important: not recommended It is to use this function. Function used only for compatible with the old software.
Page 30
2. When the first two characters in the List string are not *#, then string contains file name or full path of the file with list of the FPA’s serial numbers, eg. “C:\Program Files\Elprotronic\FPAs-setup.ini” Return value: number of opened instances 1.
Page 31
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, 0, 20060346, 20060222, 20060245"...
Page 32
“ %8.8li”, Snr[k] ); snlist += buf; F_OpenInstances_AndFPAs( snlist ); 2.The FPA list in the configuration file: String -> “C:\Program Files\Elprotronic\FPAs-setup.ini” Example of the FPA configuration file: -> semicolon - comment Syntax of the FPAs configuration specified FPA-x...
; 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-3...
F_API_DLL_Directory F_API_DLL_Directory - The DLL directory location. VALID FPA index - irrelevant - the same directory location for all DLLs. The F_API_DLL_Directory command can specify the directory path where the DLLs are located. This command is not mandatory and usually is not required. But in some application software (like in the LabVIEW) the default location of the DLLs is not transferred to the DLL.
#define ALL_ACTIVE_FPA 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) F_Get_FPA_index F_Get_FPA_index - Get current FPA index Syntax: BYTE MSPPRG_API F_Get_FPA_index ( void );...
Function allows to enable communication with selected FPA adapter if the mentioned FPA has been disabled using the function F_Disable_FPA_index(...). By default, all FPAs are enabled. Syntax: void MSPPRG_API F_Enable_FPA_index ( BYTE fpa ); Parameters: fpa -> 1 to MAX_FPA_INDEX where MAX_FPA_INDEX F_LastStatus F_LastStatus...
- Single DLL for the USB MSP430-FPA (FlashPro430) DLL ID = 0x3000 - Single API-DLL for the GangPro430 DLL ID = 0x4000 - Single API-DLL for the FlashPro-CC DLL ID = 0x5000 - Single API-DLL for the GangPro-CC DLL ID = 0x6000...
4.2 Generic instructions Generic instructions are related to initialization programmer process, configuration setup and preparation data, turning ON and OFF target’s DC and RESET target device. Any communication with the target device is provided when any of the generic instruction is executed. Generic instructions should be called before encapsulated and sequential instruction.
Page 39
Return value: 0 - FALSE >0 - Detected FPA’s Serial Number Example: long SN[MAX_USB_DEV_NUMBER+1]; F_OpenInstances( 1 ); // DLL initialization - one instance F_Set_FPA_index( // select access to the first instance n = 0; //no of detected FPAs for( k=1; k<=MAX_USB_DEV_NUMBER ; k++ ) SN[k] = F_Check_FPA_access(k);...
- Single DLL for the USB MSP430-FPA (FlashPro430) DLL ID = 0x3000 - Single API-DLL for the GangPro430 DLL ID = 0x4000 - Single API-DLL for the FlashPro-CC DLL ID = 0x5000 - Single API-DLL for the GangPro-CC DLL ID = 0x6000...
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_OpenInstances if none of the instances has not been activated before. That allows to use old application software without calling the new type of Multi-FPA functions. In this case the F_Check_FPA_access function can be used to activate communication between PC and Programming Adapter.
F_Close_All function should be called as the last one before *.dll is closed. When the F_Close_All is called then communication port becomes closed and all internal dynamic data will be released from the memory. To activate communication with the programmer when the function F_Close_All has been used the F_Initialization function must be called first.
Page 43
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 to programmer using F_ConfigSetup function.
F_GetSetup( &config ); //API-DLL - get configuration from the programmer config.CommSpeedIndex = SPEED_3MB_INDEX; //select JTAG interface config.FlashEraseModeIndex = ERASE_ALL_MEM_INDEX; //select all memory erase option F_ConfigSetup( config ); //API-DLL - setup configuration in the programmer F_SetConfig F_SetConfig - Setup one item of the programmer’s configuration. VALID FPA index - ( 1 to 8 ) or 0 (ALL FPAs) executed sequentially.
Index’s list - see F_SetConfig Return value: Requested setup parameter; Example: ..........F_GetSetup( config ); DeviceIndex = config.DeviceIndex; or directly DeviceIndex = F_GetConfig( CFG_MICROCONTROLLER ); ....... F_DispSetup F_DispSetup - Copy programmer’s configuration to report message buffer in text form. VALID FPA index - ( 1 to 8 ) Syntax:...
Page 52
VALID FPA index - ( 1 to 8 ) When any of the DLL functions is activated, a message is created and displayed on the dynamically created programmer’s dialogue box. At the end of execution the dialogue box is closed and function returns back to the application program. Reported message is closed as well. The last report message can be read by application program using F_ReportMessage function.
void CMspPrgDemoDlg::Disp_report_message() char text[REPORT_MESSAGE_MAX_SIZE]; F_ReportMessage( text ); //API-Dll - get last report message Message = text; SetDlgItemText(IDC_REPORT, Message.GetBuffer(Message.GetLength())); CEdit* pEdit = (CEdit*) GetDlgItem(IDC_REPORT); pEdit->LineScroll(pEdit->GetLineCount(), 0); UpdateWindow(); F_GetReportMessageChar F_GetReportMessageChar - Get one character of the the last report message from the programmer.
Return value: (0xFFFe & info) | state where state is defined as follows: 0 - FALSE 1 - TRUE 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: ....st = F_ReadCodeFile( FILE_TI_FORMAT, “c:\test\demofile.txt” ); if(( st &...
The F_ConfigFileLoad function can download the programmer setup from the external setup file. Setup file can be created using standard FlashPro-CC (GUI) Flash Programmer software. When the setup from the file is downloaded, then old configuration setup is overwritten. The new setup can be modified using F_GetSetup and F_ConfigSetup functions.
filename - configuration file name including path, file name and extention Return value: 0 - FALSE 1 - TRUE (0xFFFe & info) | state where state is defined as follows: 0 - FALSE 1 - TRUE info is defined as follows: error ->...
F_Put_Byte_to_Code_Buffer F_Put_Byte_to_Code_Buffer - Write code data to code buffer. VALID FPA index - ( 1 to 8 ) 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).
Parameters value: code address - 0x0 to MAX_FLASH_SIZE-1 (0x1FFFF) Return value: 0x00 to 0xFF - valid code data -1 (0xFFFF) - code data not initialized on particular address F_Put_IEEEAddr64_to_Buffer F_Put_IEEEAddr64_to_Buffer - Write IEEE address to buffer. VALID FPA index - ( 1 to 8 ). Instruction allows to write one unique IEEE address to buffer.
Instruction is functionally the same as the F_Put_IEEEAddr64_to_Buffer, but allows to transfer byte by byte of the 64 IEEE address to buffer. Function is used when the Visual Basic 6 is used, that not support the Int 64 bits data. no ->...
When no = 0, the lowest byte of the IEEEAddr is transferred. When no = 7, the highest byte of the IEEEAddr is transferred. Parameters value: no - byte number of the 64 bits IEEEAddr data Return value: one byte of the IEEEAddr F_Power_Target F_Power_Target - Turn ON or OFF power from programming adapter to target...
VALID FPA index - ( 1 to 8 ) or 0 (ALL FPAs) executed sequentially. Function F_Reset_Target resets target device and target device’s application program can start. Length of the RESET pulse time is specified by ResetTimeIndex in configuration setup. See F_ConfigSetup description for details.
4.3 Encapsulated instructions Encapsulated functions are powerful and easy to use. When called then all device actions from the beginning to the end are done automatically and final result is reported as TRUE or FALSE. Required configuration should be set first using F_GetSetup and F_ConfigSetup functions. Encapsulated function has following sequence: Power from the programming adapter becomes ON if PowerTargetEn in configuration setup is enabled.
F_Verify_Lock_Bits -Verify the Lock debug Bit. If debug access is disabled, then only debug bit is verified. Other bits are not accessible when the debug bit enable is clear. VALID FPA index - ( 1 to 8 ) or 0 (ALL FPAs) executed simultaneously. Lock Protection bits bit-4 0x10 - Boot Block Lock...
VALID FPA index - ( 1 to 8 ) or 0 (ALL FPAs) executed simultaneously. Note: During the verification process either all memory or just the selected part of the memory is verified, depending on settings specified in the configuration setup FlashEraseModeIndex Only data taken from the Code file are compared with the target’s flash memory.
for( addr=0x0; addr<MAX_FLASH_SIZE; addr++) data[addr] = F_Get_Byte_from_Buffer( addr ); ....F_Write_IEEE_Address F_Write_IEEE_Address - Write content taken from the IEEE Address buffer to target devices. Write IEEE address option should be enabled in the configuration setup. VALID FPA index - ( 1 to 8 ) or 0 (ALL FPAs) executed simultaneously. Syntax: INT_X MSPPRG_API F_Write_IEEE_Address( void );...
Return value: 0 - FALSE 1 - TRUE Example: #define “FlashProCC-Dll.h”; ULONG64 IEEE; F_Read_IEEE_Address(); IEEE = F_Get_IEEEAddr64_from_Buffer(); F_Write_Lock_Bits F_Write_Lock_Bits - Write lock bits to target devices. Contents of the lock bits should be set first using configuration setup instructions. VALID FPA index - ( 1 to 8 ) or 0 (ALL FPAs) executed sequentially.
4.4 Sequential instructions Sequential instructions allow access to the target device in any combination of the small instructions like erase, read, write sector, modify part of memory etc. Sequential instruction have an access only when communication between target device and programming adapter is initialized. This can be done when F_Open_Target_Device instruction is called.
F_Open_Target_Device F_Open_Target_Device - Initialization communication with the target device. VALID FPA index - ( 1 to 8 ) or 0 (ALL FPAs) executed simultaneously. When F_Open_Target_Device is executed, then Power from the programming adapter becomes ON if PowerTargetEn in configuration setup is enabled.
F_Close_Target_Device - Termination communication between target device and programming adapter. VALID FPA index - ( 1 to 8 ) or 0 (ALL FPAs) executed sequentially. Instruction should be called on the end of the sequential instructions. When F_Close_Target_Device instruction is executed then: Communication between target device and programming adapter is terminated.
MSPPRG_API INT_X F_Segment_Erase( INT_X address ); Return value: 0 - FALSE 1 - TRUE Example: ....F_Segment_Erase(0x4000); // erase segment 0x4000 to 0x47FF F_Segment_Erase(0x4100); // erase the same segment ....F_Sectors_Blank_Check F_Sectors_Blank_Check - Blank check part or all Flash Memory. Start and stop address of the tested memory should be specified.
F_Write_Byte_to_XRAM - Write one byte to XRAM. VALID FPA index - ( 1 to 8 ) or 0 (ALL FPAs). Write one byte to any XRAM location of the target devices. Parameters: address - address where XRAM is located 0xDF00 to 0xFFFF, data - one byte to be written to target device Syntax:...
F_Write_Byte_to_direct_RAM F_Write_Byte_to_direct_RAM - Write one byte to direct RAM. VALID FPA index - ( 1 to 8 ) or 0 (ALL FPAs) executed sequentially. Write one byte to any direct RAM location of the target devices. Parameters: address - address where RAM is located 0x00 to 0xFF, data - one byte to be written to target device Syntax:...
0x00 to 0xFF - valid code data -1 (0xFFFF) - FALSE Example: F_Read_Byte_from_direct_RAM( 0x60 ); F_Copy_Buffer_to_Flash F_Copy_Buffer_to_Flash - Write data from the Buffer to target devices. VALID FPA index - ( 1 to 8 ) or 0 (ALL FPAs) executed sequentially. Parameters: start address - Flash address from 0x0 to 0x1FFFF,...
F_Copy_Flash_to_Buffer - Read specified in “size” number of bytes from Flash and save it in the temporary buffer. Starting address is specified in the “start address”. VALID FPA index - ( 1 to 8 ) or 0 (ALL FPAs) executed sequentially. Syntax: MSPPRG_API INT_X...
for( addr = 0x60; addr<0x7f; addr++ ) st = F_Put_Byte_To_Buffer( addr, data[addr] ); st = F_Copy_Buffer_to_direct_RAM( 0x60, 0x20 ); ....F_Copy_direct_RAM_to_Buffer F_Copy_direct_RAM_to_Buffer - Read specified in “size” number of bytes from the direct RAM and save it in the temporary buffer. Starting address is specified in the “start address”.
NOTE: DLL contains two Buffers - one is dedicated to the data READ from target devices, second one is dedicated to the data to be WRITE to the target devices. Contents of the Buffers can not be verified by writing and read the same data to the Buffers e.g. F_Put_Byte_to_Buffer (0x1000, 5);...
F_Set_PC_and_RUN - Instructions allows to run program in microcontroller from specified PC in the XRAM or Flash location. Program should be downloaded first using the Write to Flash or XRAM procedures. Note: The F_Open_Target_Device instruction is resetting the CPU. All internal registers states are set to default value.
Page 83
0x40 - PCON Idle 0x20 - CPU halted 0x10 - Power Mode 0 0x08 - Halt Status 0x04 - Debug Locked 0x02 - Oscillator stable 0x01 - Stack overflow Return value: data from the MCU buffer. Remote Control Programming User’s Guide PM024A02 Rev.2...
Appendix A FlashPro-CC Command Line interpreter The Multi-FPA API-DLL can be used with the command line interpreter shell. This shell allows to use the standard Command Prompt windows or script file to execute the API-DLL functions. All required files are located in the directory...
Page 85
Press ENTER - result ->1 (OK) Type: F_Initialization() //initialization with config taken from the config.ini //setup taken from the FlashPro-CC - with defined CCxx type, code file etc. Press ENTER - result ->1 (OK) Type: F_AutoProgram( 0 ) Press ENTER - result ->1...
Page 86
Example-2: Run the FP-CC-commandline.exe and type the following commands: F_OpenInstancesAndFPAs( "*# *" ) // open instances and find the first adapter (any SN) F_Initialization() F_Report_Message() F_ConfigFileLoad( "filename" ) //put vaild path and config file name F_ReadCodeFile( 1, "FileName" ) //put vaild path and code file name (TI.txt format) F_AutoProgram( 0 ) F_Report_Message() ......
Page 87
List of command line instructions quit() ;close the command interpreter program help() ;display list below F_Trace_ON() F_Trace_OFF() F_OpenInstances( no ) F_CloseInstances() F_OpenInstancesAndFPAs( "FileName" ) F_Set_FPA_index( fpa ) F_Get_FPA_index() F_LastStatus( fpa ) F_DLLTypeVer() F_Multi_DLLTypeVer() F_Check_FPA_access(index ) F_Get_FPA_SN( fpa ) F_APIDLL_Directory( "APIDLLpath" ) F_Initialization() F_DispSetup() F_Close_All()
Need help?
Do you have a question about the FlashPro-CC and is the answer not in the manual?
Questions and answers