HK32F103C8T6直接烧录STM32F103C8T6的程序,BKP寄出器异常
HK32F103C8T6用st的程序,功能都正常,但是这个BKP_DR寄存器在软复位的时候被清空了,这个有办法解决么?用仿真器看过,复位之前,数据已经写到寄存器里面了,但是软复位之后数据被清零 你把你的工程代码贴出来看看。 void Sys_Soft_Reset(void)
{
//重启
CAN_DeInit(CAN1);
CAN_ITConfig(CAN1,CAN_IT_FMP0,ENABLE);
EXTI_DeInit();
TIM_DeInit(TIM3);
USART_DeInit(USART1);
USART_DeInit(USART3);
s_sys_info.s_sys_saved_info.v_auto_reset_flag = 1;
s_sys_info.v_auto_reset_count = 0;
bt_info.s_bt_cfg.v_checksum = MsgChkSum((INT8U *)&bt_info.s_bt_cfg,1,sizeof(bt_info.s_bt_cfg) - 2);
STMFLASH_Write(BT_DATA_ADD,(INT16U *)&bt_info.s_bt_cfg,sizeof(bt_info.s_bt_cfg) >> 1);//保存蓝牙配置
STMFLASH_Write(BT_DATA_BACKUP_ADD,(INT16U *)&bt_info.s_bt_cfg,sizeof(bt_info.s_bt_cfg) >> 1);//保存蓝牙配置
//保存车型
s_sys_info.s_footboard_config.v_checksum = MsgChkSum((INT8U *)&s_sys_info.s_footboard_config,2,sizeof(s_sys_info.s_footboard_config) - 2);
STMFLASH_Write(CURRENT_CAR_DATA_ADD,(u16*)(&s_sys_info.s_footboard_config),sizeof(s_sys_info.s_footboard_config)/2);
STMFLASH_Write(CURRENT_CAR_DATA_BACKUP_ADD,(u16*)(&s_sys_info.s_footboard_config),sizeof(s_sys_info.s_footboard_config)/2);
//保存系统信息
BKP_Write_Register(BKP_DR1,0x55AA);//保存后备寄存器标志
BKP_Write_Register(BKP_DR2,s_sys_info.s_sys_saved_info.v_auto_reset_flag);//保存自动重启标记
BKP_Write_Register(BKP_DR3,s_sys_info.s_sys_saved_info.v_left_door_change_num);//保存左门开关次数标记
SCB->AIRCR =0X05FA0000|(u32)0x04;
}
//读取系统信息
s_sys_info.s_sys_saved_info.v_saved_id = BKP_Read_Register(BKP_DR1);//保存后备寄存器标志
s_sys_info.s_sys_saved_info.v_auto_reset_flag = BKP_Read_Register(BKP_DR2);//保存自动重启标记
s_sys_info.s_sys_saved_info.v_left_door_change_num = BKP_Read_Register(BKP_DR3);//保存左门开关次数标记
这段是复位后的读取,复位前,我看到寄出器里面已经有数据了,但是复位后在各种初始化之前查看寄存器,数据已经清零 顶一下,遇到同样问题了 圣骑士by 发表于 2021-1-7 11:49
顶一下,遇到同样问题了
应用笔记有记录,根据应用笔记修改代码就可以了 按照应用笔记来进行修改。
页:
[1]