硬件环境:STM32F407ZE(使用金点原子例程RTC工作正常)
软件环境:KEIL5
RTC配置如下:
static void RTC_Config(void)
{
/* Enable the PWR clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
/* Allow access to RTC */
PWR_BackupAccessCmd(ENABLE);
/* Reset RTC Domain */
//RCC_BackupResetCmd(ENABLE);
//RCC_BackupResetCmd(DISABLE);
/* Enable the LSE OSC */
RCC_LSEConfig(RCC_LSE_ON);
/* Wait till LSE is ready */
while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
{
}
/* Select the RTC Clock Source */
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
/* Configure the RTC data register and RTC prescaler */
/* ck_spre(1Hz) = RTCCLK(LSI) /(AsynchPrediv + 1)*(SynchPrediv + 1)*/
RTC_InitStructure.RTC_AsynchPrediv = 0x7F;
RTC_InitStructure.RTC_SynchPrediv = 0xFF;
RTC_InitStructure.RTC_HourFormat = RTC_HourFormat_24;
RTC_Init(&RTC_InitStructure);
/* Set the time to 00h 00mn 00s AM */
RTC_TimeStruct.RTC_H12 = RTC_H12_AM;
RTC_TimeStruct.RTC_Hours = 0x11;
RTC_TimeStruct.RTC_Minutes = 0x55;
RTC_TimeStruct.RTC_Seconds = 0;
RTC_SetTime(RTC_Format_BCD, &RTC_TimeStruct);
//RTC_GetTime(RTC_Format_BCD, &RTC_TimeStruct);
}
问题如下:
388行 *(__IO uint8_t *) BDCR_ADDRESS = RCC_LSE_ON;断点调试为灰 {MOD},单步调试整个switch语句跳过;
查看汇编如下:
请教该问题原因?
若是这样不敢轻易尝试优化,有些问题隐蔽了很难找了!
一周热门 更多>