This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC430F5137: How to unlock soft key on CC430F5137 device

Part Number: CC430F5137
Other Parts Discussed in Thread: MSPDS

I'm trying to unlock the soft key in my CC430F5137. My setup consists of a MSP-FETFlash Emulation tool attached to the target through the 4-wire Jtag connection.

 

With the uC soft locked, I execute the sequence for VisualStudio:

status = MSP430_Initialize("TIUSB", out long version);

status = MSP430_VCC(vcc);

status = MSP430_OpenDevice("56", "FFFFFFFFCD849814FFFF44876E845C74DE2259FFF48B4629FFFFFFFFFFFFF0080", 32, 0, 56);

status = MSP430_ReadOutFile(0x8000, 0x100, "C:\\tmp.hex", FILETYPE_TI_TXT);

 

Where the string " FFFFFFFFCD849814FFFF44876E845C74DE2259FFF48B4629FFFFFFFFFFFFF0080" Is my password.

All calls return 0 as expected but the readout file content is all zeroes whereas it should be my application code.

 

Does OpenDevice not work when using password, or is it my implementation that is wrong? 

Thanks.

  • Hello,

    Your password could be wrong. Looking at the code example in Figure 2 in the MSPDebugStack Developer's Guide, I see that their password is "0x34127856", but it actually gets sent in the following order: 0x12 0x34 0x56 0x78

    Also, for your "MSP430_ReadOutFile()" function, I see that you're using "FILETYPE_TI_TXT" with a '.hex' file instead of a '.txt' file. This may be causing your issue.

    Also, be sure to follow the correct steps for general application and device handling as described in Section 3.1 in the MSPDebugStack Developer's Guide. Assuming that you're using the MSP Debug Stack Developer's Package (MSPDS), there are several excellent examples that you'll find to be very helpful. For example, I've attached 'example.c' below.

    /*
     * Copyright (C) 2012 - 2014 Texas Instruments Incorporated - http://www.ti.com/ 
     * 
     *  Redistribution and use in source and binary forms, with or without 
     *  modification, are permitted provided that the following conditions 
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright 
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the 
     *    documentation and/or other materials provided with the   
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    
    // MSP430 JTAG DLL usage example.
    //
    // Version 1.1
    //
    
    // This file contains an example program that calls the MSP430 JTAG DLL functions.
    
    // The MSP430 JTAG DLL functions are used to:
    // 1.  Initialize the interface.
    // 2.  Set the device Vcc.
    // 3.  Open the device.
    // 4.  Get device information.
    // 5.1 Erase the device (MAIN FLASH) memory.
    // 5.2 Verify the device memory erasure.
    // 5.3 Program the device memory (with the program).
    // 5.4 Verify the device memory programming.
    // 5.5 Program the device memory (with the restart vector).
    // 5.6 Read the device memory into a file.
    // 5.7 Program a file into device memory, and verify.
    // 5.8 Verify a file with device memory.
    // 6.1 Blow the device security fuse.
    // 6.2 Reset the device and start code execution.
    // 7.  Close the interface.
    // 8.1 Determine the error number.
    // 8.2 Determine the string of the error number.
    
    // Notes:
    // 1. MSP430_Initialize() must be the first function called.
    // 2. If called, MSP430_Close() must be the last function called.
    
    // #includes. -----------------------------------------------------------------
    
    #include <stdio.h>
    #include "MSP430.h"
    
    int main()
    {
    	STATUS_T status, secure = STATUS_OK;
    	CHAR* portNumber;
    	LONG  version;
    	LONG  vcc = 3300;
    	union DEVICE_T device;
    	// The following data is the FET_1 program (that blinks the LED) (MSP430F6659).
    	CHAR data0[] = {
    		0xF1, 0x03, 0xB2, 0x40, 0x80, 0x5A, 0x5C, 0x01, 0xD2, 0xD3,
    		0x04, 0x02, 0xD2, 0xE3, 0x02, 0x02, 0xB1, 0x40, 0x10, 0x27, 0x00, 0x00, 0x91, 0x83, 0x00, 0x00,
    		0x81, 0x93, 0x00, 0x00, 0xF6, 0x27, 0xFA, 0x3F
    	};
    	WORD data0_addr = 0xf000;
    	// The following data is the restart vector for the FET_1 program.
    	CHAR data1[] = {
    		0x00, 0xF0
    	};
    	WORD data1_addr = 0xfffe;
    	CHAR fileName[] = "TEST.TXT";
    	LONG fileType = FILETYPE_TI_TXT;
    
    	// Setup for simple test.
    	portNumber = "TIUSB";
    
    	do
    	{
    		// 1. Initialize the interface.
    		printf("Initializing the interface: ");
    		status = MSP430_Initialize(portNumber, &version);
    		printf("MSP430_Initialize(portNumber=%s, version=%d) returns %d\n", portNumber, version, status);
    		if (status != STATUS_OK) break;
    
    		// 2. Set the device Vcc.
    		printf("Setting the device Vcc: ");
    		status = MSP430_VCC(vcc);
    		printf("MSP430_VCC(%d) returns %d\n", vcc, status);
    		if (status != STATUS_OK) break;
    
    		// 3. Open the device.
    		printf("Opening the device: ");
    		status = MSP430_OpenDevice("DEVICE_UNKNOWN", "", 0, 0, DEVICE_UNKNOWN);
    		printf("MSP430_OpenDevice() returns %d\n", status);
    		if (status != STATUS_OK) break;
    		// 4. Get device information
    		status = MSP430_GetFoundDevice((char*)&device, sizeof(device.buffer));
    		printf("MSP430_GetFoundDevice() returns %d\n", status);
    		if (status != STATUS_OK) break;
    		printf(" device.id: %d\n", device.id);
    		printf(" device.string: %s\n", device.string);
    		printf(" device.mainStart: 0x%04x\n", device.mainStart);
    		printf(" device.infoStart: 0x%04x\n", device.infoStart);
    		printf(" device.ramEnd: 0x%04x\n", device.ramEnd);
    		printf(" device.nBreakpoints: %d\n", device.nBreakpoints);
    		printf(" device.emulation: %d\n", device.emulation);
    		printf(" device.clockControl: %d\n", device.clockControl);
    		printf(" device.lcdStart: 0x%04x\n", device.lcdStart);
    		printf(" device.lcdEnd: 0x%04x\n", device.lcdEnd);
    		printf(" device.vccMinOp: %d\n", device.vccMinOp);
    		printf(" device.vccMaxOp: %d\n", device.vccMaxOp);
    		printf(" device.hasTestVpp: %d\n", device.hasTestVpp);
    
    		// The following operations manipulate the device memory using erase, read/write, and verify.
    
    		// 5.1 Erase the device memory.
    		printf("Erasing the device memory: ");
    		status = MSP430_Erase(ERASE_MAIN, device.mainStart, 0x10000 - device.mainStart);
    		printf("MSP430_Erase(ERASE_MAIN, startAddr=0x%04x, length=0x%04x) returns %d\n",
    			   device.mainStart, 0x10000 - device.mainStart, status);
    		if (status != STATUS_OK) break;
    
    		// 5.2 Verify the device memory erasure.
    		printf("Verifying device memory erasure: ");
    		status = MSP430_EraseCheck(data0_addr, sizeof(data0));
    		printf("MSP430_EraseCheck(startAddr=0x%04x, length=0x%04x) returns %d\n",
    			   data0_addr, sizeof(data0), status);
    		if (status != STATUS_OK) break;
    
    		// 5.3 Program the device memory (with the program).
    		printf("Programming the device memory (program): ");
    		status = MSP430_Write_Memory(data0_addr, data0, sizeof(data0));
    		printf("MSP430_Write_Memory(startAddr=0x%04x, data0, length=0x%04x) returns %d\n",
    			   data0_addr, sizeof(data0), status);
    		if (status != STATUS_OK) break;
    
    		// 5.4 Verify the device memory programming.
    		printf("Verifying device memory programming: ");
    		status = MSP430_VerifyMem(data0_addr, sizeof(data0), data0);
    		printf("MSP430_VerifyMem(startAddr=0x%04x, length=0x%04x, data0) returns %d\n",
    			   data0_addr, sizeof(data0), status);
    		if (status != STATUS_OK) break;
    
    		// 5.5 Program the device memory (with the restart vector).
    		printf("Programming the device memory (reset vector): ");
    		status = MSP430_Write_Memory(data1_addr, data1, sizeof(data1));
    		printf("MSP430_Write_Memory(startAddr=0x%04x, data1, length=0x%04x) returns %d\n",
    			   data1_addr, sizeof(data1), status);
    		if (status != STATUS_OK) break;
    
    		// 5.6 Read the device memory into a file.
    		printf("Reading the device memory into a file: ");
    		status = MSP430_ReadOutFile(data0_addr, 0x10000-data0_addr, fileName, fileType);
    		printf("MSP430_ReadOutFile(startAddr=0x%04x, length=0x%04x, file=\"%s\", fileType=%d) returns %d\n",
    			data0_addr, 0x10000-data0_addr, fileName, fileType, status);
    		if (status != STATUS_OK) break;
    
    		// 5.7 Program the file into device memory, and verify.
    		printf("Programming the file into device memory (with verify): ");
    		status = MSP430_ProgramFile(fileName, ERASE_ALL, TRUE);
    		printf("MSP430_ProgramFile(file=\"%s\", method=ERASE_ALL, verify=TRUE) returns %d\n", fileName, status);
    		if (status != STATUS_OK) break;
    
    		// 5.8 Verify the file with device memory.
    		printf("Verifying the file with device memory: ");
    		status = MSP430_VerifyFile(fileName);
    		printf("MSP430_VerifyFile(file=\"%s\") returns %d\n", fileName, status);
    		if (status != STATUS_OK) break;
    
    		// Uncomment the following line if the target device's JTAG fuse should be blown - no further
    		// JTAG access to the device will be possible!
    
    //#define SECURE
    
    #ifdef SECURE
    		// 6.1 Blow the device security fuse.
    		printf("Blowing the device security fuse: ");
    		secure = MSP430_Secure();
    		printf("MSP430_Secure() returns %d\n", secure);
    		if (secure != STATUS_OK) break;
    #endif
    
    		// 6.2 Reset the device, and start device execution.
    		printf("Resetting the device, and starting device execution: ");
    		status = MSP430_Reset(RST_RESET, TRUE, FALSE);
    		printf("MSP430_Reset(method=RST_RESET, execute=TRUE, releaseJTAG=FALSE) returns %d\n", status);
    		// Ignore the status if the secure operation was successful (since JTAG access is disabled).
    		if ((secure != STATUS_OK) && (status != STATUS_OK)) break;
    
    		// 7. Close the interface.
    		printf("Closing the interface: ");
    		status = MSP430_Close(FALSE);
    		printf("MSP430_Close(FALSE) returns %d\n", status);
    		if (status != STATUS_OK) break;
    	}
    	while (0);
    
    	if (status != STATUS_OK)
    	{
    		LONG errorNumber;
    
    		// The following operations handle errors.
    
    		printf("Additional error information:\n");
    		// 8.1 Determine the error number.
    		printf(" Error number: %d\n", errorNumber = MSP430_Error_Number());
    		// 8.2 Determine the string of the error number.
    		printf(" Error string: %s\n", MSP430_Error_String(errorNumber));
    	}
    
    	printf("Press <Enter> to continue");
    	getchar();
    
    	return (status == STATUS_OK ? 0 : -1);
    }
    

    Regards,

    James

    MSP Customer Applications

  • Hello,

    Due to inactivity, I'm closing this thread.

    Regards,

    James

    MSP Customer Applications

**Attention** This is a public forum