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.

MSP430F6736A: msp gang programmer dll

Part Number: MSP430F6736A

Hi all

I'm writing an app to instruct the MSP Gang to download a firmware image to a msp430f6736A chip using the GANG430.dll (ver 01.03.01.00)

All appears to be ok EXCEPT i dont seem to be able to cause it to write to infoA (nor for that matter infoB although infoC & D have no issues).

I imagine the issue with infoA has to do with its special status, so where would i look to mimic the 'unlock infoA' functionality just like the gang does?

thanks

moshe

  • Hello Moshe,

    You are probably already well aware, but the MSP-GANG Dll commands are broken down in the MSP-Gang User's Guide:   http://www.ti.com/lit/ug/slau358p/slau358p.pdf 

    But, Looking through that document, I don't see any specific commands for writing the infoA segments.  Just the standard interactiveProcess and writebytes_to_flash.  

    What commands are you currently using to try and write the information memory?  

    Thanks,

    JD

     

  • Hi JD

    Yes i was looking at the guide.

    this is what i'm doing...

    i set the following:

    MSPGANG_SetConfig(CFG_MASSERASE_AND_INFOA_EN, 1);
    MSPGANG_SetConfig(CFG_ERASEINFOA, 1);
    MSPGANG_SetConfig(CFG_READINFOA, 1);
    MSPGANG_SetConfig(CFG_ERASEINFOB, 1);
    MSPGANG_SetConfig(CFG_READINFOB, 1);
    MSPGANG_SetConfig(CFG_ERASEINFOC, 1);
    MSPGANG_SetConfig(CFG_READINFOC, 1);
    MSPGANG_SetConfig(CFG_ERASEINFOD, 1);
    MSPGANG_SetConfig(CFG_READINFOD, 1);
    MSPGANG_SetConfig(CFG_FLASHREADMODE, READ_ALL_MEM_INDEX);
    MSPGANG_SetConfig(CFG_MSP432_CLR_LOCKING_OPTIONS, MSP432_CLR_LOCKING_INFOA_BIT);

    then i do the following sequence to download the firmware..

    MSPGANG_Interactive_Open_Target_Device(Buff(msg).data());
    MSPGANG_SetTmpGANG_Config(CFG_TMP_CLEAR, 0);
    MSPGANG_SetTmpGANG_Config(CFG_TMP_TASK_MASK, 0xFFFF);
    MSPGANG_CreateGangImage(Buff(msg).data());
    MSPGANG_InteractiveProcess(timeout);
    MSPGANG_Interactive_Close_Target_Device();

    and finally i call
    MSPGANG_Interactive_Copy_GANG_Buffer_to_FLASH(address, BUFSIZE))
    to write data into the infoA area.

    thanks

    moshe

  • Hey Moshe,

    I don't have much expertise with this use case.  I'm trying to check with some of the tools team to see if they can give any input.  Might be a day or two.  

    Thanks

    JD

  • Hi Moshe,

    When you execute MSPGANG_Interactive_Close_Target_Device();, then MSPGANG_Interactive_Copy_GANG_Buffer_to_FLASH(address, BUFSIZE)) does not work. The target must be open first and the mentioned function must be used before closing target device, Let me know if that help.

    Best regards,
    Gregory Czajkowski
    Elprotronic Inc.

  • Hi Gregory

    yes i ensured the sequence was as you wrote...but it didnt change anything.

    I decided to go back a few steps & used the "simpleMSP-Gang" c# example modified for my purposes.

    I am now getting "ERROR 41: Gang Flash write error"  on infoA area only (B/C/D work fine).

    Perhaps you could give me some pointers as to what could cause this error.

    I've attached the code in textFile.txt if its of any help.
    i'm using visual studio 2013 on a win10 64bit pc.


    Using the MSP-Gang-GUI ver G430 01.03.01.00 to Read and writing between the MSP gang to my custom board has no issues so i dont see the error41 as a result of any hardware issues.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using  MSP_GANG_Programmer;
    //using System.Runtime.InteropServices;
    
    namespace SimpleMspGang
    {
        public partial class Form1 : Form
        {
            String reportText = "";
            int status = 0;
    
            public Form1()
            {
                InitializeComponent();
            }
    
            private void StartButton_Click(object sender, EventArgs e)
            {
                GangInit();
                PrintReportMsg("FlashReadMode          ", false);
                status = MSPGANG_API.SetConfig(ConfigIndexes.CFG_FLASHREADMODE, ConfigIndexes.READ_ALL_MEM_INDEX);
                if (Evaluate(status)) return;
                PrintReportMsg("FlashEraseMode          ", false);
                status = MSPGANG_API.SetConfig(ConfigIndexes.CFG_FLASHERASEMODE, ConfigIndexes.ERASE_ALL_MEM_INDEX);
                if (Evaluate(status)) return;
                PrintReportMsg("Erase InfoA          ", false);
                status = MSPGANG_API.SetConfig(ConfigIndexes.CFG_ERASEINFOA, 1);
                if (Evaluate(status)) return;   
                    byte [] data = new byte[128];
                    int target, dataSize;
                    PrintReportMsg("step1          ", false);
                    status = MSPGANG_API.Interactive_Open_Target_Device("step1" );
                    if (Evaluate(status)) return;
    
                    PrintReportMsg("Erase sector infoA          ", false);
                    status = MSPGANG_API.Interactive_EraseSectors(0x1980, 0x19ff);
                    if (Evaluate(status)) return;
    
                    PrintReportMsg("Close Target          ", false);
                    MSPGANG_API.Interactive_Close_Target_Device();
                    if (Evaluate(status)) return;
    
                    PrintReportMsg("step2          ", false);
                    status = MSPGANG_API.Interactive_Open_Target_Device("step2");
                    if (Evaluate(status)) return;
    
                    target = 6; 
                    dataSize = 128;
                    unsafe
                    {
                    fixed (byte* aptr = &data[0])
                    {
                    for(int k = 0; k < 128; k++)
                        aptr[k] = (byte)(k + 3);
                    PrintReportMsg("SetGangBuffer          ", false);
                    status = MSPGANG_API.SetGangBuffer((byte)target, (byte)dataSize, aptr);
                    if (Evaluate(status)) return;
                    PrintReportMsg("Copy buffer to flash          ", false);
                    status = MSPGANG_API.Interactive_Copy_GANG_Buffer_to_FLASH(0x1980, dataSize); //copy data to FLASH
                    }
                    if (Evaluate(status)) return;            
                }
                
                /*
                // execute main process and show result. Erase, Blank Check, Program, Verify.
                PrintReportMsg("MSPGANG_MainProcess          ", false);
                status = MSPGANG_API.MainProcess(1000);
                PrintReportMsg("  Analysis Below:", true);
    
                // analyze results of programming
                ShowDiagnostic();
                */
                //MSPGANG_InteractiveProcess(1000);
                PrintReportMsg("Start Complete", true);
                MSPGANG_API.Interactive_Close_Target_Device();
                MSPGANG_API.ReleaseCom();
            }
    
            private void GangInit()
            {
                // setup for communication
                PrintReportMsg("MSPGANG_InitCom              ", false);
                status = MSPGANG_API.InitCom(Demo.ComPort, Demo.Baudrate); // com5 & 115200k
                if (Evaluate(status)) return;
    
                // reset configuration settings to default
                PrintReportMsg("MSPGANG_Default_Config       ", false);
                status = MSPGANG_API.Default_Config();
                if (Evaluate(status)) return;
    
                // set device type being programmed in the config.  One from the list of compatible MCUs.
                PrintReportMsg("MSPGANG_Set_MCU_Name         ", false);
                status = MSPGANG_API.Set_MCU_Name(Demo.DeviceType); //msp430f6736a
                if (Evaluate(status)) return;
    
                // set SettleTime, config index 51, SettleTime in multiples of 20ms
                PrintReportMsg("MSPGANG_SetConfig(SetT)      ", false);
                status = MSPGANG_API.SetConfig(ConfigIndexes.CFG_VCC_SETTLE_TIME, Demo.SettleTime);
                if (Evaluate(status)) return;
    
                // set targets enabled, config index 10, determines which targets are programmed
                PrintReportMsg("MSPGANG_SetConfig(TarEn)     ", false);
                status = MSPGANG_API.SetConfig(ConfigIndexes.CFG_TARGET_EN_INDEX, Demo.TargetEn);
                if (Evaluate(status)) return;
    
    //            MSPGANG_API.SetConfig(ConfigIndexes.CFG_FLASHREADMODE, ConfigIndexes.READ_ALL_MEM_INDEX); 
                MSPGANG_API.SetConfig(ConfigIndexes.CFG_READINFOB, 1);
                MSPGANG_API.SetConfig(ConfigIndexes.CFG_READINFOC, 1);
    
            }
    
        }
    }
    
    

    thanks

    moshe

    UPDATE:
    i'm updating my post because i have resolved my issue & i'm writing it here for the benefit of others who may find the same problem.
    InfoA IS different due to its locked nature.

    A FURTHER setConfig is required to deal with this segment... 
    MSPGANG_API.SetConfig(ConfigIndexes.CFG_MASSERASE_AND_INFOA_EN,1);
    I placed it BEFORE the MSPGANG_API.SetConfig(ConfigIndexes.CFG_ERASEINFOA, 1);
    but after the MSPGANG_API.SetConfig(ConfigIndexes.CFG_FLASHERASEMODE, ConfigIndexes.ERASE_ALL_MEM_INDEX);

    i was under the miconception that this was for MSP432 only!

    and further, one can use either:
    MSPGANG_API.Interactive_Copy_GANG_Buffer_to_FLASH(0x1980, dataSize); 
    or
    MSPGANG_API.Interactive_WriteBytes_to_FLASH(0x1980, dataSize, aptr); 
    to suit your own purpose...

**Attention** This is a public forum