查看: 2219|回复: 0

[求助] MK10DX128VLL7 EEP分区产生复位问题请教!!

[复制链接]

该用户从未签到

7

主题

25

帖子

0

注册会员

Rank: 2

积分
110
最后登录
1970-1-1
发表于 2015-3-29 23:19:20 | 显示全部楼层 |阅读模式
问题背景: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;
}

我知道答案 目前已有0人回答
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条

Archiver|手机版|小黑屋|恩智浦技术社区

GMT+8, 2025-7-22 21:19 , Processed in 0.079781 second(s), 20 queries , MemCache On.

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表