RTC Power Down Not Work


We are trying to start a RTC clock and keep the time when we turn off the power.

We are working with a custom board with a Synergy S5D9, with the latest BSP 1.7.0 and E2 Studio ver: 7.3.0.

We have managed to operate the RTC when there is power but if we turn off the device, when we turn it on again the time date has not been updated while there was no voltage.

The electrical circuit is as follows, we use a supercap to maintain tension:

We have measured the signal of the crystal and it gives us the following image both when there is power on and when there is power off:

The configurations in the e2 studio for the CGC, RTC and BSP are as follows:

And the RTC initialization code is as follows:

Can someone help us find the problem?

Thanks in advance.

  • How is the supercap attached to VBATT charged up?
  • In reply to Jeremy:

    Hi Jeremy

    We use Panasonic EECS0HD224H supercap.

    Another cuestion,

    In the chapter "12.Battery Backup function" the S5D9 User’s Manual say:

    "Note: When VCC is < VDETBATT and > (VBATT + 0.6 V), the injected current connects from the VCC to the VBATT pin
    through an internal diode. If the power supply battery connected to the VBATT pin cannot support this current
    injection, for example if the battery is not rechargeable, Renesas strongly recommends that you connect through
    a low-voltage threshold diode between the power supply battery and the VBATT pin.

    Note: You must enable voltage monitor 0 resets to use the battery backup function. The voltage monitor 0 level must be
    higher than the VBATT switch level."

    We suppose that it is possible to connect the supercap to VBAT pin. The internal circuit of S5D9, is it recharges the supercap when VCC is power on?.

  • In reply to Hanton:

    You are trying to charge the supercap from VBATT pin (via the parasitic diode), only when the switch is connected to power the Backup power area from VBATT (at this point the SuperCap is not charged).

  • In reply to Jeremy:

    I'm colleage of Hanton and I answer the hardware implementation. We have this modified schematic to:


    and now it charges correctly.

    But the main issue is that not run RTC when power down.

  • In reply to FranI+D:

    The configuration option "Configure Subclock Drive On Reset" by default is set to "Enabled" for the CGC :-


    means the subclock will be stopped when the device starts up again (In R_CGC_Init()) :-


  • Hi Hanton,

    Is this issue okay now? Did Jeremy's answer helped you solve the problem?

    RenesasRulz Forum Moderator


  • In reply to JB:

    Hi JB

    Yes, now is working ok.
    But now we are working on the clock adjustment, so we have not answered before, I´m sorry.
    It seems that from one day to the next it loses a few seconds, how can we adjust that loss to be as small as possible?

    Thanks a lot.
  • In reply to Hanton:

    Hi Hanton,

    Thanks for confirming. It would be better if you create another thread for that issue since this power issue is already solved.

    RenesasRulz Forum Moderator


  • In reply to Hanton:

    The inaccuracy will come from the 32kHz clock. What is the crystal you are using, and what is the load capacitance specified by the manufacturer?
  • In reply to Jeremy:

    The specs are:

    and the external capacitors are 22pF in ours custom board.

  • In reply to FranI+D:

    There is post here that discusses the accuracy of the RTC :-


    What is the actual frequency of the RTC 32kHz clock when measured on you board?
  • In reply to FranI+D:

    So the 32kHz crystal appears to be running at 33.82kHz rather than the expected 32.768kHz, however a typical passive scope probe has a capacitance in the range of 10 pF and an input impedance of approximately 10 MΩ. Both values are in the range of the oscillator characteristics and heavily influence
    the behaviour of the crystal oscillators.

    The load capacitors can also have an effect on the oscillator frequency (The characteristics (pullability curve) of the crystal should be provided by the crystal

    The Synergy devices have a clock out functionality, and the sub oscillator can be selected as the Clock Out Source :-

    So it would be better to measure the frequency output by the clock out pin, rather than by probing the 32kHz crystal directly.

    Or, you you could use the CAC (Clock Frequency Accuracy Measurement Circuit), to measure the accuracy of the 32kHz clock against a more accurate clock.

    32kHz tuning fork crystals exhibit a relatively high frequency drift over temperature. If you look at the specs of the Abracom 32kHz crystal used on the S7G2-SK board :-

    The turn over temperature is typ 25C, and Temperature Coefficient is typ -0.036 ppm/(T*T). Assuming 0-ppm at the turn around frequency (25C) you would get a frequency deviation over the operating temperature of -40C to +85C for the Abracom crystal of (X axis is temperature in C, Y axis is frequency deviation in PPM):-

    So you will probably need to use some sort of compensation if you want to be as accurate as possible over as wide a temperature range as possible.

    If you know how far adrift the 32 kHz crystal is (either by using the CAC to measure it against a more accurate clock, or by measuring the ambient temperature and working out the drift using the datasheet parameters), the RTC has a Time Error Adjustment feature :-

    The manual gives some examples of using the Time Error Adjustment function, however, the error in the 32kHz Sub Oscillator frequency needs to be known to use this feature.