在线时间9 小时
UID155127
注册时间2009-10-19
NXP金币0
该用户从未签到
注册会员

- 积分
- 110
- 最后登录
- 1970-1-1
|
问题背景:MCU为MK10DX128VLL7,使用J-Link V8调试器,Keil开发环境。
问题:使用增强型EEP的功能,将FlexNvm 32K全部分配给EEPROM,EEPROM大小为2K(最大),如下分区函数,在调试时,如果全速运行,一直会产生复位,如果在语句“ FTFL->FSTAT |= FTFL_FSTAT_CCIF_MASK;"设断点,再单步运行,则可运行通过,后续也可以正常写入和读取。请问这是什么问题导致的?如何解决呢?是不是有那些特殊寄存器要配置?谢谢!
注:我也试过下载后,不接调试器,直接上电运行,问题是一样会出现的。
EEP分区函数的调用语句:
(void)partition_flash(EEPROM_2K,DFLASH_SIZE_0);
常量定义:
#define EEPROM_0 0x0F
#define EEPROM_32 0x09
#define EEPROM_64 0x08
#define EEPROM_128 0x07
#define EEPROM_256 0x06
#define EEPROM_512 0x05
#define EEPROM_1K 0x04
#define EEPROM_2K 0x03
/* Defines for the dflash_size parameter */
#define DFLASH_SIZE_32K 0x00
#define DFLASH_SIZE_24K 0x01
#define DFLASH_SIZE_16K 0x02
#define DFLASH_SIZE_0 0x03
#define DFLASH_SIZE_8K 0x0B
#define EEP_BaseAddr 0x14000000
函数体:
uchar partition_flash(uint8_t eeprom_size, uint8_t dflash_size)
{
//uint8_t waitCnt = 0;
/* Test to make sure the device is not already partitioned. If it
* is already partitioned, then return with no action performed.
*/
if ((SIM->FCFG1 & SIM_FCFG1_DEPART(0xF)) != 0x00000F00)
{
return ERROR;
}
/* Wait for the command to complete */
while(!(FTFL->FSTAT & FTFL_FSTAT_CCIF_MASK))
{
}
/* Write the FCCOB registers */
FTFL->FCCOB0 = FTFL_FCCOB0_CCOBn(0x80); // Selects the PGMPART command
FTFL->FCCOB1 = 0x00;
FTFL->FCCOB2 = 0x00;
FTFL->FCCOB3 = 0x00;
/* FCCOB4 is written with the code for the subsystem sizes (eeprom_size define) */
FTFL->FCCOB4 = 0x30|eeprom_size;
/* FFCOB5 is written with the code for the Dflash size (dflash_size define) */
FTFL->FCCOB5 = dflash_size;
//while(--waitCnt);
/* All required FCCOBx registers are written, so launch the command */
FTFL->FSTAT |= FTFL_FSTAT_CCIF_MASK;
//while(--waitCnt);
/* Wait for the command to complete */
while(!(FTFL->FSTAT & FTFL_FSTAT_CCIF_MASK));
return SUCCESS;
}
|
|