cancel
Showing results for 
Search instead for 
Did you mean: 

RTC Problems when waking up from StandBy mode

sergio23
Associate II
Posted on April 14, 2016 at 13:48

Hello,

I have noticed that when my system wake up from Standby mode seems to lose some time and RTC loses something like 2 ms for each second

Does anybody have anytime this kind of problem?

I have using an STM32L162.

Any idea will be welcomed

Best  regards

Carmen
17 REPLIES 17
sergio23
Associate II
Posted on May 04, 2016 at 13:21

Hi Hannibal,

I have done that you had proposed, and the result is exactly the same.

What can we do to fix it up?

Carmen

Walid FTITI_O
Senior II
Posted on May 04, 2016 at 17:42

Hi fernandez.sergio,

You need to give more details about;

Hardware you are using ( eval, nucleo, discovey, you own ?? ?)

RTC clock source  (LSE , LSI .. ?)

And about the code, I suggest that you clean your code to keep only related part to standby  and RTC to localize the bug if it a related to software .

-Hannibal-

sergio23
Associate II
Posted on May 05, 2016 at 08:11

Hi Hannibal,

I'm using my own hardware, with STM32L162RDT6. RTC clock source: LSE.

I have cleaned the code, and keep just related to RTC and standby, and the problem persists.

Best regards

Carmen

Walid FTITI_O
Senior II
Posted on May 05, 2016 at 10:30

Hi fernandez.sergio,

Try to share the clean code with me. Meanwhile, check in this application note

http://www2.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

if you have picked the right LSE crystal (Table 7) and if your design respect the design tips to ensure oscilator stability.

Also, the

http://www2.st.com/content/ccc/resource/technical/document/application_note/bf/94/f5/49/96/52/4e/75/CD00273528.pdf/files/CD00273528.pdf/jcr:content/translations/en.CD00273528.pdf

Getting started with STM32L1xx hardware developement'' will give you a help to ensure if you have established you hardware connrectly.

-Hannibal-
sergio23
Associate II
Posted on May 05, 2016 at 11:50

Hi Hannibal,

Here is my clean code. I'm checking the hardware to make sure it is correct

Carmen

sergio23
Associate II
Posted on May 05, 2016 at 11:51

Hi Hannibal,

Here is my clean code. I'm checking the hardware to make sure it is correct

Carmen

sergio23
Associate II
Posted on May 05, 2016 at 11:52

Hi Hannibal,

Here is my clean code. I'm checking the hardware to make sure it is correct

Carmen

________________

Attachments :

mainStandBy.c.txt : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htni&d=%2Fa%2F0X0000000aX6%2FAUNSwhh38OU.G97JlvXojLurD5wVVtV_77BOTNjudpA&asPdf=false
Walid FTITI_O
Senior II
Posted on November 08, 2016 at 12:41

Hi,

I just see your last post now. After checking the shared code, try to do the following : - Delete the tho line on the top about get time and date:

HAL_RTC_GetTime (&hrtc, &sTime, FORMAT_BIN);
HAL_RTC_GetDate (&hrtc, &sDate, FORMAT_BIN);

And but them at this location:

if (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) == RESET)
{ 
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB); 
/* Configure the RTC module */
RTC_Configuration();
StandbyMode();
}
else
{ 
/* Read and save the current time */
/* Get the RTC current Time */
HAL_RTC_GetTime(&RTCHandle, &stimestructureget, FORMAT_BIN);
/* Get the RTC current Date */
HAL_RTC_GetDate(&RTCHandle, &sdatestructureget, FORMAT_BIN);
}

-You missed in RTC configuration to call theHAL_RTC_SetTime() function . You should add it -Hannibal-