一,问题描述
最近有客户遇到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)
|