2014-03-06 12:52 PM
Hi, i have just bought an stm32f0 discovery board in order to use its real time clock.
I follower the instruction in the Rtc file.This is my configuration and the main function. My problem is when i start the debugger , the program get stuck inRTC_StructInit( RTC_InitStruct)
and then The HardFault Handler starts.I am using all St's default firmware functions.
Can you please help me ?
#include<
stm32f0xx_rtc.h
>
#include ''stm32f0xx.h''
RTC_InitTypeDef* RTC_InitStruct;
RTC_TimeTypeDef* RTC_TimeStruct;
uint8_t GiveTimeRTC(void)
{FunctionalState state=ENABLE;
RTC_WriteProtectionCmd(DISABLE);
RTC_EnterInitMode();
RTC_StructInit( RTC_InitStruct);
RTC_Init(RTC_InitStruct);
RTC_ExitInitMode();
RTC_WaitForSynchro();
RTC_BypassShadowCmd(state);
RTC_WriteProtectionCmd(DISABLE);
RTC_TimeStructInit( RTC_TimeStruct);
RTC_SetTime( RTC_Format_BIN,RTC_TimeStruct);
uint8_t Minutes;
RTC_GetTime( RTC_Format_BIN, RTC_TimeStruct);
Minutes=RTC_TimeStruct->RTC_Minutes;
return(Minutes);
}
void main(void)
{uint8_t Minutes=GiveTimeRTC();
}
#ifdef USE_FULL_ASSERT
void assert_failed(uint8_t* file, uint32_t line)
{
while (1)
{
}
}
#endif