2012-09-05 10:55 PM
/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/stm32f4+dicovery++problems+coming+in+configuring+RTC.only+few+corrections+needed&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F¤tviews=154♯{2E8F2AEA-E1AC-4359-9FBC-341F279053F3}
the control flow is stuck on this placewhile(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
{ }i think that i mistook onoscillating frequency.BUT could not find it.attached the files.you may refer it please.
#rtc #wait-for-you--clive1-!-!-!2012-09-06 06:52 AM
This has worked for me, assumes you have a suitable crystal, loading, and solder bridges.
if (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
{
printf(''Starting LSE
'');
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); /* Enable PWR clock */
PWR_BackupAccessCmd(ENABLE); /* Allow access to BKP Domain */
RCC_LSEConfig(RCC_LSE_ON); /* Enable the LSE oscillator */
while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET); /* Wait till LSE is ready */
}
2012-09-06 07:29 AM
while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET); /* Wait till LSE is ready */
Now the control flow flows with in this statement.i think that it is waiting for LSE(but it does not ready)what should i do for LSE will go to ready state.i did not change any hardware modification.only i change the HSE_VALUE of the code and also attached that file in this post above.2012-09-06 07:30 AM
2012-09-06 10:21 AM
You'll need to modify the STM32F4-Discovery board, it doesn't come with an LSE crystal, at least mine didn't.
Without parts at X3, C16, C27, and removing SB15 and SB16, the LSE is not going to tick or come ready.2012-09-06 11:19 PM
The value of the x3 is OSC 32 KHz clock supply?
2012-09-07 10:32 AM
Yes, it is the Low Speed Oscillator, nominally 768 KHz 6pF
MC306-G-06Q-768http://search.alkon.net/cgi-bin/pdf.pl?pdfname=07pdf
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/APPLICATION_NOTE/CD002216pdf
2012-12-24 07:23 AM
above mistakes were rectified.
\stm32f4_dsp_stdperiph_lib\STM32F4xx_DSP_StdPeriph_Lib_V1.0.1\Project\STM32F4xx_StdPeriph_Examples\RTC\TimeStampI used this example.but it went to printf statement/* Check on RTC init */
if (RTC_Init(&RTC_InitStructure) == ERROR)
{
printf(''\n\r /!\\*****
RTC Prescaler Config failed
********/!\\ \n\r'');
}
and also went to this printf statement:/* Configure the RTC time register */
if(RTC_SetTime(RTC_Format_BIN, &RTC_TimeStructure) == ERROR) { printf(''\n\r>>!! RTC Set Time failed. !!
<<\n\r'');
} any suggestion what had gone wrong2012-12-24 07:42 AM
Can you measure an oscillation on a scope with the code fragment I provided earlier? If that doesn't work nothing else is going to function correctly downstream.
2012-12-25 12:15 AM
Now i does not have oscilloscope but i did all things you had given like connection diagram and LSE starting code.now the code goes to ''
LSE NOT READY
''if (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
{ printf(''Starting LSE\n''); RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); /* Enable PWR clock */ PWR_BackupAccessCmd(ENABLE); /* Allow access to BKP Domain */ RCC_LSEConfig(RCC_LSE_ON); /* Enable the LSE oscillator */ while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET) /* Wait till LSE is ready*/ {printf(''\n\r LSE NOT READY \n\r'');
}
}