STM32F030C8 使用LSI的RTC后,PF6/PF7无法使用咨询
数据手册上并没有看到RTC对PF6/PF7有影响,可是实验下来,目前就发现这个问题。这是芯片本身的限制吗?还是我哪里配置有问题。
void RTC_Config(void)
{
RTC_InitTypeDef RTC_InitStructure = {0};
u32 LSIFreq = 0;
/* Enable the PWR clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
/* Allow access to Backup Domain */
PWR_BackupAccessCmd(ENABLE);
/* Enable the LSI OSC */
RCC_LSICmd(ENABLE);
/* Wait till LSI is ready */
while (RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET)
{
}
/* RTC Configuration
******************************************************/
/* Reset Backup Domain */
RCC_BackupResetCmd(ENABLE);
RCC_BackupResetCmd(DISABLE);
/* Select the RTC Clock Source */
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSI);
/* Enable the RTC Clock */
RCC_RTCCLKCmd(ENABLE);
/* Wait for RTC APB registers synchronisation */
RTC_WaitForSynchro();
/* Get the LSI frequency:TIM14 is used to measure the LSI frequency
*/
LSIFreq = RTC_GetLSIFrequency();
RTC_InitStructure.RTC_HourFormat = RTC_HourFormat_24;
RTC_InitStructure.RTC_AsynchPrediv = 99;
RTC_InitStructure.RTC_SynchPrediv =(LSIFreq/100) - 1;
RTC_Init(&RTC_InitStructure);
//Set Default Time/Date
RTC_Default();
}
搞定了,TIM14测频率的时候,中断优先级太高,无法跳转到主程序。 谢谢分享!
页:
[1]