cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F439 RTC Problem

nipam
Associate
Posted on July 03, 2016 at 14:38

Hello All,

Micro-controller: STM32F439 With LSE(32.768 KHz)

Standard Peripheral Driver Version: V1.6.1

Problem: RTC routine Stuck

Description:

We are currently working on RTC and implemented the code as per available in standard peripheral examples directory. RTC works properly on one board so we decided to test on more hardware boards. After testing those boards, the results are not that we expected. Out of 10 boards, 6 boards have no problem with RTC and 4 boards are facing issues with RTC even though all the boards are assembled in same assembly house.

After debugging on those 4 boards, we found that at the time of initialization of RTC, it stucks at below points.

1) It stucks in while condition.

/* Enable the LSE OSC */

  RCC_LSEConfig(RCC_LSE_ON);

  

  /* Wait till LSE is ready */  

  while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)

  {

  }

2) Stucks in do..while condition

/* Set the Initialization mode */

    RTC->ISR = (uint32_t)RTC_INIT_MASK;

    

    /* Wait till RTC is in INIT state and if Time out is reached exit */

    do

    {

      initstatus = RTC->ISR & RTC_ISR_INITF;

      initcounter++;  

    } while((initcounter != INITMODE_TIMEOUT) && (initstatus == 0x00));

    

Connected 22 pF with 32.768 KHz crystal at hardware side attached here. I have double checked that all hardware components are soldered properly.

I cannot decide that whether this issue is related to Hardware side or Firmware side.

How can I debug these issues?  

Any help in this case would be highly appreciated.

Thanks,

Nipam

#rtc #stm32f4
2 REPLIES 2
Posted on July 03, 2016 at 15:52

If the oscillator doesn't start you'll need to review the component choices and values. Circuits are also sensitive to layout.

Rework the math that got you to 22pF, and the load capacitance of the crystal. Cite the datasheet for the specific crystal chosen here.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Walid FTITI_O
Senior II
Posted on July 05, 2016 at 17:16

Hi bhavsar.nipam,

I recommend you to check the

http://www.st.com/content/ccc/resource/technical/document/application_note/c6/eb/5e/11/e3/69/43/eb/CD00221665.pdf/files/CD00221665.pdf/jcr:content/translations/en.CD00221665.pdf

: '' Oscillator design guide for STM8S, STM8A and STM32 microcontrollers

Part “4.1 Low-speed oscillators embedded into STM32 microcontrollers� page 20-22

-Hannibal-

Hello All,

Micro-controller: STM32F439 With LSE(32.768 KHz)

Standard Peripheral Driver Version: V1.6.1

Problem: RTC routine Stuck

Description:

We are currently working on RTC and implemented the code as per available in standard peripheral examples directory. RTC works properly on one board so we decided to test on more hardware boards. After testing those boards, the results are not that we expected. Out of 10 boards, 6 boards have no problem with RTC and 4 boards are facing issues with RTC even though all the boards are assembled in same assembly house.

After debugging on those 4 boards, we found that at the time of initialization of RTC, it stucks at below points.

1) It stucks in while condition.

/* Enable the LSE OSC */

  RCC_LSEConfig(RCC_LSE_ON);

  

  /* Wait till LSE is ready */  

  while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)

  {

  }

2) Stucks in do..while condition

/* Set the Initialization mode */

    RTC->ISR = (uint32_t)RTC_INIT_MASK;

    

    /* Wait till RTC is in INIT state and if Time out is reached exit */

    do

    {

      initstatus = RTC->ISR & RTC_ISR_INITF;

      initcounter++;  

    } while((initcounter != INITMODE_TIMEOUT) && (initstatus == 0x00));

    

Connected 22 pF with 32.768 KHz crystal at hardware side attached here. I have double checked that all hardware components are soldered properly.

I cannot decide that whether this issue is related to Hardware side or Firmware side.

How can I debug these issues?  

Any help in this case would be highly appreciated.

Thanks,

Nipam