Main Page | Data Structures | File List | Data Fields | Globals

MSP430.h File Reference


Detailed Description

This file contains the Application Programming Interface (API) to access an MSP430 microcontroller via JTAG using the MSP430.DLL. This file contains the DLL function headers and definitions.

The MSP430.DLL provides the following functionalities:

Project:
MSP430 JTAG Interface (MSP430.dll)
Developed using:
MS Visual C++ 2003/2010
Version:
3.02.05.004
Supported API calls:

Version History:

Go to the source code of this file.

Data Structures

union  DEVICE_T
 Device information structure. More...


Typedefs

typedef LONG STATUS_T
 this is the definition for the DLL functions return value

typedef enum STATUS_CODE STATUS_CODE_t
 Status codes of the DLL functions.

typedef DEVICE_T DEVICE_T_t
 Device information structure.

typedef enum CPU_ARCH_TYPE CPU_ARCH_TYPE_t
typedef enum READ_WRITE READ_WRITE_t
typedef enum ENABLE_DISABLE ENABLE_DISABLE_t
typedef enum RESET_METHOD RESET_METHOD_t
 Device reset methods.

typedef enum ERASE_TYPE ERASE_TYPE_t
 FLASH erase type.

typedef enum CONFIG_MODE CONFIG_MODE_t
 Configurations to set with MSP430_Configure.

typedef enum INTERFACE_TYPE INTERFACE_TYPE_t
 Configurations values for CONFIG_MODE INTERFACE_MODE.

typedef enum FILE_TYPE FILE_TYPE_t
 File types.

typedef enum ERROR_CODE ERROR_CODE_t
typedef enum SYSTEM_EVENT_MSP SYSTEM_EVENT_MSP_t
typedef void(* SYSTEM_NOTIFY_CALLBACK )(SYSTEM_EVENT_MSP_t MySystemEvent)

Enumerations

enum  STATUS_CODE {
  STATUS_ERROR = -1,
  STATUS_OK = 0
}
 Status codes of the DLL functions. More...

enum  CPU_ARCH_TYPE {
  CPU_ARCH_ORIGINAL,
  CPU_ARCH_X,
  CPU_ARCH_XV2
}
enum  READ_WRITE {
  WRITE = 0,
  READ = 1
}
enum  ENABLE_DISABLE {
  DISABLE = 0,
  ENABLE = 1
}
enum  RESET_METHOD {
  PUC_RESET = (1 << 0),
  RST_RESET = (1 << 1),
  VCC_RESET = (1 << 2),
  FORCE_RESET = (1 << 3),
  ALL_RESETS = (PUC_RESET | RST_RESET | VCC_RESET),
  FORCE_PUC_RESET = (FORCE_RESET | PUC_RESET),
  FORCE_RST_RESET = (FORCE_RESET | RST_RESET),
  FORCE_VCC_RESET = (FORCE_RESET | VCC_RESET)
}
 Device reset methods. More...

enum  ERASE_TYPE {
  ERASE_SEGMENT = 0,
  ERASE_MAIN = 1,
  ERASE_ALL = 2,
  ERASE_TOTAL = 3
}
 FLASH erase type. More...

enum  CONFIG_MODE {
  VERIFICATION_MODE = 0,
  EMULATION_MODE = 1,
  LOCKED_FLASH_ACCESS = 5,
  EDT_TRACE_MODE = 7,
  INTERFACE_MODE = 8,
  SET_MDB_BEFORE_RUN = 9,
  RAM_PRESERVE_MODE = 10,
  UNLOCK_BSL_MODE = 11,
  DEVICE_CODE = 12,
  WRITE_EXTERNAL_MEMORY = 13,
  DEBUG_LPM_X = 14,
  JTAG_SPEED = 15,
  TOTAL_ERASE_DEVICE = 16
}
 Configurations to set with MSP430_Configure. More...

enum  INTERFACE_TYPE {
  JTAG_IF = 0,
  SPYBIWIRE_IF = 1,
  SPYBIWIREJTAG_IF = 2,
  AUTOMATIC_IF = 3
}
 Configurations values for CONFIG_MODE INTERFACE_MODE. More...

enum  FILE_TYPE {
  FILETYPE_AUTO,
  FILETYPE_TI_TXT,
  FILETYPE_INTEL_HEX
}
 File types. More...

enum  ERROR_CODE { ERROR_DEFINITIONS }
enum  SYSTEM_EVENT_MSP {
  FET_CONNECTION_LOST,
  DEVICE_CONNECTION_LOST,
  FET_RESTART_NEEDED,
  DEVICE_IN_LPM5_MODE,
  DEVICE_WAKEUP_LPM5_MODE
}

Functions

STATUS_T WINAPI MSP430_SET_SYSTEM_NOTIFY_CALLBACK (SYSTEM_NOTIFY_CALLBACK parSystemNotifyCallback)
 Initialize the SYSTEM NOTIFYCALLBACK.

DLL430_SYMBOL STATUS_T WINAPI MSP430_Initialize (CHAR *port, LONG *version)
 Initialize the interface.

DLL430_SYMBOL STATUS_T WINAPI MSP430_Close (LONG vccOff)
 Close the interface.

DLL430_SYMBOL STATUS_T WINAPI MSP430_GetJtagID (LONG *JtagId)
 Return JTAG Id.

STATUS_T WINAPI MSP430_GetFoundDevice (CHAR *FoundDevice, LONG count)
 Return an instance of the Found device.

STATUS_T WINAPI MSP430_OpenDevice (CHAR *Device, CHAR *Password, LONG PwLength, LONG DeviceCode, LONG setId)
 Identify the device, and compare the found device to the expected device.

DLL430_SYMBOL STATUS_T WINAPI MSP430_Device (LONG localDeviceId, CHAR *buffer, LONG count)
 Obtain the device information.

DLL430_SYMBOL STATUS_T WINAPI MSP430_Configure (LONG mode, LONG value)
 Configure the mode(s) of the device and/or the software. Possible configuration modes are covered by the enum CONFIG_MODE. See notes for details of different modes to be configured.

DLL430_SYMBOL STATUS_T WINAPI MSP430_VCC (LONG voltage)
 Set the device Vcc pin to voltage/1000 volts.
The USB JTAG adaptor also checks if external power is supplied to the traget device. If an external voltage is detected MSP430_VCC() returns STATUS_ERROR and one of the corresponding error codes.

DLL430_SYMBOL STATUS_T WINAPI MSP430_GetCurVCCT (LONG *voltage)
 Report back the current voltage supplied to the target device.

DLL430_SYMBOL STATUS_T WINAPI MSP430_GetExtVoltage (LONG *voltage, LONG *state)
 Detect if external voltage is supplied to the target device. Report back the value of an external voltage as well as an corresponding state.

DLL430_SYMBOL STATUS_T WINAPI MSP430_Reset (LONG method, LONG execute, LONG releaseJTAG)
 Reset the device using the specified method(s). Optionally start device execution, and release the JTAG control signals.

DLL430_SYMBOL STATUS_T WINAPI MSP430_Erase (LONG type, LONG address, LONG length)
 Erase the device FLASH/FRAM memory.

DLL430_SYMBOL STATUS_T WINAPI MSP430_Memory (LONG address, CHAR *buffer, LONG count, LONG rw)
 Read and write the device memory. "Device memory" includes the Special Function Registers (i.e., peripheral registers), RAM, Information (FLASH/FRAM) memory, Bootstrap Loader memory (BLS) and Main (FLASH/FRAM) memory.

DLL430_SYMBOL STATUS_T WINAPI MSP430_Secure (void)
 The device is secured (i.e., the JTAG security fuse is blown).
The MSP-FET430PIF LPT JTAG adaptor >>> DOES NOT <<< implement the functionality required to blow the device security fuse.
MSP-FET430UIF USB JTAG adaptor >>> DOES <<< support this feature.

DLL430_SYMBOL STATUS_T WINAPI MSP430_ReadOutFile (LONG wStart, LONG wLength, CHAR *lpszFileName, LONG iFileType)
 Read the specified range of device memory, and write it to the specified file.

DLL430_SYMBOL STATUS_T WINAPI MSP430_ProgramFile (CHAR *File, LONG eraseType, LONG verifyMem)
 The contents of the specified file are input, and then written to the device. The device is optionally erased prior to being written. The device is optionally verified after being written.

DLL430_SYMBOL STATUS_T WINAPI MSP430_VerifyFile (CHAR *File)
 Compare the MSP430 memory and the contents of the specified file.

DLL430_SYMBOL STATUS_T WINAPI MSP430_VerifyMem (LONG StartAddr, LONG Length, CHAR *DataArray)
 Compare the MSP430 memory and the specified data.

DLL430_SYMBOL STATUS_T WINAPI MSP430_EraseCheck (LONG StartAddr, LONG Length)
 Verify that the specified memory range is erased.

DLL430_SYMBOL LONG WINAPI MSP430_Error_Number (void)
 Determine the number of the error when a MSP430_xxx() function returns STATUS_ERROR.

DLL430_SYMBOL const CHAR
*WINAPI 
MSP430_Error_String (LONG errorNumber)
 Determine the string associated with errorNumber.

DLL430_SYMBOL STATUS_T WINAPI MSP430_GetNumberOfUsbIfs (LONG *Number)
 Returns the number of MSP-FET430UIF USB FETs connected to the PC system.

DLL430_SYMBOL STATUS_T WINAPI MSP430_GetNameOfUsbIf (LONG Idx, CHAR **Name, LONG *Status)
 Get the name of a Virtual Com Port (VCP), Human Interface Device (HID) or Communication Device Class (CDC) device index assigned to a certain MSP-FET430UIF USB FET. Also the status of the MSP-FET430UIF is returned (ENABLE/DISABLE).


Typedef Documentation

typedef LONG STATUS_T
 

this is the definition for the DLL functions return value

typedef enum STATUS_CODE STATUS_CODE_t
 

Status codes of the DLL functions.

typedef union DEVICE_T DEVICE_T_t
 

Device information structure.

typedef enum CPU_ARCH_TYPE CPU_ARCH_TYPE_t
 

typedef enum READ_WRITE READ_WRITE_t
 

typedef enum ENABLE_DISABLE ENABLE_DISABLE_t
 

typedef enum RESET_METHOD RESET_METHOD_t
 

Device reset methods.

typedef enum ERASE_TYPE ERASE_TYPE_t
 

FLASH erase type.

typedef enum CONFIG_MODE CONFIG_MODE_t
 

Configurations to set with MSP430_Configure.

typedef enum INTERFACE_TYPE INTERFACE_TYPE_t
 

Configurations values for CONFIG_MODE INTERFACE_MODE.

typedef enum FILE_TYPE FILE_TYPE_t
 

File types.

typedef enum ERROR_CODE ERROR_CODE_t
 

typedef enum SYSTEM_EVENT_MSP SYSTEM_EVENT_MSP_t
 

typedef void(* SYSTEM_NOTIFY_CALLBACK)(SYSTEM_EVENT_MSP_t MySystemEvent)
 


Enumeration Type Documentation

enum STATUS_CODE
 

Status codes of the DLL functions.

Enumeration values:
STATUS_ERROR  DLL functions return this value on failure
STATUS_OK  this value is returned on success

enum CPU_ARCH_TYPE
 

Enumeration values:
CPU_ARCH_ORIGINAL 
CPU_ARCH_X 
CPU_ARCH_XV2 

enum READ_WRITE
 

Enumeration values:
WRITE 
READ 

enum ENABLE_DISABLE
 

Enumeration values:
DISABLE 
ENABLE 

enum RESET_METHOD
 

Device reset methods.

Enumeration values:
PUC_RESET  Power up clear (i.e., a "soft") reset
RST_RESET  RST/NMI (i.e., "hard") reset
VCC_RESET  Cycle Vcc (i.e., a "power on") reset
FORCE_RESET 
ALL_RESETS  combines all possible reset methods enumerated in enum RESET_METHOD
FORCE_PUC_RESET  forces a Power up clear reset
FORCE_RST_RESET  forces a RST/NMI clear reset Non-Xv2 devices will be running and executing code after the reset
FORCE_VCC_RESET  forces a Vcc clear reset Non-Xv2 devices will be running and executing code after the reset

enum ERASE_TYPE
 

FLASH erase type.

Enumeration values:
ERASE_SEGMENT  Erase a segment
ERASE_MAIN  Erase all MAIN memory
ERASE_ALL  Erase all MAIN and INFORMATION memory not including IP protected area
ERASE_TOTAL  Erase all MAIN and INFORMATION memory including IP protected area

enum CONFIG_MODE
 

Configurations to set with MSP430_Configure.

Enumeration values:
VERIFICATION_MODE  Verify data downloaded to FLASH memories
EMULATION_MODE  4xx emulation mode
LOCKED_FLASH_ACCESS  Allows Locked Info Mem Segment A access (if set to '1')
EDT_TRACE_MODE  Trace mode in EDT file format
INTERFACE_MODE  Configure interface protocol: JTAG or Spy-bi-Wire (see enum INTERFACE_TYPE)
SET_MDB_BEFORE_RUN  Configure a value that will be placed on the devices' MemoryDataBus right before the device gets released from JTAG. Used for Software Breakpoints.
RAM_PRESERVE_MODE  Configure whether RAM content should be preserved/restored in MSP430_Erase() and MSP430_Memory() or not. RAM_PRESERVE_MODE is set to ENABLE by default. Usage Example for initial flash programming: (1) MSP430_Configure(RAM_PRESERVE_MODE, DISABLE); (2) MSP430_Erase(ERASE_ALL,..,..); (3) MSP430_Memory(..., ..., ..., WRITE ); (4) MSP430_Memory(..., ..., ..., READ ); ..... Flash Programming/Download finished (n) MSP430_Configure(RAM_PRESERVE_MODE, ENABLE);
UNLOCK_BSL_MODE  Configure the DLL to allow read/write/erase access to the 5xx Bootstrap Loader (BSL) memory segments.
DEVICE_CODE 
WRITE_EXTERNAL_MEMORY 
DEBUG_LPM_X 
JTAG_SPEED 
TOTAL_ERASE_DEVICE 

enum INTERFACE_TYPE
 

Configurations values for CONFIG_MODE INTERFACE_MODE.

Enumeration values:
JTAG_IF  4 Wire JTAG protocol used
SPYBIWIRE_IF  2 Wire (Spy-bi-wire) JTAG protocol used
SPYBIWIREJTAG_IF  2 Wire Devices accessed by 4wire JTAG protocol
AUTOMATIC_IF  Protocol will be detected automatically

enum FILE_TYPE
 

File types.

Enumeration values:
FILETYPE_AUTO  Auto detect
FILETYPE_TI_TXT  TI text
FILETYPE_INTEL_HEX  Intel hex

enum ERROR_CODE
 

Enumeration values:
ERROR_DEFINITIONS 

enum SYSTEM_EVENT_MSP
 

Enumeration values:
FET_CONNECTION_LOST  System event FET connection is lost.
DEVICE_CONNECTION_LOST  System event device connection is lost.
FET_RESTART_NEEDED  System event FET restart needed.
DEVICE_IN_LPM5_MODE  System event device entered LPMx.5.
DEVICE_WAKEUP_LPM5_MODE  System event devices wakes up from LPMx.5.


Function Documentation

STATUS_T WINAPI MSP430_SET_SYSTEM_NOTIFY_CALLBACK SYSTEM_NOTIFY_CALLBACK  parSystemNotifyCallback  ) 
 

Initialize the SYSTEM NOTIFYCALLBACK.

Note:
If DEBUG_LPM_X has been previously configured, this will start polling for LPMX.5 events.

This function should be called after MSP430_OpenDevice() function.

Parameters:
parSystemNotifyCallback: To initialize the system notify callback an instance of the enum SYSTEM_EVENT_MSP must be provided to the set function.
Returns:
STATUS_OK: The callback was initialized successfully.
STATUS_ERROR: The callback was not initialized successfully.
Error codes:
INITIALIZE_ERR

STATUS_T MSP430_Initialize CHAR *  port,
LONG *  version
 

Initialize the interface.

Note:
1. This function must be called first.

2. MSP430_VCC() must be called second (after MSP430_Initialize() is called).

3. When initializing the MSP-FET430UIF (TI USB FET) parameter 'version' could contain the value -1 or -3. This means that the Dll and the MSP-FET430UIF do not have the same version (-3 means a major internal update is required). MSP430_FET_FwUpdate() should be called. MSP430_FET_FwUpdate() is part of the Maintenance API of the Dll. When -3 was returned and calling MSP430_FET_FwUpdate(), the file CDC.log must exist in the directory of the executed binary and the content must be the string "True" without a newline. This file signals that a CDC driver is installed and prevents the update from making the MSP-FET430UIF unusable.

Parameters:
port: Interface port reference (application specific).
  • To initialize a MSP-FET430PIF LPT Jtag adapter the parameter port should point to a string which respresents the corresponding LPT port (e.g. '1','2',... or 'LPT1','LPT2',...).
  • To initialize TI's MSP-FET430UIF USB Jtag adapter the parameter port should point to the string 'TIUSB' or just 'USB'.
  • TI's MSP-FET430UIF USB Jtag adapter create Virtual Com Ports (VCPs) on the PC system (see Device Manager). It is also possible to directly pass the name of a dedicated VCP via this parameter (e.g. 'COM4, COM23,...). This can be used to support multiple MSP-FET430UIF interfaces on one PC. The later generation of USB development tools (eZ430-RF2500) no longer uses the VCP approach. These tools enumerate as Human Interface Devices (HID) on the USB. Since DLL version 2.03.00.000 it is also possible to directly pass the name of a dedicated HID via this parameter. When using a v3 MSP-FET430UIF it is enumerated as Communication Device Class (CDC). Refer to MSP430_GetNumberOfUsbIfs() and MSP430_GetNameOfUsbIf() for more information on VCP, HID and CDC.
version: The version number of the MSP430 DLL is returned (if version is not NULL). A value of -1 or -3 reports a version conflict between the Dll and USB FET f/w. In that case please refer to MSP430_FET_FwUpdate() on how to update the firmware of the MSP-FET430UIF.
Returns:
STATUS_OK: The interface was initialized.
STATUS_ERROR: The interface was not initialized.
Error codes:
INITIALIZE_ERR
USB_FET_NOT_FOUND_ERR
USB_FET_BUSY_ERR
COMM_ERR

STATUS_T MSP430_Close LONG  vccOff  ) 
 

Close the interface.

Note:
1. If called, this function must be called last.
Parameters:
vccOff: Turn off the device Vcc (0 volts) if TRUE.
Returns:
STATUS_OK: The interface was closed.
STATUS_ERROR: The interface was not closed.
Error codes:
CLOSE_ERR
VCC_ERR

STATUS_T MSP430_GetJtagID LONG *  JtagId  ) 
 

Return JTAG Id.

Note:
1. MSP430_Initialize() must be called prior to this function.
Parameters:
JtagId: JTAG Id of the connected device will be returned.
Returns:
STATUS_OK: JTAG Id could be read.
STATUS_ERROR: JTAG Id could NOT be read.
Error codes:

STATUS_T WINAPI MSP430_GetFoundDevice CHAR *  FoundDevice,
LONG  count
 

Return an instance of the Found device.

Note:
It is possible to successfully (i.e. return status: STATUS_OK) and an "UNKNOWN DEVICE".
Parameters:
FoundDevice: A pointer to a buffer where the device identity and information are stored. See DEVICE_T for details.
count: The number of bytes to return in the buffer (i.e., the buffer size). Must be at least sizeof(DEVICE_T).
Returns:
STATUS_OK: The device information was obtained.
STATUS_ERROR: The device information was not obtained.
Error codes:
To be defined

STATUS_T WINAPI MSP430_OpenDevice CHAR *  Device,
CHAR *  Password,
LONG  PwLength,
LONG  DeviceCode,
LONG  setId
 

Identify the device, and compare the found device to the expected device.

Note:
1. MSP430_Initialize() and MSP430_VCC() must have been called prior to calling this function.

2. It is possible to successfully (i.e. return status: STATUS_OK) identify another device as set"FOUND_OTHER_DEVICE".

3. Use the setId parameter and MSP430_State(state, TRUE, FALSE) to stop a running device (without resetting it).

4. Following MSP430_OpenDevice():

  • the device is reset, is not executing, and is under JTAG control.
  • the JTAG interface is enabled and the JTAG signals are negated.
Parameters:
Device: Device, which should be initialized
Password: JTAG password to access JTAG
PwLength: Password length in WORDS
DeviceCode: Activation code for devices. Example: L092 or C092
setId: If setId is not DEVICE_UNKNOWN, the device is set to setId. Otherwise the device is determined.
Returns:
STATUS_OK: Target device was connected and found in the database.
STATUS_ERROR: The device was not obtained.
Error codes:
PARAMETER_ERR
NO_DEVICE_ERR
DEVICE_UNKNOWN_ERR
READ_MEMORY_ERR
READ_FUSES_ERR
FUSE_BLOWN_ERR
CONFIGURATION_ERR
FOUND_OTHER_DEVICE
WRONG_PASSWORD

STATUS_T MSP430_Device LONG  localDeviceId,
CHAR *  buffer,
LONG  count
 

Obtain the device information.

Note:
1. This function can be used to determine the devices supported by the driver; a device identification of NUMofDevices is returned to indicate that there are no additional devices.
Parameters:
localDeviceId: An index (from zero) used to specify the device.
buffer: A pointer to a buffer where the device identity and information is stored. See DEVICE_T for details.
count: The number of bytes to return in the buffer (i.e., the buffer size). Must be at least sizeof(DEVICE_T)
Returns:
STATUS_OK: The device identify and information was obtained.
STATUS_ERROR: The device identity and information was not obtained.
Error codes:
PARAMETER_ERR

STATUS_T MSP430_Configure LONG  mode,
LONG  value
 

Configure the mode(s) of the device and/or the software. Possible configuration modes are covered by the enum CONFIG_MODE. See notes for details of different modes to be configured.

Note:
1. VERIFICATION_MODE value = TRUE : Verify data downloaded to FLASH memories. value = FALSE: No verification. 2. EMULATION_MODE Configure F4xx emulation mode according the set value. 3. CLK_CNTRL_MODE Configure the EEM Clock control register value. Do NOT use after calling MSP430_Eem_Init(). 4. MCLK_CNTRL_MODE Configure the EEM Module Clock control register value. Do NOT use after calling MSP430_Eem_Init(). 5. LOCKED_FLASH_ACCESS value = TRUE : Allows Locked Info Mem Segment A erase/write access. value = FALSE: Flash Segment stays locked during erase/write operations. 6. EDT_TRACE_MODE Can be used to trace JTAG commands in EDT file format. Only applicable with LPT tool. value = TRUE : Trace ON value = FALSE: Trace OFF 7. INTERFACE_MODE Configure JTAG interface protocol: JTAG or Spy-bi-Wire (see enum INTERFACE_TYPE) 8. SET_MDB_BEFORE_RUN Configure a value that will be placed on the devices' MemoryDataBus right before the device gets released from JTAG. Used for Software Breakpoints. 9. RAM_PRESERVE_MODE Configure whether RAM content should be preserved/restored in MSP430_Erase() and MSP430_Memory() or not. RAM_PRESERVE_MODE is set to ENABLE by default.
Parameters:
mode: Mode (enum CONFIG_MODE) to be configured. See notes above for details.
value: Mode value.
Returns:
STATUS_OK: Mode was configured.
STATUS_ERROR: Mode was not configured.
Error codes:
PARAMETER_ERR
UNLOCK_BSL_ERR
INTERFACE_SUPPORT_ERR

STATUS_T MSP430_VCC LONG  voltage  ) 
 

Set the device Vcc pin to voltage/1000 volts.
The USB JTAG adaptor also checks if external power is supplied to the traget device. If an external voltage is detected MSP430_VCC() returns STATUS_ERROR and one of the corresponding error codes.

Note:
1. A "voltage" of zero (0) turns off voltage to the device.

2. This function must be called second (after MSP430_Initialize() is called).

Parameters:
voltage: The device Vcc pin is set to voltage/1000 volts.
Returns:
STATUS_OK: The Vcc was set to voltage.
STATUS_ERROR: The Vcc was not set to voltage.
Error codes:
PARAMETER_ERR
VCC_ERR
LOW_EX_POWER
EX_POWER_OK
HIGH_EX_POWER

STATUS_T MSP430_GetCurVCCT LONG *  voltage  ) 
 

Report back the current voltage supplied to the target device.

Note:
1. This function is only supported by the MSP-FET430UIF USB JTAG adaptor. 2. Beeing called when using Parallel Port tool the function returns a dummmy value of 3000 in case MSP430_VCC() has been called prior.
Parameters:
voltage: The current voltage supplied to the device.
Returns:
STATUS_OK: The current voltage is reported back.
STATUS_ERROR: The current voltage can not be reported back.
Error codes:
COMM_ERR

STATUS_T MSP430_GetExtVoltage LONG *  voltage,
LONG *  state
 

Detect if external voltage is supplied to the target device. Report back the value of an external voltage as well as an corresponding state.

Note:
1. This function is only supported by the MSP-FET430UIF USB JTAG adaptor. 2. Beeing called when using Parallel Port tool the function returns a dummmy voltage value of 0 and NO_EX_POWER as the state value. Prallel Port tool is not be able to measure external power supply!
Parameters:
voltage: The current external voltage.
state: External voltage can have one of the following states:
  • NO_EX_POWER, no external power was detected
  • LOW_EX_POWER, external power is too low
  • EX_POWER_OK, external power detected
  • HIGH_EX_POWER, external power too high
Returns:
STATUS_OK: The function was executed successfully.
STATUS_ERROR: The function was not executed successfully.
Error codes:
COMM_ERR

STATUS_T MSP430_Reset LONG  method,
LONG  execute,
LONG  releaseJTAG
 

Reset the device using the specified method(s). Optionally start device execution, and release the JTAG control signals.

Note:
1. It is possible to combine reset methods. The methods are applied in the following order: PUC then RST_NMI then VCC. If a reset operation fails, the next reset method (if any) is applied.

2. Following reset by RST/NMI and/or VCC, a PUC is automatically executed to reset the device in such a way that it does not begin to execute a resident program (or garbage).

3. The device registers are updated (for read using MSP430_Registers()) following MSP430_Reset().

Parameters:
method: The bit mask specifying the method(s) to use to reset the device:
  • PUC_RESET: The device is reset using PUC (i.e., a "soft" reset).
  • RST_RESET: The device is reset using the RST/NMI pin (i.e., a "hard" reset).
  • VCC_RESET: The device is reset by cycling power to the device.
  • FORCE_PUC_RESET, FORCE_RST_RESET, FORCE_VCC_RESET
execute: Start device execution (when TRUE).
releaseJTAG: Release the JTAG control signals (when TRUE). execute must be TRUE.
Returns:
STATUS_OK: The device was reset (and optionally started [and JTAG control released])
STATUS_ERROR: The device was not reset (and optionally started [and JTAG control released]).
Error codes:
PARAMETER_ERR
RESET_ERR
RUN_ERR
NO_DEVICE_ERR

STATUS_T MSP430_Erase LONG  type,
LONG  address,
LONG  length
 

Erase the device FLASH/FRAM memory.

Note:
1. MSP430_OpenDevice() must have been called prior to calling this function.

2. Use MSP430_Read_Memory() to determine the address of a failed erase operation.

3. If address+length extends beyond the segment containing address, intermediate segments are erased (and checked).

4. Following erasure of the memory, the device oscillator will be set to approx. 2.1MHz.

5. Some device families have a locked INFO memory segment (INFO A). MSP430_Configure(LOCKED_FLASH_ACCESS,...) can be used to unlock/lock this segment. Having parameter 'type' set to ERASE_ALL will erase the complete INFO memory in case the INFO A segment was unlocked prior. Otherwise only INFO segments B, C and D will be erased.

6. Some device families have a lockable BSL memory segment. MSP430_Configure(UNLOCK_BSL_MODE,...) can be used to unlock/lock this segment. Having parameter 'type' set to ERASE_ALL will erase the complete BSL memory in case the BSL memory was unlocked prior.

7. Devices using FRAM memory can be erased even though it is technically not necessary. Doing so will fill the erased memory with 0xFFFF to be consistent with FLASH devices.

Parameters:
type: The type parameter specifies what should be erased.
  • ERASE_SEGMENT: Erase the segment containing 'address'.
  • ERASE_MAIN: Erase the Main memory.
  • ERASE_ALL: Erase the Main, Information and Bootstrap Loader memory.
address: Starting address of erase check operation. Must be word aligned.
length: Length of erase check operation (even number of bytes).
Returns:
STATUS_OK: The device FLASH/FRAM memory was erased.
STATUS_ERROR: The device FLASH/FRAM memory was not erased.
Error codes:
PARAMETER_ERR
PRESERVE_RESTORE_ERR
FREQUENCY_ERR
ERASE_ERR

STATUS_T MSP430_Memory LONG  address,
CHAR *  buffer,
LONG  count,
LONG  rw
 

Read and write the device memory. "Device memory" includes the Special Function Registers (i.e., peripheral registers), RAM, Information (FLASH/FRAM) memory, Bootstrap Loader memory (BLS) and Main (FLASH/FRAM) memory.

Note:
1. A data write operation can be verified by performing a data read operation followed by a comparison at the application level or by using MSP430_VerifyMem().

2. Usually, FLASH memory must be erased before the write to FLASH memory operation is performed. The write to FLASH memory operation DOES NOT erase the FLASH before the operation is performed. ***

3. Following a write to FLASH, the device oscillator will be set to approx. 2.1MHz.

Parameters:
address: The starting address of the device memory to be read or written.
buffer: The buffer into which device memory is read, or from which device memory is written.
count: The number of bytes of device memory read or written.
rw: Specify a read (READ) or write (WRITE) operation.
Returns:
STATUS_OK: The memory operation encountered no errors.
STATUS_ERROR: The memory operation encountered errors.
Error codes:
PARAMETER_ERR
NO_DEVICE_ERR
READ_MEMORY_ERR
WRITE_MEMORY_ERR
BSL_MEMORY_LOCKED_ERR
PRESERVE_RESTORE_ERR
FREQUENCY_ERR

STATUS_T MSP430_Secure void   ) 
 

The device is secured (i.e., the JTAG security fuse is blown).
The MSP-FET430PIF LPT JTAG adaptor >>> DOES NOT <<< implement the functionality required to blow the device security fuse.
MSP-FET430UIF USB JTAG adaptor >>> DOES <<< support this feature.

Note:
1. MSP430_OpenDevice() must have been called prior to calling this function.

2. Once a device is secure, further communications via JTAG is not possible.

3. After MSP430_Secure(), the device is reset with Vcc set to ((MaxOp + MinOp) / 2) volts (*) and Vpp set to 0 volts (*). (*) Implementation dependent.

Returns:
STATUS_OK: The device was secured.
STATUS_ERROR: The device was not secured.
Error codes:
DEVICE_UNKNOWN_ERR
BLOW_FUSE_ERR

STATUS_T MSP430_ReadOutFile LONG  wStart,
LONG  wLength,
CHAR *  lpszFileName,
LONG  iFileType
 

Read the specified range of device memory, and write it to the specified file.

Note:
Parameters:
wStart: The starting address of the device memory to read.
wLength: The length of the device memory to read (even number of bytes).
lpszFileName: Pointer to the filename into which the read device memory is written.
iFileType: The type of the file into which the read device memory is written:
  • TI text: FILETYPE_TI_TXT
  • Intel hex: FILETYPE_INTEL_HEX
Returns:
STATUS_OK: The device memory was read and written to the specified file.
STATUS_ERROR: The device memory was not read or written to the specified file.
Error codes:
PARAMETER_ERR
NO_DEVICE_ERR
READ_MEMORY_ERR
FILE_IO_ERR
INTERNAL_ERR

STATUS_T MSP430_ProgramFile CHAR *  File,
LONG  eraseType,
LONG  verifyMem
 

The contents of the specified file are input, and then written to the device. The device is optionally erased prior to being written. The device is optionally verified after being written.

Note:
1. MSP430_Identify() must have been called prior to calling this function.

2. The file type must be one of TI text or Intel hex.

3. verifyMem operation does not read the device memory and compare it to the file. Instead, this operation computes a checksum for the device memory, and then computes a checksum for the file, and finally compares the two checksums.

4. Following a write to FLASH/FRAM, the device oscillator will be set to approx. 2.1MHz.

5. Following verifyMem, the device is reset.

Parameters:
File: Pointer to filename.
eraseType: Type of device erasure:
  • ERASE_ALL: Erase all Main and Information memories.
  • ERASE_MAIN: Erase all Main memories.
verifyMem: Verify the device if TRUE.
Returns:
STATUS_OK: The file contents were input and were written to the device.
STATUS_ERROR: The file contents were not input or were not written to the device.
Error codes:
DEVICE_UNKNOWN_ERR
NO_DEVICE_ERR
PARAMETER_ERR
FILE_OPEN_ERR
FILE_END_ERR
FILE_DETECT_ERR
FILE_IO_ERR
FILE_DATA_ERR
PRESERVE_RESTORE_ERR
FREQUENCY_ERR
ERASE_ERR
READ_MEMORY_ERR
WRITE_MEMORY_ERR
VERIFY_ERR
ERR_INTEL_HEX_CODE

STATUS_T MSP430_VerifyFile CHAR *  File  ) 
 

Compare the MSP430 memory and the contents of the specified file.

Note:
1. The file type must be one of TI text or Intel hex.

2. This function does not read the device memory and compare it to the file. Instead, this operation computes a checksum for the device memory, and then computes a checksum for the file, and finally compares the two checksums.

3. The device is reset following this operation.

Parameters:
File: Pointer to filename.
Returns:
STATUS_OK: The file contents were input and compare with the device memory.
STATUS_ERROR: The file contents were not input or did not compare with the device memory.
Error codes:
PARAMETER_ERR
NO_DEVICE_ERR
FILE_OPEN_ERR
FILE_END_ERR
FILE_DETECT_ERR
FILE_IO_ERR
FILE_DATA_ERR
VERIFY_ERR
ERR_INTEL_HEX_CODE

STATUS_T MSP430_VerifyMem LONG  StartAddr,
LONG  Length,
CHAR *  DataArray
 

Compare the MSP430 memory and the specified data.

Note:
1. This function does not read the specified memory region and compare it to the data. Instead, this function computes a checksum for the specified memory region, and then computes a checksum for the data, and finally compares the two checksums.

2. The device is reset following this operation.

Parameters:
StartAddr: Start address of memory to be compared (must be even).
Length: Number of bytes to be compared (must be even).
*DataArray: Pointer to data array.
Returns:
STATUS_OK: The device memory and data match.
STATUS_ERROR: The device memory and data do not match.
Error codes:
PARAMETER_ERR
NO_DEVICE_ERR
VERIFY_ERR

STATUS_T MSP430_EraseCheck LONG  StartAddr,
LONG  Length
 

Verify that the specified memory range is erased.

Note:
1. This function does not read the specified memory region and compare it to erased data. Instead, this function computes a checksum for the specified memory region, and then computes a checksum for erased data, and finally compares the two checksums.

2. The device is reset following this operation.

Parameters:
StartAddr: Start address of memory to be verified (must be even).
Length: Number of BYTEs to be verified (must be even).
Returns:
STATUS_OK: The device memory in the specified range is erased.
STATUS_ERROR: The device memory in the specified range is not erased.
Error codes:
PARAMETER_ERR
NO_DEVICE_ERR
VERIFY_ERR

STATUS_T MSP430_Error_Number void   ) 
 

Determine the number of the error when a MSP430_xxx() function returns STATUS_ERROR.

Note:
1. The error number is reset (to NO_ERR) after the error number is returned.
Returns:
The number of the last error.

const CHAR * MSP430_Error_String LONG  errorNumber  ) 
 

Determine the string associated with errorNumber.

Parameters:
errorNumber: Error number.
Returns:
The string associated with errorNumber.

STATUS_T MSP430_GetNumberOfUsbIfs LONG *  Number  ) 
 

Returns the number of MSP-FET430UIF USB FETs connected to the PC system.

Parameters:
Number: Return parameter. Number of MSP-FET430UIFs connected.
Returns:
STATUS_OK: USB was sucessfully scanned for connected MSP-FET430UIFs.
STATUS_ERROR: Could not scan USB for connected MSP-FET430UIFs.
Error codes:
INITIALIZE_ERR
PARAMETER_ERR

STATUS_T MSP430_GetNameOfUsbIf LONG  Idx,
CHAR **  Name,
LONG *  Status
 

Get the name of a Virtual Com Port (VCP), Human Interface Device (HID) or Communication Device Class (CDC) device index assigned to a certain MSP-FET430UIF USB FET. Also the status of the MSP-FET430UIF is returned (ENABLE/DISABLE).

Note:
1. MSP430_GetNumberOfUsbIfs() must be called prior to this function.
Parameters:
Idx: Zero based index to the name of a certain MSP-FET430UIF. Must be a value between 0 and 'number' returned by MSP430_GetNumberOfUsbIfs();
Name: Pointer to the MSP-FET430UIF's name string.
Status: Status of the MSP-FET430UIF,
  • ENABLE (The MSP-FET430UIF is already used by another debugger instance)
  • DISABLE (The MSP-FET430UIF is free to be used)
Returns:
STATUS_OK: MSP-FET430UIF information was returned.
STATUS_ERROR: MSP-FET430UIF information was NOT returned.
Error codes:
INITIALIZE_ERR
PARAMETER_ERR
USB_FET_NOT_FOUND_ERR