Flash programmer for the ti's msp430fxx microcontrollers (122 pages)
Summary of Contents for Elprotronic MSP430
Page 1
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.
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 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.
Page 10
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.
Page 11
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.
Page 12
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.
Page 13
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.
Page 14
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...
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.
Page 16
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.
Software can be activated from the Start menu Start -> Programs -> Elprotronic-Flash Programmers -> (MSP430) FlashPro430 -> FlashPro430 Self Test or by running the program from the location FlashPro430SelfTest.exe...
Page 18
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.
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 C:\Program Files\Elprotronic\MSP430\FET-Pro430\SelfTest and contains following files MSP430FPA.dll...
Page 20
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...
Page 21
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.
Page 22
long info_segm_size; long no_of_info_segm; long RAM_size; group; 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.
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.
Page 24
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...
Page 25
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.
Page 26
All other buttons used in the demo program are calling one API-DLL function per one button. For example button ‘Autoprogram’ is calling (1); F_Autoprogram 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.
Page 27
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.
Page 28
‘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.
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.
..........} 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.
Page 31
1. Download data to all target devices (uses USB-FPAs) 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 F_ReadConfigFile( filename );...
Page 32
F_Initialization( ); // init all FPA’s ..............F_Set_FPA_index( ALL_ACTIVE_FPA // select all FPA’s F_ReadConfigFile( filename ); // read configuration data and save // to all API-DLLs F_Set_FPA_index( 1 ); // select FPA 1 F_ReadCodeFile( format, filename1 ); // read code data and save to // API-DLL-1 F_Set_FPA_index( 2 );...
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.
Page 34
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.
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.
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.
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. “C:\Program Files\Elprotronic\FPAs-setup.ini” Return value: number of opened instances...
Page 39
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 ‘*’...
Page 40
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...
Page 41
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 ;...
Page 42
; 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...
F_ReadConfigFile( filename ); //download the same configuration to all DLLs. F_ReadCodeFile( format, filename ); //download the same code file to all DLLs. 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 .......
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).
Syntax: INT_X MSPPRG_API F_Check_FPA_index ( void ); Return value: current FPA index ( 0, 1 to 64) or -2 (minus two) FPA_INVALID_NO F_Disable_FPA_index F_Disable_FPA_index - Disable desired FPA index (desired DLL instance) VALID FPA index - ( 1 to 64 ) Function allows to disable communication with selected FPA adapter.
F_LastStatus F_LastStatus - Get current FPA index VALID FPA index - ( 1 to 64 ) Syntax: INT_X MSPPRG_API F_LastStatus ( BYTE fpa ); Parameters: fpa - FPA index of the desired status fpa index -> 1..64 Return value: Last status from the desired FPAs All F_xxx functions returns the same parameters (status) as the original API_DLL is returning.
Version = (0x0FFF & VALUE) F_Get_FPA_SN F_Get_FPA_SN - Get FPAs Serial number assigned to selected FPA-index (selected DLL instance number). Syntax: LONG_X MSPPRG_API F_Get_FPA_SN ( BYTE fpa ); Parameters: fpa - FPA index of the desired status fpa index -> 1..64 Return value: Serial number of the selected FPA or FPA_INVALID_NO - if used fpa index is not activated or out of range.
F_Check_FPA_access F_Check_FPA_access - Check available Flash Programming Adapter (USB-MSP430-FPA or MSP-FET430UIF) connected to specified USB drivers (USB driver index from 1 to 64) VALID FPA index (DLL instance number) - ( 1 to 64 )
Return value: 0 - FALSE >0 - Detected USB-MSP430-FPA or MSP-FET430UIF 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;...
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.
Syntax: MSPPRG_API void F_API_DLL_Directory( Cstring APIDLLpath ); MSPPRG_API void F_APIDLL_Directory( char* APIDLLpath ); Example: ......F_API_DLL_Directory( “C:\\Program Files\\Test\\” ); // directory where the API-DLLs are located If( F_Initialization() != TRUE ) //required API-Dll - initialization // Initialization error ......F_Close_All F_Close_All - Close communication with the programming adapter and release PC memory.
Page 56
3 - MSP430F1101A 4 - MSP430F1111A 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().
Page 57
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 EraseSegmA, EraseSegmB, EraseFlashStartAddr, EraseFlashStopAddr [ CFG_ERASEINFOA 6 ] EraseSegmA - Info Segment A (0x1080-0x10fF) Erase/Write/Verify, - in the MSP430F2xx - (0x10C0-0x10fF) FlashEraseModeIndex = ERASE_DEF_CM_INDEX [ CFG_ERASEINFOB 7 ]...
Page 58
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 FlashReadModeIndex = READ_DEF_MEM_INDEX [ CFG_READSTARTADDR 13 ]...
Page 59
JTAG_SPEED_400K_INDEX //JTAG 400kb/s, Spy-Bi-Wire->SLOW [ CFG_VCCINDEX 25 ] VccIndex - valid for the USB-MSP430-FPA version 2.x and higher VCC_2V2_INDEX VCC_2V4_INDEX VCC_2V6_INDEX VCC_2V8_INDEX VCC_3V0_INDEX VCC_3V2_INDEX VCC_3V4_INDEX VCC_3V6_INDEX [ CFG_CUSTOMRESETPULSETIME 26 ] CustomResetPulseTime value 1 to 1000 step 1 in miliseconds valid only when the ResetTimeIndex = RESET_CUSTOM_INDEX...
Page 60
(See FlashPro430 Manual - chapter 6) Disable retain the DCO Calibration Data for the F2xx family. 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_INDEX 35 ] (See FlashPro430 Manual - chapter 6) Disable retain the user defined data in flash.
Page 61
[ CFG_DCO6_CAL_FREQ_INDEX 56 ] [ CFG_DCO7_CAL_FREQ_INDEX 57 ] [ CFG_DCO8_CAL_FREQ_INDEX 58 ] range from 100 to 16000 (100kHz to 16 MHz) see the MSP430 data sheet for acceptable freq range. [ CFG_DCO_DEFINED_ADDR_EN 59 ] 0-disable, 1-enable [ CFG_DCO_DEFINED_ADDRESS 60 ]...
Similar to the F_ConfigSetup, but only one item from the structure is modified. CONFIG_BLOCK Syntax: MSPPRG_API INT_X F_SetConfig( INT_X index, LONG_X data ); See index list in the F_ConfigSetup for details. Return value: 0 - FALSE 1 - TRUE -2 - FPA_INVALID_NO Example: .......
F_Set_MCU_Name - Set microcontroller type. VALID FPA index - ( 1 to 64 ) The F_Set_MCU_Name(..) replaced the old function F_SetConfig( CFG_MICROCONTROLLER, MCU_index ); The MCU name must be entered exactly with the same name as it is in the GUI software - MCU type pull down menu.
Page 66
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 ->...
Page 67
............. response = F_OpenInstancesAndFPAs( "*# *" ); //get first FPA if( response > 0 ) response = F_Set_FPA_index( 1 ); response = F_Initialization(); get_device_names(); //now you can read data from API-DLL ............get_device_names( void ) int n,k, st, index_bak, max_up_index; DEVICELIST tmp;...
with the target device, then the report message will collect all reported information up to 1000 last characters. Syntax: MSPPRG_API void F_ReportMessage( char * text ); MSPPRG_API char* F_Report_Message( void ); Return value: none F_Report_Message note: is available only with the Multi-FPA API-DLL. Example: char text[1002];...
F_GetReportMessageChar allows to get character by character from the report message buffer. This function is useful in the Visual Basic application, where all message can not be transfered via pointer like it is possible in the C++ application. Syntax: MSPPRG_API char F_GetReportMessageChar( INT_X index );...
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.
Function F_Power_Target switches ON or OFF power from the programming adapter to the target device. Note: PowerTargetEn flag must be set to TRUE (1) in the configuration setup to switch the power from the programming adapter ON. Syntax: MSPPRG_API INT_X F_Power_Target( INT_X OnOff );...
F_Get_Targets_Vcc F_Get_Targets_Vcc - Get Vcc in [mV] supplied target device. VALID FPA index - ( 1 to 64 ) Syntax: MSPPRG_API INT_X F_Get_Targets_Vcc( void ); Return value: INT_X - Vcc in milivolts e.g 3000 -> 3.0 V or (-1) if USB-FPA is not active. -2 (0xFFFFFFFE) - FPA_INVALID_NO F_Set_fpa_io_state...
4.3 Data Buffers access instructions 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.
Page 76
- 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.
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 ).
MSPPRG_API INT_X F_Read_PasswFile( INT_X file_format, CString FileName ); 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...
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_ReadPasswordFile instruction. Note: All 32 bytes of the password data must be written to the Password buffer to make a valid password for the BSL access. Syntax: MSPPRG_API INT_X...
0x00 to 0xFF - valid code data -1 (0xFFFFFFFF) - code data not initialized on particular address -2 (0xFFFFFFFE) - FPA_INVALID_NO F_Put_Byte_to_Buffer F_Put_Byte_to_Buffer - Write byte to temporary Write Data Buffer (See Figure 4.2) VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed sequentially. Syntax: MSPPRG_API INT_X F_Put_Byte_to_Buffer( LONG_X address, BYTE data );...
Page 83
Syntax: MSPPRG_API BYTE F_Get_Byte_from_Buffer( LONG_X address ); Return value: Requested byte from the specified address of the Read Data Buffer. Example: see F_Copy_All_Flash_To_Buffer, F_Copy_Flash_to_Buffer, F_Copy_RAM_to_Buffer.
4.4 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. Also Code file and Password File (if required) should be opened first.
F_Get_Byte_From_Buffer(...). The size of the Read Data Buffer is adjusted to the latest size of the MSP430 flash memory and user can read only desired data size from this buffer, avoiding crashing problem if from any reason the data buffer size in user’s application software is too small.
....st = F_Memory_Read( data ); if ( st != TRUE ) { ....} ....F_Copy_All_Flash_to_Buffer F_Copy_All_Flash_to_Buffer - Read contents of the Target’s Flash Memory and save it in the temporary Read Data buffer (see Figure 4.2). VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed simultaneously.
Also the same bytes / words can be programmed few times. Software is not be able to control how many times the same location of the flash has been programmed between erasures. User should take a full responsibility to program the flash memory according to the MSP430 specifications. See TI’s data sheets and manuals for details.
This time can exceed the cumulative time for the older MSP430 microcontrollers. From that reason the USB-MSP430-FPA uses the word write mode that allows to decrease 2 times the cumulative time. = 32(words) * 75 us = 2.4 ms. F_Open_Target_Device F_Open_Target_Device - Initialization communication with the target device.
Parameters: segment address - Even number from 0x1000 to 0x1FFFE, To erase a memory segment specify an address within that memory segment. For example to erase segment 0x2000-0x21FF any address from the range 0x2000 to 0x21FF can be specified. To erase all memory segments, erase the memory segment by segment, or used the encapsulated instruction F_Memory_Erase(1);...
Read one word to any location of the target device. Parameters: - Even address from 0x0000 to 0x1FFFE, address Syntax: MSPPRG_API INT_X F_Read_Word( LONG_X addr ); Return value: data - one word -2 (0xFFFFFFFE) - FPA_INVALID_NO Example: data = F_Read_Word( 0x0124 ); F_Write_Byte F_Write_Word - Write one byte to RAM, registers, IO etc.
F_Read_Byte F_Read_Byte - Read one byte from RAM, registers, IO, Flash etc. VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed sequentially. NOTE: Instruction not supported in BSL and Fast BSL. Read one byte from any location of the target device. Parameters: address - Any address from 0x0000 to 0x1FFFF,...
Example: unsigned char rd_data[0x800]; int st; ....st = F_Memory_Read_Data( 0x1000, 0x800, rd_data ); if ( st != TRUE ) { ....} ....F_Copy_Buffer_to_Flash F_Copy_Buffer_to_Flash - Write “size” number of bytes from the Write Data Buffer (see Figure 4.2) to flash. Starting address is specified in the “start address”. VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed sequentially.
Example: ........for( addr = 0x1000; addr<0x1100; addr++ ) st = F_Put_Byte_To_Buffer( addr, data[addr] ); st = F_Copy_Buffer_to_Flash( 0x1000, 0x100 ); ....F_Copy_Flash_to_Buffer F_Copy_Flash_to_Buffer - Read specified in “size” number of bytes from the Flash and save it in the Read Data Buffer (see Figure 4.2). Starting address is specified in the “start address”.
F_Copy_Buffer_to_RAM F_Copy_Buffer_to_RAM - Write “size” number of bytes from Write Data Buffer (see figure 4.2) to RAM. Starting address is specified in the “start address”. VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed sequentially. Note: When the BSL or Fast BSL is used then an access to RAM location 0x200 to 0x2FF is blocked.
Parameters: start address - Even address size - Even number Return value: 1 - TRUE if data has been read successfully 0 - otherwise FALSE. -2 - FPA_INVALID_NO. NOTE: Specified address in the Read Data Buffer is the same as a physical RAM address.
Page 103
Syntax: MSPPRG_API INT_X F_Set_PC_and_RUN( LONG_X PC_address ); Return value: 1 - TRUE 0 - FALSE; -2 - FPA_INVALID_NO. Example: unsigned char rd_data[0x100]; ....F_Autoprogram(0); // download the test code F_Open_Target_Device(); ....F_Set_PC_and_RUN( PC1 ) // run the test program from location PC1 // monitor PC address until PC address reach the desired value with // timeout set by k and delay for(k=0;...
F_Copy_RAM_to_Buffer( address, size ); // read the test-1 result from the RAM //using F_Get_Byte_from_Buffer(..) F_Close_Target_Device(); ....F_Autoprogram(0); // download the final code F_Capture_PC_Addr F_Capture_PC_Addr - Instructions monitoring the PC address on fly without stopping the MCU VALID FPA index - ( 1 to 64 ) NOTE: Instruction not supported in BSL and Fast BSL.
Return value: 1 - TRUE 0 - FALSE; -2 - FPA_INVALID_NO. Example: See example in the F_Set_PC_and_RUN instruction. F_Blow_Fuse F_Blow_Fuse - Blow the security fuse instruction. VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed sequentially. NOTE: Instruction not supported in BSL and Fast BSL.
Page 106
........// prepare next microcontroller F_SetConfig( CFG_INTERFACE, INTERFACE_JTAG);//select JTAG interface F_SetConfig( CFG_BLOWFUSE, 0 )//disable fuse blow option ......// modify configuration if required st = F_AutoProgram(0); ....// do extra communication with // the target device F_SetConfig( CFG_BLOWFUSE, 1 )//enable fuse blow option st = F_Blow_Fuse( void );...
F_Adj_DCO_Frequency F_Adj_DCO_Frequency - Adjust DCO to desired frequency and return register value for that frequency. VALID FPA index - ( 1 to 64 ) or 0 (ALL FPAs) executed sequentially. Syntax: MSPPRG_API INT_X F_Adj_DCO_Frequency( INT_X freq_Hz freq_Hz - 100000 to 16000000 (100kHz to 16 MHz) Return value: -1 - FALSE;...
Page 108
freq = F_Test_DCO_Frequency( 0x1234 ); When more then one FPA is used then instruction can be executed simultaneously and register value read after the function if finished in all targets. F_Set_FPA_index( ALL_ACTIVE_FPA // select all FPA’s F_Test_DCO_Frequency( 0x1234 ); for (n=1; n<=MAX_FPA_INDEX; n++ ) Freq[n] = F_LastStatus( n);...
TDO, TCK and read sequence on the input TDI line. These instructions are useful in development - not exactly related to MSP430 microcontrollers. Instructions allows to transfer sequences from PC via USB to target device. JTAG protocol and list of high level instructions should be created by user.
Page 110
Max stream size - up to 120 data block will be transmitted in 600 us. One 120 block size slot allows to transmit 2 to 3 full JTAG sequences. See attached in the software package example C:\Program Files\Elprotronic\USB FlashPro430\API-DLL-Demo\JTAG-Stream how the customized JTAG instruction can be used. Package contains one source file FPA-JTAG-Demp.cpp...
Page 111
C:\Program Files\Elprotronic\USB FlashPro430\API-DLL-Demo\JTAG-Stream\Release executable file uses standard DLLs (attached in this subdirectory). To create JTAG sequences run the executable file with argument contains JTAG sequences in hex string. For the example described above 0x0, 0xD, 0x8, 0x1 following program with argument 0D81 should be executed from the DOS Command Prompt box.
4.7 UART The FPA adapter (FlafhPro430 - USB-MSP430-FPA only) can provide UART communication via BSL-Tx and BSL-Rx pins (#12 and #14). The UART is simplified and has following limitations: - can be used only when the BSL communication is not used, - message via UART can be send and received when the JTAG communication is finished eg.
Page 113
-2 (0xFFFFFFFE) - FPA_INVALID_NO The FPA adapter (FlafhPro430 - USB-MSP430-FPA only) can provide UART communication via BSL-Tx and BSL-Rx pins (#12 and #14). Message to be send should be located in the data buffer using instruction F_Put_Byte_to_Buffer( addr, data). Received result via UART is located in the buffer and can be taken from it using instruction data = F_Get_Byte_from_Buffer( addr).
Page 114
//make sure the Vcc is ON -place required instruction to supply the Vcc //put UART Tx message to data buffer for(k=0; k<Tx_size; k++ ) //max TX size - 56 F_Put_Byte_to_Buffer( UART_BUFFER_START_ADDR+k, *(TxData+k)); //put Tx_size and Rx_size to data buffer F_Put_Byte_to_Buffer( UART_TX_SIZE_ADDR, Tx_size );...
The Multi-FPA API-DLL can be used with the command line interpreter shell. This shell allows to use the standard Command Prompt windows to execute the API-DLL functions. All required files are located in the directory C:\Program Files\Elprotronic\MSP430\USB FlashPro430\CMD-line and contains FP430-commandline.exe ->...
Page 116
Type: F_Initialization() //initialization with config taken from the config.ini //setup taken from the FlashPro430 - with defined MSP430 type, code file etc. Press ENTER - result ->1 (OK) Type: F_AutoProgram( 0 ) Press ENTER - result ->1 (OK) Type: F_Report_Message() Press ENTER - result ->...
Page 117
Example-2: Run the FP430-commandline.exe and type following instructions: 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 118
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 MSP430 and is the answer not in the manual?
Questions and answers