【经验分享】KE02掉电存整个EEPROM问题讲解

2020-02-11 10:11发布

一,问题描述
最近有客户遇到EEPOM掉电存储的问题,描述如下:
芯片:MKE02Z64VQH2,
供电:5V供电,并在电源端加470uF的电解电容,延长掉电时间
目标功能:为节约EEPROM寿命,避免程序正常运行时保存所需数据,在掉电中断中保存KE02整个256字节的EEPROM数据。
所遇问题:发现每次断电,再上电读取EEPROM的数据,只能保存二十几个数据。
0x0,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,
0xa,0xb,0xc,0xd,0xe,0xf,0x10,0x11,0x12,0x13,
0x14,0x15,0x16,0x17,0x18,
0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,
PMC的配置情况如下:
void PMC_Configure(void)
{
        PMC_SPMSC1 |= PMC_SPMSC1_LVWACK_MASK; //Clear LVWIE before enable LVWIE
        PMC_SPMSC1 &= ~PMC_SPMSC1_LVDRE_MASK;  //LVD events do not generate hardware resets
        PMC_SPMSC2 |= (PMC_SPMSC2_LVDV_MASK); //high trip point is selected VLVD=VLVDH
        PMC_SPMSC1 |= (PMC_SPMSC1_LVWIE_MASK);        // ENABLE LVW interrupt       
        PMC_SPMSC1 |= (PMC_SPMSC1_LVDE_MASK); // LVD logic is enabled
        enable_irq(6); // enable PMC interrupt, for eeprom data saving
}
按照这样的配置,4.4V开始通知MCU掉电保存EEPROM,为何不能准确保存呢?是否掉电时间太短?还是EERPOM存储执行代码时间太长超出掉电保存时间,还是配置有问题?
具体检查EEPOM执行代码时间,掉电时间情况,以及最后发现根本问题并修改成功的详细情况请查看附件文档。

详情文档:
【经验分享】KE02掉电存EEPROM问题讲解.pdf (376.49 KB, 下载次数: 235) 2015-2-13 17:33 上传 点击文件名下载附件

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
23条回答
zndz410
1楼-- · 2020-02-13 08:42
不错的经验、值得学习
simon51
2楼-- · 2020-02-13 10:51
学习
GFM123
3楼-- · 2020-02-13 11:59
谢谢分享,学习了。
子鱼
4楼-- · 2020-02-13 16:25

不错的经验、值得学习
usm4glx
5楼-- · 2020-02-13 19:56
 精彩回答 2  元偷偷看……

一周热门 更多>