AnsweredAssumed Answered

Save user data in Backup domain

Question asked by nhat_minh.nguyen on Sep 30, 2014
Latest reply on Oct 1, 2014 by sung.chen_chung
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

Outcomes