cancel
Showing results for 
Search instead for 
Did you mean: 

LSE and STOP mode

Kuikui
Associate III
Posted on October 16, 2010 at 16:41

LSE and STOP mode

13 REPLIES 13
Kuikui
Associate III
Posted on May 17, 2011 at 14:11

Well, here are some news about this issue.

The µC is 3.0V powered.

In fact, sometimes the RTC works at the good frequency, and sometimes it does'nt.

I looked at the signals on OSC32_OUT and OSC32_IN pins with a scope, and I could see the good frequency (32768Hz), but the voltage was quite low ( 0 to 600mV ), whereas the signal on the OSC_IN and OSC_OUT pins of the 8MHz crystal goes from 0 to 3.0V.

And if I touch with my fingers the crystal and the attached capacitors, the voltage goes lower and lower ... until 0.

Could the capacitor values be wrong ? I used two 10pF capacitors, as I saw these values on most designs.

The crystal I'm using is this one : http://www.abracon.com/Resonators/ABS10.pdf

Any idea ?

Thanks for your help.

Best regards,

V.

Posted on May 17, 2011 at 14:11

The capacitors are going to depend on the load capacitance of the crystal. Are you using the 12.5 pF crystal? Because ST recommends a 7 pF or lower one.

See AN2867

http://www.icbase.com/hotic/html/docs/15287.pdf

http://www.stmicro.ru/stonline/products/literature/ds/15274/stm32f107vb.pdf

Page 48

Caution: To avoid exceeding the maximum value of CL1 and CL2 (15 pF) it is strongly recommended to use a resonator with a load capacitance CL 7 pF. Never use a resonator with a load capacitance of 12.5 pF.

Example: if you choose a resonator with a load capacitance of CL = 6 pF, and Cstray = 2 pF, then CL1 = CL2 = 8 pF.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Kuikui
Associate III
Posted on May 17, 2011 at 14:11

mmh, this might be the problem ...

Gonna check this with a 6pF crystal.

Will be back soon :p

Kuikui
Associate III
Posted on May 17, 2011 at 14:11

Hi,

I received today the same crystal, but in its 6pF load capacitance version.

And the result is exactly the same ...

Any idea ? Maybe I should add a serial resistor to have more gain ?

Thanks for your help,

Best regards,

V.

Kuikui
Associate III
Posted on May 17, 2011 at 14:11

I just tried a ''classic'' MC306 crystal, and results are exactly the same.

One of my colleagues told me to try adding a serial kOhms resistor between OSC32_OUT and the crystal/capacitor, but still the same .. 600mV peak-to-peak on OSC32_OUT, and no frequency on OSC32_IN.

Do the I/Os PC14 and PC15 have to be configured or something to properly enable the LSE ?

V.

lowpowermcu
Associate II
Posted on May 17, 2011 at 14:11

Hi VDM,

I  have found the following application note ''STM32L1xxx hardware development: getting started''. It contains some recommendations regarding the LSE oscillator.

http://www.st.com/stonline/products/literature/an/17496.pdf

Hopes that helps

regards;

MCU Lüfter

Kuikui
Associate III
Posted on May 17, 2011 at 14:11

Hi all,

I've bought almost 10 different crystals, all 6pF load capacitance.

And with EVERY crystals, I have exactly the same result.

OSC_32_IN is not oscillating (I measured about 50mVDC on the pin), and OSC_32_OUT is a sinusoïdal 32.768kHz wave from 0V to 600mV.

I tried changing the external capacitors, and the result is still the same.

Please, can anybody take a look with the scope at these pins and tell me I am supposed to see ?

Thanks for your help.

Best regards,

V.

Kuikui
Associate III
Posted on May 17, 2011 at 14:11

Hi clive,

well, here is my IT :

void NVIC_Configuration(void)

{

  NVIC_InitTypeDef NVIC_InitStructure;

  /* 2 bits for Preemption Priority and 2 bits for Sub Priority */

  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);

  NVIC_InitStructure.NVIC_IRQChannel = RTCAlarm_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);

}

void RTCAlarm_IRQHandler(void)

{

  if(RTC_GetITStatus(RTC_IT_ALR) != RESET)

  {

    /* Clear EXTI line17 pending bit */

    EXTI_ClearITPendingBit(EXTI_Line17);

    /* Check if the Wake-Up flag is set */

    if(PWR_GetFlagStatus(PWR_FLAG_WU) != RESET)

    {

      /* Clear Wake Up flag */

      PWR_ClearFlag(PWR_FLAG_WU);

    }

    /* Wait until last write operation on RTC registers has finished */

    RTC_WaitForLastTask();  

    /* Clear RTC Alarm interrupt pending bit */

    RTC_ClearITPendingBit(RTC_IT_ALR);

    /* Wait until last write operation on RTC registers has finished */

    RTC_WaitForLastTask();

   

    RTC_irq_counter++;

    if (RTC_irq_counter == 64)

    {

      RTC_irq_counter = 0;

      current_timestamp++;

      LED_TOOGLE();

    }

      RTC_SetAlarm(RTC_GetCounter()+ 1);

  RTC_WaitForLastTask();

  }

}

Here is the main loop :

   while(1)

  {

      PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);

  }

And here is the RTC init function :

void RTC_Configuration(void)

{

  /* RTC clock source configuration ------------------------------------------*/

  /* Allow access to BKP Domain */

  PWR_BackupAccessCmd(ENABLE);

  /* Reset Backup Domain */

  BKP_DeInit();

 

  /* Enable the LSE OSC */

  RCC_LSEConfig(RCC_LSE_ON);

  /* Wait till LSE is ready */

  while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)

  {

  }

  /* Select the RTC Clock Source */

  RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);

  /* Enable the RTC Clock */

  RCC_RTCCLKCmd(ENABLE);

  /* RTC configuration -------------------------------------------------------*/

  /* Wait for RTC APB registers synchronisation */

  RTC_WaitForSynchro();

  /* Set the RTC time base to 64Hz */

  RTC_SetPrescaler( ( 32768/64 ) -1); 

  /* Wait until last write operation on RTC registers has finished */

  RTC_WaitForLastTask();

  /* Enable the RTC Alarm interrupt */

  RTC_ITConfig(RTC_IT_ALR, ENABLE);

  /* Wait until last write operation on RTC registers has finished */

  RTC_WaitForLastTask();

}

Thanks for help.

V.

Posted on May 17, 2011 at 14:11

OSC_32_OUT is a sinusoidal 32.768kHz wave from 0V to 600mV.

550-560 mV peak-to-peak looks normal.

You should also be able to measure/calibrate the frequency by counting the CPU clock cycles per second.

You could also try your experiment against the LSI (~40 KHz) instead of the LSE (32.768 KHz)

Also be cognoscente that STOP turns off the clocks to the 1.8V domain, and the PLL, HSE, HSI all get turned off. And when it exits STOP, it turns on the HSI, and once up it runs from the HSI clock (~8 MHz). STOPing with the regulator in low-power mode incurs an additional startup delay. I haven't looked at this too deeply.

Are you using the RTC One second tick, or the alarm interrupt. If the alarm how are you advancing the value?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..