cancel
Showing results for 
Search instead for 
Did you mean: 

problem with running RTC program in stm32f103ret6

naserghasemi2012
Associate II
Posted on December 28, 2015 at 23:44

hi (at first excuse me for my English)

I use standard peripheral  example for implement RTC at stm32f103ret6. but this example runs in microcontroller to this line and after that stops. what is the problem? and how can I fix it?

  1. RCC_LSEConfig

    (

    RCC_LSE_ON

    )

    ;

  2.        

    /* Wait till LSE is ready */

  3.  

    while

    (

    RCC_GetFlagStatus

    (

    RCC_FLAG_LSERDY

    )

    ==

    RESET

    )

  4.  

    {

    }

6 REPLIES 6
Posted on December 29, 2015 at 00:21

Your board lacks an external low speed oscillator, or the chosen components don't actually oscillate?

Review the design.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
naserghasemi2012
Associate II
Posted on December 29, 2015 at 13:27

I used internal HSI instead of HSE . but now my problem is adjusting time by usart : hyperterminal window shows below massage and wants to adjust hour but I cant send any number to microcontroller. what is the problem? from my computer or scanf function in program (I use std periph libs and rtc example) or...?

RTC not yet configured....

RTC configured....

==============Time Settings=====================================

  Please Set Hours

Please enter valid number between 0 and 9

Please enter valid number between 0 and 9

Please enter valid number between 0 and 9

Amel NASRI
ST Employee
Posted on December 29, 2015 at 15:14

Hi ghasemi.naser,

Regarding the RTC issue: Clive is speaking about RTC clock source, not system one.

As stated in the RM0008, the RTC clock source can be either the HSE/128, LSE or LSI.

In the code you are using, it seems you selected LSE. So you should have this oscillator in your hardware.

We don't know the example you are using neither the application you want, so it is difficult to help you with second issue.

Please provide us more details.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

naserghasemi2012
Associate II
Posted on December 30, 2015 at 12:24

thanks mayla

I used LSI and left that problem but now problem is blew function. the program stops at this line and dosent continue.

RTC_WaitForSynchro();

definition :

void RTC_WaitForSynchro(void)

{

  /* Clear RSF flag */

  RTC->CRL &= (uint16_t)~RTC_FLAG_RSF;

  /* Loop until RSF flag is set */

  while ((RTC->CRL & RTC_FLAG_RSF) == (uint16_t)RESET)

  {

  }

}

Posted on December 30, 2015 at 16:04

Ok, it's very difficult to try and remotely troubleshoot when all you show is a couple of lines that fail. They probably fail because of things you did, or didn't, do earlier in your code.

Frame your question with specific details about the board you are using and it's design. If it is a custom design provide a schematic, if it is one you bought provide a link to the website or documentation.

Break your problem into a small program that demonstrates the issue clearly, provide all of it.

Make sure you have enabled and unlocked the RTC/PWR/BKP unit. Review example code in the Standard Peripheral Library.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
naserghasemi2012
Associate II
Posted on December 31, 2015 at 10:23

thanks

this is my header board schematic.