[bsp/n32] 修复每次上电都初始化RTC导致上电时间被重置的问题

This commit is contained in:
liangzohar 2024-09-10 16:54:03 +08:00 committed by Meco Man
parent 9de975fa93
commit 240172609c
1 changed files with 60 additions and 53 deletions

View File

@ -14,6 +14,8 @@
#ifdef BSP_USING_RTC
#define USER_WRITE_BKP_DAT1_DATA 0xA5A5
uint32_t SynchPrediv, AsynchPrediv;
static rt_err_t n32_rtc_get_timeval(struct timeval *tv)
@ -105,6 +107,8 @@ static rt_err_t n32_rtc_init(void)
/* Allow access to RTC */
PWR_BackupAccessEnable(ENABLE);
if (USER_WRITE_BKP_DAT1_DATA != BKP_ReadBkpData(BKP_DAT1) )
{
#if defined(SOC_N32G45X) || defined(SOC_N32WB452)
/* Reset Backup */
@ -194,6 +198,9 @@ static rt_err_t n32_rtc_init(void)
return -RT_ERROR;
}
BKP_WriteBkpData(BKP_DAT1, USER_WRITE_BKP_DAT1_DATA);
}
return RT_EOK;
}