cancel
Showing results for 
Search instead for 
Did you mean: 

RTC Initialization Issue

Posted on November 12, 2015 at 14:29

Hi Community

I have an issue with the Real Time Clock of the SPC560D. 

My application try to read the RTC.RTCCNT register. Every time during the read process the program pointer goes to 0x0000000E0, therefor it points to nothing -.-

I think it is a basically problem, because the same issue occurs, if the RTC get configured.

Programm Code:

int

main(

void

) {

       componentsInit();

     

  uint32_t test = RTC.RTCCNT.R;

componentsInit();

}

The access to the timer structure STM works very well, but I have any read or write access to the RTC variable.

Has anybody some experience with it, or is there a solution out there ;D  

best regards

Philipp

#rtc
7 REPLIES 7
Erwan YVIN
ST Employee
Posted on November 12, 2015 at 15:21

Hello Philipp ,

You should enable the PCTL 91 cf Table 70 in the RM.

halSPCSetPeripheralClockMode(91,

                               SPC5_ME_PCTL_RUN(2) | SPC5_ME_PCTL_LP(2));

Why there are 2 componentsInit() ?

  Best regards

             Erwan

Posted on November 12, 2015 at 15:44

Hi Erwan

Thank you for your fast fix. It helped me a lot. 

Yes, the second componentInit(); was a fast debugging solution and makes nosense in the program :D

kind regards 

Philipp

Posted on December 14, 2015 at 16:16

Hi Community

Overview:

Low Power Mode: Standby

Board: SPC560D Discovery

Has anyone some experience with the RTC wakeup? My application should wake up after some time. It is a non-periodic wakeup so I will use the RTCVal register and not the API functionality. Sometimes I get a wakeup from the RTC and sometimes not.

In my opinion it is strange behavior, because the RTC wakeup occurs only if there is another wakeup before.

I think there is an issue with the initialization, but I tried all combinations of the RTCC Register and the WRER Register.

kind regards

Philipp

Erwan YVIN
ST Employee
Posted on December 15, 2015 at 14:03

Hello philipp ,

RTC should be mapped on WKPU1 (IRQ 46)

Did you try to enable ROVEN  ?

Counter Roll Over Wakeup/Interrupt Enable

The ROVREN bit enables wakeup and interrupt requests when the RTC has rolled over from

0xFFFF_FFFF to 0x0000_0000. The RTCIE bit must also be set in order to generate an interrupt

from a counter rollover.

1 RTC rollover wakeup/interrupt enabled

0 RTC rollover wakeup/interrupt disabled

   Best regards

             Erwan

Posted on December 15, 2015 at 14:47

Hi Erwan,

Thank you for your reply. I found the issue, the SIRC source must be active during standby AND to store this configuration a new mode transition must be done otherwise it will not work

Only a comment in the hal_lld.c gives a hint to this behavior. 

Thank you for your support

PS: I hope these additional information will be added in the documentation

kind regards 

Philipp 

Erwan YVIN
ST Employee
Posted on December 16, 2015 at 10:16

Hello Philipp ,

In fact , it is logical to use SIRC clock for the RTC Periph in STANDBY Mode.

i have found this information in chap1 :

DM00074056_LOW_POWER_MODE_SPC564Bxx_SPC56ECxx.pdf

This mode is intended as follows:

• As an extreme low-power mode with everything powered down apart from the

necessary circuitry to allow device wakeup and eventually a RTC/API (real time clock)

implementation

• To be used by software to remain in the lowest power consumption state with no

requirement to wake up quickly.

SIRC for RTC has the lowest consumption in STANDBY Mode

Best regards

Erwan

________________

Attachments :

DM00074056_LOW_POWER_MODE_SPC564Bxx_SPC56ECxx.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0PU&d=%2Fa%2F0X0000000bZi%2FR9UzHfes.VeiQaycy1ijQYy0mo.QQ4DZUsPBcmpGLdk&asPdf=false
Posted on December 16, 2015 at 10:29

Hi Erwan

Thank you for your reply. I think there is misunderstanding :D 

One requirement for my application is extreme low power consumption. So it like to use the SIRC. It is only possible to use the SIRC if the Standby bit of the SIRC control register is set. The missing information for me was that a mode transition is required after setting this bit. Otherwise the SIRC is still not available. 

So only a comment in the hal_lld.c gives me a hint that a mode transition is required.

kind regards

Philipp