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.

MSP430FR2476: IEC60730的SDK进行FRAM CRC诊断问题

Part Number: MSP430FR2476

您好:

      我使用IEC60730的SDK进行FRAM的CRC检测,我看到提供的CRC接口如下所示,请问下,我的.text.2的起始地址是0x10000,如果我想诊断这里的代码,我应该怎么做?

static uint16_t privateCalculateCRC(uint16_t *pStartAddress, uint16_t memorySize){

	uint32_t i;

// Feed WDT in case user has WDT enabled before running CRC test
#if ENABLED_WDT
	uint16_t wdtConfig =  WDTCTL & 0x00ff;
	WDTCTL = WDTPW + WDTCNTCL + wdtConfig;
#endif // ENABLED_WDT
// If MSP430 has a CRC module, checksum is calculated using CRC module
#if defined(__MSP430_HAS_CRC__)
	// Set initial value for CRC16-CCITT calculation
	CRCINIRES= CRC16_CCITT_SEED;

	for (i = 0; i < memorySize/2; i++)
	{
		//Add all of the values into the CRC signature
		CRCDIRB= *pStartAddress++;
		// Feed WDT in case user has WDT enabled before running CRC test
#if ENABLED_WDT
		if((i%50)==0)
		{
			WDTCTL = WDTPW + WDTCNTCL + wdtConfig;
		}
#endif // ENABLED_WDT

	}

	return (CRCINIRES);

#else

	uint8_t j;
	uint16_t memoryContent;
	uint16_t crc = CRC16_CCITT_SEED;

	for(i = 0 ; i < memorySize/2 ; i ++)
	{
		// Byte reverse
		memoryContent = ((*pStartAddress & 0x00FF) << 8) +
						((*pStartAddress & 0xFF00) >> 8);

		for(j = 0 ; j < 16 ; j++)
		{
			if((memoryContent ^ crc) >> 15){
				crc = (crc << 1) ^ CRC16_CCITT_POLY;
			}else{
				crc <<= 1;
			}
			memoryContent <<= 1;
		}
		pStartAddress++;

	}

	return crc;

#endif //__MSP430_HAS_CRC__

}