cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f407 Discovery RTC

vinothraj
Associate II
Posted on September 06, 2012 at 07:55

i try to show the time in Hiper terminal using uart.my problem  is moreover this link-

 

/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&currentviews=154♯{2E8F2AEA-E1AC-4359-9FBC-341F279053F3}

       

the control flow is stuck on this place

while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)

  {

  }

i think that i mistook on  

oscillating frequency.BUT could not find it.attached the files.you may refer it please.

#rtc #wait-for-you--clive1-!-!-!
20 REPLIES 20
Posted on September 06, 2012 at 15:52

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 */
}

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
vinothraj
Associate II
Posted on September 06, 2012 at 16:29

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.  

vinothraj
Associate II
Posted on September 06, 2012 at 16:30

Posted on September 06, 2012 at 19:21

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.

0690X00000603EpQAI.jpg

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
vinothraj
Associate II
Posted on September 07, 2012 at 08:19

The value of the x3 is OSC 32 KHz clock supply?

Posted on September 07, 2012 at 19:32

Yes, it is the Low Speed Oscillator, nominally 768 KHz 6pF

MC306-G-06Q-768

http://search.alkon.net/cgi-bin/pdf.pl?pdfname=07pdf

http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/APPLICATION_NOTE/CD002216pdf

0690X0000060MnnQAE.gif

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
vinothraj
Associate II
Posted on December 24, 2012 at 16:23

above mistakes were rectified.

\stm32f4_dsp_stdperiph_lib\STM32F4xx_DSP_StdPeriph_Lib_V1.0.1\Project\STM32F4xx_StdPeriph_Examples\RTC\TimeStamp

I 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 wrong

Posted on December 24, 2012 at 16:42

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.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
vinothraj
Associate II
Posted on December 25, 2012 at 09:15

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'');

   

  }

}