[STM32L0] 备份数据问题

[复制链接]
1200|10
 楼主| gongche 发表于 2016-5-29 17:18 | 显示全部楼层 |阅读模式
TE, ui, ST, tc, RTC

void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data)
{
  uint32_t tmp = 0;

  /* Check the parameters */
  assert_param(IS_RTC_BKP(BackupRegister));

  tmp = (uint32_t)&(hrtc->Instance->BKP0R);
  tmp += (BackupRegister * 4);

  /* Write the specified register */
  *(__IO uint32_t *)tmp = (uint32_t)Data;
}
//-----------------------------------------------------------------------------------------------------------
uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister)
{
  uint32_t tmp = 0;

  /* Check the parameters */
  assert_param(IS_RTC_BKP(BackupRegister));

  tmp = (uint32_t)&(hrtc->Instance->BKP0R);
  tmp += (BackupRegister * 4);
  
  /* Read the specified register */
  return (*(__IO uint32_t *)tmp);
}
huwr 发表于 2016-5-29 17:21 | 显示全部楼层
官方历程库没有给相关例子
 楼主| gongche 发表于 2016-5-29 17:21 | 显示全部楼层
用例程库里面的函数。 实际测试。 无法存储。 哪位有相应代码。 可否指点一下!!
huanghuac 发表于 2016-5-29 17:22 | 显示全部楼层
RTC的例程网上有很多的吧 。  很多开发板都有这个例程。
happy_10 发表于 2016-5-29 17:23 | 显示全部楼层
用例程库里面的函数。 实际测试。
 楼主| gongche 发表于 2016-5-29 17:25 | 显示全部楼层
例程库里面的函数测试了。 不行。  
happy_10 发表于 2016-5-29 17:26 | 显示全部楼层
怎么不行?
 楼主| gongche 发表于 2016-5-29 17:26 | 显示全部楼层
发现可以进行读写。 但是待机模式唤醒后。 就清零了。
冰清玉洁 发表于 2016-5-29 17:27 | 显示全部楼层
这个还真没见过啊
 楼主| gongche 发表于 2016-5-29 17:29 | 显示全部楼层
算了,周一再说吧,结贴啦
Rangar 发表于 2016-5-29 21:22 | 显示全部楼层
是不是就没有存储成功呢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

768

主题

9410

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部