2010-10-16 07:41 AM
LSE and STOP mode
2011-05-17 05:11 AM
2011-05-17 05:11 AM
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.2011-05-17 05:11 AM
mmh, this might be the problem ...
Gonna check this with a 6pF crystal. Will be back soon :p2011-05-17 05:11 AM
2011-05-17 05:11 AM
2011-05-17 05:11 AM
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üfter2011-05-17 05:11 AM
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.2011-05-17 05:11 AM
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.2011-05-17 05:11 AM
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?