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.

programing questions about the differences between MSP430F5438 and MSP430F5438A

Hi everyone,

I have a problem that puzzled me for nearly a week,however I still can't find the way,so i hope some guy could do me a favor.

I made a  MSP430 Programmer according to the infomation that TI providered on it's web.

My homemade programmer  can   download appliaction code into F1xx \ F2xx\ F4xx family, and F5418\F5438. however the  problem occurs when I verify the code that i download into F5438A.

******************************************************************************************************

The TEST on F5418/F5438:

1)get the  JTAG_ID(0x91)-----OK

2)Erase Flash -------OK (read the target MCU's FLASH by TI's GANG430  ,all 0xFF )

3)Erase Flash check---OK(use fuction VerifyPSA_430Xv2 and it returns STATUS_OK )

4)program --OK (  affirming the code download into F5438A is correct by using Ti's GANG430)

5)verify the code ---faiure(use fuction VerifyPSA_430Xv2 , it returns STATUS_OK )

***************************************************************************************************

The TEST on F5438A:

1)get the  JTAG_ID(0x91)-----OK

2)Erase Flash -------OK (read the target MCU's FLASH by TI's GANG430  ,all 0xFF )

3)Erase Flash check---OK(use fuction VerifyPSA_430Xv2 and it returns STATUS_OK )

4)program --OK (  affirming the code download into F5438A is correct by using Ti's GANG430)

5)verify the code ---faiure(use fuction VerifyPSA_430Xv2 , it returns STATUS_ERROR )

when I take the test on F5529 , it's the same to F5438A , so how this happens?

any ideas,hints,infomation  would be appreciated.

 

《MSP430 programing via the JTAG interface User's Guider》 (slau320a)

the veriy fuctions TI providered.

word VerifyPSA_430Xv2(unsigned long StartAddr, unsigned long Length, word *DataArray)
{
    word TDOword;
    ulong i;
    word POLY = 0x0805;
    word PSA_CRC = (word)(StartAddr-2);   // Start value for PSA calculation
   
    ExecutePOR_430Xv2();
   
    SetPC_430Xv2(StartAddr);
    SetTCLK();
    IR_Shift(IR_CNTRL_SIG_16BIT);
    DR_Shift16(0x0501);
   
    IR_Shift(IR_DATA_16BIT);
    DR_Shift16(PSA_CRC);
   
    IR_Shift(IR_DATA_PSA);
   
    for (i = 0; i < Length; i++)
    {
        // Calculate the PSA (Pseudo Signature Analysis) value
        if ((PSA_CRC & 0x8000) == 0x8000)
        {
            PSA_CRC ^= POLY;
            PSA_CRC <<= 1;
            PSA_CRC |= 0x0001;
        }
        else
        {
            PSA_CRC <<= 1;
        }
        // if pointer is 0 then use erase check mask, otherwise data
        &DataArray[0] == 0 ? (PSA_CRC ^= 0xFFFF) : (PSA_CRC ^= DataArray[i]);
       
        ClrTCK();
       
        SetTMS();
        SetTCK();            // Select DR scan
        ClrTCK();
        ClrTMS();
       
        SetTCK();            // Capture DR
        ClrTCK();
       
        SetTCK();            // Shift DR
        ClrTCK();
       
        SetTMS();
        SetTCK();            // Exit DR
        ClrTCK();
        SetTCK();
        ClrTMS();
        ClrTCK();
        SetTCK();
        //#endif
        if(i < Length-1)
        {
            // clock through the PSA
            ClrTCLK();
            SetTCLK();
        }
    }
    IR_Shift(IR_SHIFT_OUT_PSA);
    TDOword = DR_Shift16(0x0000);     // Read out the PSA value
   
    ExecutePOR_430Xv2();
   
    return((TDOword == PSA_CRC) ? STATUS_OK : STATUS_ERROR);
}

//----------------------------------------------------------------------------------------------------------------------------

besides ,in MSP430Xv2 ,to get a correct JTAG_ID is  harder than in MSP430 or MSP430X. TI then add a fuctions named  word magicPattern(void) to sovle this problem,

is there anyone know the details about magicPattern ?the infomation on 《MSP430 programing via the JTAG interface User's Guider》is quite limited.

Thanks .

 

  • Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

    Hi Benny,

    1 - Lets me first answer your question regarding the magic pattern.

    The magic pattern is a boot force method to get a device under JTAG control which is for example in an endless reset cycle.

    Imagine you have change something in the SYS register, which forces a BOR, directly at the beginning of you msp430 code. The msp will start up and directly resets itself.

    The magic pattern pulls the RST pin of your tool low. If this pin is low the msp430 won’t startup. After that we are doing an entry sequence for SBW2 or SBW4 but keeping the RST pin low during this entry sequence. Then we have to do a JTAG tap reset. If this is done we are shifting 0xA55A  into the JTAG mailbox. This 0xA55A pattern will stop the device before executing user code. (0xa55a is the magic pattern).  If we now release the RST pin the device will start but not execute the user code.

    If you have more questions here feel free to contact me.

    2 - Now let’s talk about the verify function.

    Do you have done a read back of the written date to see if this is correct?

    Please note the (unsigned long Length) is  length to be verified in WORDS.

    Regards
    Florian

  • Hi Florian, thank U for your answering.

    1st)

    "This 0xA55A pattern will stop the device before executing user code. (0xa55a is the magic pattern). 

     If we now release the RST pin the device will start but not execute the user code." --------what  this means?  I turned to the page28 in SLAU320A, it seems like the device is in LPM4. Is my understanding correct?  Besides, can U talk something about JTAGMAIL BOX? I read that in 5xx User's Guide  but the contens is mainly about some flags and the trigger events relate the flag.

    could U give me some suggestion  on how to use  JTAGMAIL BOX, and its main applications. (My native language is not English,so some contents in the User's Guide, I can't understand completely.)

    -------------------------------------------------------------------------------------------------------

    2nd) I have read the code in the target MCU by TI's GANG430,confirmed that the code is correct. and I also noted that it is  verified in WORDS. Mentioned in my previous post,I have verify the code sucessfully in F5438 but failed on F5438A which pluzzed me most.

    Expecting your answer.

  • Benny Chen said:
    the device will start but not execute the user code." --------what  this means?

    After power-on, the device will jump into a protected memory section whcih contains some startup code., This startup code will check for the BSL entry sequence and/or the 'magic pattern' and then either execute the BSL (Boot Strap Loader) code in this hidden memory or make jump over the reset vector into the user program.

    Therefore, unlike most other microcontrollers, the device will NOT start immediately with the code the reset vector points to (or at 0x0000, like some others do, mainly harvard-machines wiht separate code and data address space)

  • Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

    HI Jens,

    please let me enhance your comment

    “after power-on, the device will jump into a protected memory section”

    - that is not true for the 5438A or other 5xx devices. For 5xx/6xx devices the JTAG mailbox is used to shift in the “magic pattern 0xa55a”. If this pattern is read during device startup. The device will be send into LPM4

    - for 1xx-4xx the magic pattern, is as you mentions the BSL entry.

    @Ben -> have a look into the magic pattern, Xv2writeFlash and Xv2eraseFlash functions. They all use the JTAG mailbox to do communication with a running device via JTAG.

    Do you use SBW2 or SBW4 to communicate with your device.

    Regards Florian

  • Thank you both for the answer. Because of the Spring Festival,I was  out of the office for nearly a week.

    Yes,I  used SBW2 oand SBW4 to communicate with my device and it's OK .

    I just want to know if there is something different between F5438 and F5438A on using function  VerifyPSA_430Xv2?

  •  I have solved  the problem.  TI has updataed the fuction  VerifyPSA_430Xv2 .

    thanks for Florian and Jens-Michael 's help once more.

**Attention** This is a public forum