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 .