Question
Save user data in Backup domain
Posted on September 30, 2014 at 06:34
Hello Pro,
I want to save my data in to backup domain to backup data when reset happen ( watch dog timer reset). This is my code : uint16_t domua;// I wan to save this data. /* Configure the PVD Level to 2.9V */ PWR_PVDLevelConfig(PWR_PVDLevel_2V2); /* Enable PWR and BKP clock */ RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE); /* Enable access backup and RTC */ PWR_BackupAccessCmd(ENABLE); domua=TIM_GetCounter(TIM2);// BKP_WriteBackupRegister(BKP_DR1, domua);// Back up data do mua. /***when watch dog timer reset, domua=0, At this time, I want to back up this data*/ if (domua==0){domua+=BKP_ReadBackupRegister(BKP_DR1);} But it doesn't work as I wish. Please help me point out what is going wrong ? Thanks a lot, Minh