TI中文支持网
TI专业的中文技术问题搜集分享网站

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__

}
Ben Qin:

你好,参考下这篇文档:

software-dl.ti.com/…/MSP430_IEC60730_Software_Package_Users_Guide-1_04_00_05.pdf

,

a ?:

感谢答复,抱歉我没有说清楚,如上述代码所示,privateCalculateCRC的uint16_t *pStartAddress为16bit地址传入,而我的地址是0x10000,如果直接将0x10000传给pStartAddress,显然是不对的,所以不知道该怎么做。而且我用的msp430fr2476是16bit的mcu。

,

Ben Qin:

a ? said:显然是不对的

是编译有报错吗?还是遇到其他问题了?

,

a ?:

我将0x10000传到privateCalculateCRC的uint16_t *pStartAddress后,地址变为了0,我的理解是0x10000地址超过了uint16_t 的表示范围导致的。

,

a ?:

因为我看到,咱们的示例是通过FRAM的地址传入,然后通过*pStartAddress取地址里的内容,进行CRC16的计算,将0x10000传入,地址就不对了。

,

Ben Qin:

你用的是哪个例程?文件路径发一下。

,

a ?:

你好,路径如下:https://www.ti2k.com/wp-content/uploads/ti2k/DeyiSupport_MSP430_MSP430-IEC60730-SW-PACKAGE

具体是里边的IEC60730_crc_test.c文件

,

Ben Qin:

我咨询下资深工程师后回复您。

,

a ?:

好的,有答复了麻烦知会下,感谢。

,

Ben Qin:

看下这个链接看是否有帮助:

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/38837/msp430f5528-how-do-i-declare-a-20-bit-pointer-so-i-can-access-the-upper-memory-locations

,

a ?:

根据上述链接提示,问题已解决,非常感谢!

赞(0)
未经允许不得转载:TI中文支持网 » MSP430FR2476: IEC60730的SDK进行FRAM CRC诊断问题
分享到: 更多 (0)