AnsweredAssumed Answered

RTC initialization

Question asked by arnaud on Nov 29, 2011
Latest reply on Nov 27, 2014 by From.Sergey


Our design is made with  a STM32F207ZG microcontroller and we have some problems with the RTC peripheral.
We have an external 32.768 kHz oscillator (LSE).        
Using the ST library, the initialization of the RTC goes out with ERROR on test of ISR.RSF bit and ISR.INITF bit in RTC_WaitForSynchro() and RTC_Init(&RTC_InitStructure) functions.

We checked the signal 32 KHz on the MC01 (PA8) pin and it is OK.

If we try with LSI clock source, it is OK : no ERROR.

 

What happens ? Do you have an idea ?

 

This is our source code (with RTX kernel) :

 

int main (void)
{
    SystemInit();
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG,ENABLE);
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
    PWR_BackupAccessCmd(ENABLE);       
    RCC_LSEConfig(RCC_LSE_ON);
           …
}

 

__task void _HORLOGE_Initialiser (void)
{

while (1)
 {           
    while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET);
    RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
    RCC_RTCCLKCmd(ENABLE);
    RTC_WaitForSynchro();

    // Calendar Configuration 
    RTC_InitStructure.RTC_AsynchPrediv = 0x7F;
    RTC_InitStructure.RTC_SynchPrediv =  0xFF;
    RTC_InitStructure.RTC_HourFormat = RTC_HourFormat_24;
    RTC_Init(&RTC_InitStructure);

 

     os_tsk_delete_self ();
    } ;
}

Outcomes