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.
hi, i am trying to read from a CC430F5137 using the MSPGANG_Set_MCU_Name function and the MSPGANG_Interactive_DefReadTargets function, but when i try to name the MCU name this always reaturn error
MSPGangSetMCUName CC430F5137 ERROR 344: Wrong target device connected !
does anyone had this same issue.
Any help will be great!
Andres G.
Hi Andres,
If I load the DLL and then call pMSPGangInitCom and pMSPGangSetMCUName before doing the list of setConfig commands you have in your post, and then finally call pMSPGangOpenTarget, I do not get error 23. Do you still get this error if you call pMSPGangInitCom and pMSPGangSetMCUName with the correct name (exactly matching the string used in the MSP-GANG GUI, case-sensitive!), then your setConfig commands, before calling pMSPGangOpenTarget?
Regards,
Katie
We still have the issue, for the moment we are using the interface to communicate to the Gang programmer. I you have any clue it will be great,
Andres G.
this is the code we are using...
/* * Copyright (c) 2003 - 2015 Texas Instruments Incorporated * * All rights reserved not granted herein. * Limited License. * * Texas Instruments Incorporated grants a world-wide, royalty-free, * non-exclusive license under copyrights and patents it now or hereafter * owns or controls to make, have made, use, import, offer to sell and sell ("Utilize") * this software subject to the terms herein. With respect to the foregoing patent *license, such license is granted solely to the extent that any such patent is necessary * to Utilize the software alone. The patent license shall not apply to any combinations which * include this software, other than combinations with devices manufactured by or for TI ("TI Devices"). * No hardware patent is licensed hereunder. * * Redistributions must preserve existing copyright notices and reproduce this license (including the * above copyright notice and the disclaimer and (if applicable) source code license limitations below) * in the documentation and/or other materials provided with the distribution * * Redistribution and use in binary form, without modification, are permitted provided that the following * conditions are met: * * * No reverse engineering, decompilation, or disassembly of this software is permitted with respect * to any software provided in binary form. * * any redistribution and use are licensed by TI for use only with TI Devices. * * Nothing shall obligate TI to provide you with source code for the software licensed and provided * to you in object code. * If software source code is provided to you, modification and redistribution of the source code are permitted * provided that the following conditions are met: * * * any redistribution and use of the source code, including any resulting derivative works, are licensed by * TI for use only with TI Devices. * * any redistribution and use of any object code compiled from the source code and any resulting derivative * works, are licensed by TI for use only with TI Devices. * * Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or * promote products derived from this software without specific prior written permission. * * DISCLAIMER. * * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "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 TI AND TI'S LICENSORS 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. */ //***************************************************************** /*========================================================================*\ | | | DLLtest.c | | | | Application main | |--------------------------------------------------------------------------| | Project: MSP-Gang DLL: Application example in C language | | Developed using: MS Visual C++ 2008 | |--------------------------------------------------------------------------| | Author: PC | | Version: 1.0 | | Initial Version: 10/09/11 | | Last Change: 10/09/11 | |--------------------------------------------------------------------------| | Version history: | | 1.0 Initial version | |--------------------------------------------------------------------------| | Designed 2011 by Elprotronic Incorporated | | based on examples from Texas Instruments Incorporated | \*========================================================================*/ /*========================================================================*\ | Important: | | 1. The MSP-Gang.dll files must be in the same directory as DLLTEST.exe | | (copy from main directory). | | 2. Include Lib\MSP-GANG.h into the main application file. | \*========================================================================*/ #include <windows.h> #include <stdio.h> #include "..\Lib\MSP-GANG.h" //--- globals -------------------------------------------------------------- // #define ComPort "COM3" #define Baudrate 115200 #define Dll430 "MSP-Gang.dll" #define FilName "..\\lib\\test_1k.txt" #define DeviceType "CC-430F5137" //MSP430F2121 CC-430F5137 #define Vcc 3300 //mV #define SettleTime 10 //Settle Time in multiples of 20ms #define TargetEn 0xFF #define ERR_NO_DLL 100 #define ImageName "DLLtestC" //Name to be shown on Programmer #define ImageIndex 0 //Index to be used for image on Programmer #define StartSerNum 0x12345678 #define SerNumAddress 0x1080 HINSTANCE hDLL430; // handle of DLL static FARPROC pMSPGangInitCom = NULL; // pointer to DLL functions static FARPROC pMSPGangReleaseCom = NULL; static FARPROC pMSPGangCreateGangImage = NULL; static FARPROC pMSPGangSelectImage = NULL; static FARPROC pMSPGangEraseImage = NULL; static FARPROC pMSPGangLoadImage = NULL; static FARPROC pMSPGangVerifyImage = NULL; static FARPROC pMSPGangDefaultConfig = NULL; static FARPROC pMSPGangSetConfig = NULL; static FARPROC pMSPGangSetTmpGANGConfig = NULL; static FARPROC pMSPGangReadCodeFile = NULL; static FARPROC pMSPGangSetMCUName = NULL; static FARPROC pMSPGangMainProcess = NULL; static FARPROC pMSPGangGetProgressStatus= NULL; static FARPROC pMSPGangGetErrorString = NULL; static FARPROC pMSPGangOpenTarget = NULL; static FARPROC pMSPGangCloseTarget = NULL; static FARPROC pMSPGangSetGangBuffer = NULL; static FARPROC pMSPGangGetGangBuffer = NULL; static FARPROC pMSPGangCopyBuf2Flash = NULL; static FARPROC pMSPGangDefReadTargets = NULL; static FARPROC pMSPGangGetDataBuffers = NULL; static FARPROC pMSPGangInteractiveReadTargets = NULL; static FARPROC pMSPGangGetAPIStatus = NULL; static FARPROC pMSPGANGGetInfoMemory = NULL; static FARPROC pMSPGangInteractiveReadBytes = NULL; static FARPROC pMSPGANGInteractiveProcess = NULL; //--- support functions ---------------------------------------------------- // void Evaluate(LONG); void Load_DLL() { printf("Load DLL %20s", Dll430); hDLL430 = LoadLibrary(Dll430); if (hDLL430 == NULL) Evaluate(ERR_NO_DLL); //Communication //LONG WINAPI MSPGANG_InitCom( LPTSTR lpszPort, LONG lBaud); pMSPGangInitCom = GetProcAddress(hDLL430, "MSPGANG_InitCom"); //LONG WINAPI MSPGANG_ReleaseCom(void); pMSPGangReleaseCom = GetProcAddress(hDLL430, "MSPGANG_ReleaseCom"); //Image Manipulation //LONG WINAPI MSPGANG_CreateGangImage( LPTSTR name ); pMSPGangCreateGangImage = GetProcAddress(hDLL430, "MSPGANG_CreateGangImage"); //LONG WINAPI MSPGANG_SelectImage(LONG lImage); pMSPGangSelectImage = GetProcAddress(hDLL430, "MSPGANG_SelectImage"); //LONG WINAPI MSPGANG_EraseImage(void); pMSPGangEraseImage = GetProcAddress(hDLL430, "MSPGANG_EraseImage"); //LONG WINAPI MSPGANG_LoadImageBlock( void ); pMSPGangLoadImage = GetProcAddress(hDLL430, "MSPGANG_LoadImageBlock"); //LONG WINAPI MSPGANG_VerifyPSAImageBlock( void ); pMSPGangVerifyImage = GetProcAddress(hDLL430, "MSPGANG_VerifyPSAImageBlock"); pMSPGangGetAPIStatus = GetProcAddress(hDLL430, "MSPGANG_GetAPIStatus"); //Configuration //LONG WINAPI MSPGANG_Default_Config( void ); pMSPGangDefaultConfig = GetProcAddress(hDLL430, "MSPGANG_Default_Config"); //LONG WINAPI MSPGANG_SetConfig( LONG index, LONG data ); pMSPGangSetConfig = GetProcAddress(hDLL430, "MSPGANG_SetConfig"); pMSPGangSetTmpGANGConfig= GetProcAddress(hDLL430, "MSPGANG_SetTmpGANG_Config"); //LONG WINAPI MSPGANG_GetConfig( LONG index ); pMSPGangSetConfig = GetProcAddress(hDLL430, "MSPGANG_GetConfig"); //LONG WINAPI MSPGANG_Set_MCU_Name( LPTSTR name ); pMSPGangSetMCUName = GetProcAddress(hDLL430, "MSPGANG_Set_MCU_Name"); //LONG WINAPI MSPGANG_Read_Code_File( LPTSTR FullPath ); pMSPGangReadCodeFile = GetProcAddress(hDLL430, "MSPGANG_Read_Code_File"); pMSPGANGGetInfoMemory = GetProcAddress(hDLL430, "MSPGANG_GetInfoMemory"); //Error Reporting //LPTSTR WINAPI MSPGANG_GetErrorString(LONG lErrorNumber); pMSPGangGetErrorString = GetProcAddress(hDLL430, "MSPGANG_GetErrorString"); //LONG WINAPI MSPGANG_GetProgressStatus(void *lpData); pMSPGangGetProgressStatus = GetProcAddress(hDLL430, "MSPGANG_GetProgressStatus"); //Programming //LONG WINAPI MSPGANG_MainProcess(LONG lTime); pMSPGangMainProcess = GetProcAddress(hDLL430, "MSPGANG_MainProcess"); //LONG WINAPI MSPGANG_Interactive_Open_Target_Device( LPTSTR name ); pMSPGangOpenTarget = GetProcAddress(hDLL430, "MSPGANG_Interactive_Open_Target_Device"); //LONG WINAPI MSPGANG_Interactive_Close_Target_Device( void ); pMSPGangCloseTarget = GetProcAddress(hDLL430, "MSPGANG_Interactive_Close_Target_Device"); //I/O //LONG WINAPI MSPGANG_GetGangBuffer( BYTE target, BYTE size, BYTE *data ); pMSPGangGetGangBuffer = GetProcAddress(hDLL430, "MSPGANG_GetGangBuffer"); //LONG WINAPI MSPGANG_SetGangBuffer( BYTE target, BYTE size, BYTE *data ); pMSPGangSetGangBuffer = GetProcAddress(hDLL430, "MSPGANG_SetGangBuffer"); //LONG WINAPI MSPGANG_Interactive_Copy_GANG_Buffer_to_FLASH( LONG addr, LONG size ); pMSPGangCopyBuf2Flash = GetProcAddress(hDLL430, "MSPGANG_Interactive_Copy_GANG_Buffer_to_FLASH"); //LONG WINAPI MSPGANG_Interactive_DefReadTargets( BYTE mask, BYTE bar_min, BYTE bar_max, LONG Start_addr, LONG End_addr ) ; pMSPGangDefReadTargets = GetProcAddress(hDLL430, "MSPGANG_Interactive_DefReadTargets"); //LONG WINAPI MSPGANG_Interactive_ReadTargets( BYTE mask ) ; pMSPGangInteractiveReadTargets = GetProcAddress(hDLL430, "MSPGANG_Interactive_ReadTargets"); //LONG WINAPI MSPGANG_GetDataBuffers_ptr( void ** x ); pMSPGangGetDataBuffers = GetProcAddress(hDLL430, "MSPGANG_GetDataBuffers_ptr"); //LONG WINAPI MSPGANG_Interactive_ReadBytes(BYTE target_no, LONG addr, LONG size, BYTE * data); pMSPGangInteractiveReadBytes = GetProcAddress(hDLL430, "MSPGANG_Interactive_ReadBytes"); //MSPGANG_InteractiveProcess( LONG lTime ); pMSPGANGInteractiveProcess = GetProcAddress(hDLL430, "MSPGANG_InteractiveProcess"); Evaluate(ERR_NONE); } void Free_DLL() { printf("Detach DLL %20s", " "); if (hDLL430 == NULL) { Evaluate(ERR_NO_DLL); } else { FreeLibrary(hDLL430); Evaluate(ERR_NONE); } } void Exit(int status) { Free_DLL(); if (status == ERR_NONE) printf("\nProgram successfully finished - "); else printf("\nProgram aborted - "); //exit(status); } void Evaluate(LONG status) { switch(status) { case ERR_NONE: printf(" Operation successful.\n"); break; case ERR_NO_DLL: printf(" ERROR: File not found !\n"); Exit((int)status); break; default: printf(" %s\n", pMSPGangGetErrorString(status)); Exit((int)status); } } //-- Show result of main process ----------------------------------------------- // void Show_Diagnostic(void) { int i, mask; // ask DLL to populate this union with the results of the last main process union GANG_PROGRESS_STATUS results; pMSPGangGetProgressStatus((BYTE *)results.bytes); // an example of how to breakdown the results union to find errors printf(" Target "); for(i=0; i<GANG_SIZE; i++) { printf("%d", i+1); if(i+1 < GANG_SIZE) printf("-"); else printf("\n"); } // top level cumulative overview of whole process, success or failure printf(" Success "); for (i=0, mask=1; i<GANG_SIZE; i++, mask <<= 1) results.st.cumulative & mask ? printf("1 ") : printf("0 "); printf("\n================================\n"); // which targets were enabled for programming, default is all printf(" Enabled "); for (i=0, mask=1; i<GANG_SIZE; i++, mask <<= 1) results.st.Rq_gang_mask & mask ? printf("1 ") : printf("0 "); // which targets are connected. Will be 1 if device can be programmed. // The result here will be 0 if, for example, the wrong MCU type is selected even if // the physical connection to the device is okay and device is communicating via JTAG. printf("\n Connected "); for (i=0, mask=1; i<GANG_SIZE; i++, mask <<= 1) results.st.Connected_gang_mask & mask ? printf("1 ") : printf("0 "); // result of erasing, sets byte to 0xFF printf("\n Erase "); for (i=0, mask=1; i<GANG_SIZE; i++, mask <<= 1) results.st.Erased_gang_mask & mask ? printf("1 ") : printf("0 "); // result of blank check, check if byte is 0xFF printf("\n Blank Check "); for (i=0, mask=1; i<GANG_SIZE; i++, mask <<= 1) results.st.BlankCheck_gang_mask & mask ? printf("1 ") : printf("0 "); // result of programming printf("\n Programmed "); for (i=0, mask=1; i<GANG_SIZE; i++, mask <<= 1) results.st.Programmed_gang_mask & mask ? printf("1 ") : printf("0 "); // result of verify checksum printf("\n Verify "); for (i=0, mask=1; i<GANG_SIZE; i++, mask <<= 1) results.st.Verified_gang_mask & mask ? printf("1 ") : printf("0 "); // has the device been secured printf("\n Secured "); for (i=0, mask=1; i<GANG_SIZE; i++, mask <<= 1) results.st.Secured_gang_mask & mask ? printf("1 ") : printf("0 "); // did Vcc deviate from safe range at any time during main process printf("\n Vcc err "); for (i=0, mask=1; i<GANG_SIZE; i++, mask <<= 1) results.st.VccErr_Cumulative & mask ? printf("1 ") : printf("0 "); // did Jtag encounter any errors during initialization printf("\n JTAG init err "); for (i=0, mask=1; i<GANG_SIZE; i++, mask <<= 1) results.st.JTAG_init_err_mask & mask ? printf("1 ") : printf("0 "); // is JTAG fuse already blown, if yes then all operations would fail printf("\n fuse prev.blown "); for (i=0, mask=1; i<GANG_SIZE; i++, mask <<= 1) results.st.JTAG_Fuse_already_blown_mask & mask ? printf("1 ") : printf("0 "); // was the wrong device type selected printf("\n MCU type err "); for (i=0, mask=1; i<GANG_SIZE; i++, mask <<= 1) results.st.Wrong_MCU_ID_mask & mask ? printf("1 ") : printf("0 "); printf("\n"); } //-- Write serial number to every successfully processed target --------------- // void Write_Serial_Number() { int i, mask; int m; LONG serNum; //we'll use a LONG serial number in this example BYTE TxGangBuf[GANG_SIZE][4]; BYTE RxGangBuf[GANG_SIZE][4]; DATA_BUFFERS *RxGang; void *temp; //BYTE RxGangBuf[4][GANG_SIZE]; // ask DLL to populate this union with the results of the last main process union GANG_PROGRESS_STATUS results; pMSPGangGetProgressStatus((BYTE *)results.bytes); // using a big serial number for testing is good to check the correctness of your endianness math for (i=0, serNum=StartSerNum, mask=1; i<GANG_SIZE; i++, mask <<= 1) { // for little-endian architectures, like the MSP430, first byte is least significant. TxGangBuf[i][0] = (BYTE)(serNum & 0xFF); TxGangBuf[i][1] = (BYTE)((serNum >> 8) & 0xFF); TxGangBuf[i][2] = (BYTE)((serNum >> 16) & 0xFF); TxGangBuf[i][3] = (BYTE)((serNum >> 24) & 0xFF); // only write serial numbers for devices successfully programmed if(results.st.cumulative & mask) { //copy this buffer to internal programmer memory for the intended device printf("Setting serial number 0x%lx for target %d\n", serNum, i); pMSPGangSetGangBuffer(i+1, 4, TxGangBuf[i]); pMSPGangGetGangBuffer(i+1, 4, RxGangBuf[i]); for(m=0; m<4; m++) { if(TxGangBuf[i][m] != RxGangBuf[i][m]) { printf("Internal buffer error\n"); exit(1); } } serNum++; } } //must be set before ......Open_Target_Device(..) pMSPGangSetConfig( CFG_FLASHERASEMODE, ERASE_ALL_MEM_INDEX ); pMSPGangSetConfig( CFG_MASSERASE_AND_INFOA_EN, 1 ); pMSPGangSetConfig( CFG_ERASEINFOA, 1 ); // open targets to enable writing of serial numbers, text message is displayed on Programmer pMSPGangOpenTarget("Serialization\n"); // write all the per-device buffers to the devices at once pMSPGangCopyBuf2Flash(SerNumAddress, 4); // read target devices and save contents in Programmer pMSPGangDefReadTargets(TargetEn, 0, 0, SerNumAddress, SerNumAddress+3); // get pointer to internal buffers stored in DLL pMSPGangGetDataBuffers((&temp)); RxGang = (DATA_BUFFERS *)temp; // compare serial number for each device and check for correctness for (i=0, mask=1; i<GANG_SIZE; i++, mask <<= 1) { if(results.st.cumulative & mask) { int match = 1; LONG readSerNum; // match is used for a byte by byte comparison match = match & (TxGangBuf[i][0] == RxGang->GangRx[SerNumAddress][i]); match = match & (TxGangBuf[i][1] == RxGang->GangRx[SerNumAddress+1][i]); match = match & (TxGangBuf[i][2] == RxGang->GangRx[SerNumAddress+2][i]); match = match & (TxGangBuf[i][3] == RxGang->GangRx[SerNumAddress+3][i]); // readSerNum will hold the LONG value of the serial number, for display purposes only readSerNum = RxGang->GangRx[SerNumAddress][i]; readSerNum += (RxGang->GangRx[SerNumAddress+1][i] << 8); readSerNum += (RxGang->GangRx[SerNumAddress+2][i] << 16); readSerNum += (RxGang->GangRx[SerNumAddress+3][i] << 24); printf("Reading serial number 0x%lx from target %d ...", readSerNum, i); match ? printf("OK\n") : printf("Error\n"); } } // finished with interactive mode, close and disable power to targets pMSPGangCloseTarget(); } //-- Main program -------------------------------------------------------------- // void main() { LONG status; BYTE result[16]; printf("MSPGANG DLL: Application example in C language\n\n"); //Load DLL and initialize functions that I'm going to use. Load_DLL(); // setup for communication printf("MSPGangInitCom %20s", ComPort);//ComPort status = pMSPGangInitCom(ComPort, Baudrate); Evaluate(status); // set device type being programmed in the config. One from the list of compatible MCUs. printf("MSPGangSetMCUName %20s", DeviceType); status = pMSPGangSetMCUName(DeviceType); Evaluate(status); // reset configuration settings to default //printf("MSPGangDefaultConfig %20s", " "); //status = pMSPGangDefaultConfig(); //Evaluate(status); //pMSPGangSetConfig( CFG_FLASHERASEMODE, ERASE_ALL_MEM_INDEX ); //pMSPGangSetConfig( CFG_MASSERASE_AND_INFOA_EN, 1 ); //pMSPGangSetConfig( CFG_ERASEINFOA, 1 ); pMSPGangSetConfig( CFG_SBW_SPEED, 0); pMSPGangSetConfig(CFG_VCC_SETTLE_TIME, 0); // select index for new image, from 0 to 15 printf("MSPGangSelectImage %20d", ImageIndex); status = pMSPGangSelectImage(ImageIndex); Evaluate(status); //printf("pMSPGangSetConfig %20s", "copy from memory"); //status = pMSPGangSetConfig(CFG_COPY_CFG_FROM_MEMORY_EN, 1); //Evaluate(status); status = pMSPGangSetConfig(CFG_PROJECT_SOURCE, 0); status = pMSPGangSetConfig(CFG_USE_SCRIPT_FILE, 0); printf("pMSPGangSetConfig %20s", "first target enabled"); status = pMSPGangSetConfig(CFG_TARGET_EN_INDEX, TARGET_1_MASK); Evaluate(status); // set Voltage, config index 7, Vcc in mV printf("MSPGangSetConfig(Vcc) %19.3fV", (((float)Vcc)/1000.0)); status = pMSPGangSetConfig(CFG_VCCINDEX, Vcc); Evaluate(status); //pMSPGangSetConfig(CFG_VCCINDEX, 3300); // set SettleTime, config index 51, SettleTime in multiples of 20ms printf("MSPGangSetConfig(SetT) %18.0fms", (float)(0)); status = pMSPGangSetConfig(CFG_VCC_SETTLE_TIME, 0); Evaluate(status); printf("MSPGangSetConfig(Vcc On) %20s", "True"); status = pMSPGangSetConfig(CFG_TMP_VCC_ONOFF, 1); Evaluate(status); //printf("MSPGangSetConfig(JTAG_Enable) %20s", "False"); //status = pMSPGangSetConfig(CFG_JTAG_UNLOCK_EN, 0); //Evaluate(status); printf("MSPGangSetConfig(SBW_Speed) %20s", "High"); status = pMSPGangSetConfig(CFG_SBW_SPEED, 0); Evaluate(status); printf("MSPGANG_SetTmpGANG_Config (CFG_TMP_GANG_MASK)"); status = pMSPGangSetTmpGANGConfig(CFG_TMP_GANG_MASK, TARGET_1_MASK); //printf("MSPGangSetConfig(BSL_Enable) %20s", "False"); //status = pMSPGangSetConfig(CFG_BSL_ENH_ENABLE, 0); //Evaluate(status); //printf("MSPGangSetConfig(RST) %20s", "Enable"); //status = pMSPGangSetConfig(CFG_IO_INTERFACE, SBW_VIA_TDOI_BIT); //Evaluate(status); printf("MSPGangSetConfig(SBW) %20s", "Enable"); status = pMSPGangSetConfig(CFG_INTERFACE, INTERFACE_SBW); Evaluate(status); printf("MSPGangSetConfig(Current) %20s", "Max 30 mA"); status = pMSPGangSetConfig(CFG_ICC_HI_EN, 0); Evaluate(status); printf("MSPGangSetConfig(Cumulative_St) %20s", "Disable"); status = pMSPGangSetConfig(CFG_BLOWFUSE, 0); Evaluate(status); status = pMSPGangSetConfig(CFG_RETAIN_CAL_DATA_INDEX, 0); printf("MSPGangSetConfig(Cumulative_St) %20s", "Disable"); status = pMSPGangSetConfig(CFG_TMP_CUMULATIVE_ST_EN, 0); Evaluate(status); pMSPGangSetConfig(CFG_IO_INTERFACE, SBW_VIA_RST_BIT); printf("pMSPGangOpenTarget "); status = pMSPGangOpenTarget(DeviceType); Evaluate(status); pMSPGangSetConfig(CFG_FLASHERASEMODE, ERASE_ALL_MEM_INDEX); pMSPGangSetConfig(CFG_MASSERASE_AND_INFOA_EN, 1); pMSPGangSetConfig(CFG_ERASEINFOA, 1); for (int i = 0; i<16; i++) { result[i] = 0x00; } printf("CFG_PROJECT_SOURCE interactive"); status = pMSPGangSetConfig(CFG_PROJECT_SOURCE, 0); Evaluate(status); printf("MSPGANGInteractiveProcess"); status = pMSPGANGInteractiveProcess(1000); Evaluate(status); printf("MSPGANG_Interactive_ReadBytes %20d", 0x1800); status = pMSPGangInteractiveReadBytes(TARGET_1_MASK, 0x1800, 10, result); Evaluate(status); for (int i = 0; i<16; i++) { printf("0x%x,", result[i]); } Evaluate(status); for (int i = 0; i<130; i++) { result[i] = 0x85; } status = pMSPGANGGetInfoMemory(0x1, result); Evaluate(status); for (int i = 0; i<130; i++) { printf("0x%x,", result[i]); } Evaluate(status); //status = pMSPGangCopyBuf2Flash(0x438, 0x8); printf("pMSPGangOpenTarget "); status = pMSPGangOpenTarget(""); Evaluate(status); printf("pMSPGangInteractiveReadTargets %20s", " "); status = pMSPGangInteractiveReadTargets(0x01); Evaluate(status); // Release programmer unit printf("MSPGangReleaseCom %20s", " "); status = pMSPGangReleaseCom(); Evaluate(status); Sleep(5000); // Detach DLL and exit program Exit(ERR_NONE); }
Andres,
Thank you so much for providing the full code - we now found your issue. When you are setting up the DLL functions, it looks like you have a typo that is causing your issue:
//LONG WINAPI MSPGANG_SetConfig( LONG index, LONG data ); pMSPGangSetConfig = GetProcAddress(hDLL430, "MSPGANG_SetConfig"); pMSPGangSetTmpGANGConfig= GetProcAddress(hDLL430, "MSPGANG_SetTmpGANG_Config"); //LONG WINAPI MSPGANG_GetConfig( LONG index ); pMSPGangSetConfig = GetProcAddress(hDLL430, "MSPGANG_GetConfig"); //LONG WINAPI MSPGANG_Set_MCU_Name( LPTSTR name );
As you can see, you have pMSPGangSetConfig defined a second time, instead of defining pMSPGangGetConfig. This typo means that pMSPGangSetConfig is really pointing to the MSPGANG_GetConfig function from the DLL (since the second definition will override the first one) so none of your device configuration is actually taking effect! If you fix the typo, I think all should work.
Thanks for posting and I hope this resolves your issue!
Regards,
Katie
Hi Katie, first let me thank you for all the help with this matter, i can tell you that now we can read from the MSP-GANG. We apply the changes that you suggested and also add a line to enable power from the MSP-Gang, that solve our issues and allow us to read from the gang proggramer.
Thanks,
Andres G.
**Attention** This is a public forum