RTC of LPC55S16

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RTC of LPC55S16

3,155 Views
dank60
Contributor III

I powered the LPC55S16 cpu with two power supplies: a battery for VBATT_PMU and the main power for everything else. VDD_PMU is connected to FB. I start the RTC and set up the date and clock. If now I remove the main power supply leaving only the battery inserted for VBATT_PMU, I expect the clock to continue working. It's correct?
Restoring the main power supply and reading the RTC-CTRL register I expect to find the least significant bit (SWRESET) at 0 (RTC not in reset) instead I find it at 1 so I interpret that the RTC has been reset. Is all this correct? Thanks for your help

Tags (2)
0 Kudos
18 Replies

3,122 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi dank60 

RTC will continue working if leaving only the battery inserted for VBATT_PMU

 

 

Thanks,

Jun Zhang

0 Kudos

3,116 Views
dank60
Contributor III

Hi Jennie,

I try to explain myself better. I attach diagram of the cpu and the tests were carried out on 2
board to make sure I hasn't run into any hardware problems. When it is present the main power supply I Batt is 0, if the main power supply is missing I Batt is about 180 uA (why so much? I was expecting only a few uA)

When the main power supply is restored, the cpu initiates a reset and at start it executes
this code:

static void RTC_init(void)
{
/* RTC initialization */
   CLOCK_EnableClock(kCLOCK_Rtc);
   if(RTC_PERIPHERAL->CTRL & RTC_CTRL_SWRESET_MASK)
   {
        if(!RTC_GetSecondsTimerCount(RTC_PERIPHERAL))
       {
            RTC_Init(RTC_PERIPHERAL);
           /* Stop RTC timer */
          RTC_StopTimer(RTC_PERIPHERAL);
           /* Date and time initialization */
           RTC_SetDatetime(RTC_PERIPHERAL, &RTC_dateTimeStruct);
          /* Start RTC timer */
          RTC_StartTimer(RTC_PERIPHERAL);
      }
   }
}

At the first reset all lines of code are correctly executed and a clock is started based on the preset value of RTC_dateTimeStruct
So far, so good.
Now I disconnect the main power leaving only the battery connected and wait 10 seconds then reconnect the main power.
Now I expect RTC_Init(RTC_PERIPHERAL) and subsequent lines to not execute, instead this does not happen: all lines of code are executed. Where am I wrong? In the firmware, in the hardware or in both?
I also tried with this code, a little different, but the result does not change:

static void RTC_init(void)
{
      /* RTC initialization */
     CLOCK_EnableClock(kCLOCK_Rtc);

     if(!RTC_GetSecondsTimerCount(RTC_PERIPHERAL))
    {
         if(RTC_PERIPHERAL->CTRL & RTC_CTRL_SWRESET_MASK)
         {
              RTC_Init(RTC_PERIPHERAL);
              /* Stop RTC timer */
              RTC_StopTimer(RTC_PERIPHERAL);
             /* Date and time initialization */
             RTC_SetDatetime(RTC_PERIPHERAL, &RTC_dateTimeStruct);
             /* Start RTC timer */
             RTC_StartTimer(RTC_PERIPHERAL);
        }
     }
}

0 Kudos

3,052 Views
MartinHo
Contributor IV

Hi dank60

Please see my request on a similar problem:

https://community.nxp.com/t5/LPC-Microcontrollers/LPC55xx-Power-consumption-when-in-RESET/m-p/100876...

I decided to us an external RTC as the internal RTC is practically unusable in my configuration (startup via NRESET).

Martin

Tags (1)
0 Kudos

3,048 Views
dank60
Contributor III

Hi Martin,

thanks for the help. I see from the table that POR  acts on RTC as nRESET so what you said also applies to me...

0 Kudos

3,106 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi

VBAT_PMU is relevant to the RTC supply. Technically we can just provide supply to VBAT_PMU to keep RTC running. But we don’t expect current consumption is very low. Because VBAT_PMU uses LDO to lower the voltage, while LDO is power consuming:

ZhangJennie_0-1653043730982.png

 

Besides, VBAT_PMU is for PD_AO domain. This is not only provide power to RTC but also other modules in red as below picture.

ZhangJennie_1-1653043749698.png

 

Hope this explains the issue.

Jun Zhang

0 Kudos

3,103 Views
dank60
Contributor III


Ok this explains the high consumption but why does the RTC reset itself every time the main power supply is restored despite being VBATT_PMU buffered by the battery?

I double check with the code below:

if(RTC_PERIPHERAL->CTRL & RTC_CTRL_SWRESET_MASK)
{
          if(!RTC_GetSecondsTimerCount(RTC_PERIPHERAL))
          {

                   .......

I expect the block of instructions to be executed only on the first reset, not on subsequent resets

0 Kudos

3,078 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

 

On my side, I can't reproduce your issue because I don't have exact HW environment.

You said "the RTC reset itself every time the main power supply is restored despite being VBATT_PMU buffered by the battery?", you mean RTC counter gets to 0 once power on the board?

or you only see SWRESET is 1 after this operation? if you never turn off supply, Can you also see SWRESET 0?

How can I reproduce your issue with demo board in another way?

 

0 Kudos

3,075 Views
dank60
Contributor III


Hi Jemmie
It is not possible to adapt the firmware to the LPC55S16-EVK board because it has pins 49 50 and 51 connected together contrary to my hw which has pin 51 connected to the battery while 49 and 50 are connected to the main power supply... the behavior is different and the absorptions are also different.
now I will describe to you step by step what happens to me here.
1) I feed the card with the two power supplies, Vmain and Vbatt.
2) the microcontroller executes the code, all lienes

static void RTC_init(void) //line 1
{
/* RTC initialization */
CLOCK_EnableClock(kCLOCK_Rtc); //line 2
if(RTC_PERIPHERAL->CTRL & RTC_CTRL_SWRESET_MASK) //line 3
{
if(!RTC_GetSecondsTimerCount(RTC_PERIPHERAL)) //line 4
{
     RTC_Init(RTC_PERIPHERAL); //line 5
     /* Stop RTC timer */
    RTC_StopTimer(RTC_PERIPHERAL); //line 6
    /* Date and time initialization */
    RTC_SetDatetime(RTC_PERIPHERAL, &RTC_dateTimeStruct); //line 7
    /* Start RTC timer */
    RTC_StartTimer(RTC_PERIPHERAL); //line 8
}
}
}


after this function the clock of the microcontroller is set at 9:00 on May 5, 2022 because this is the time at which I have preset RTC_dateTimeStruct, in my firmware:

rtc_datetime_t RTC_dateTimeStruct = {
.year = 2022U,
.month = 5U,
.day = 5U,
.hour = 9U,
.minute = 0U,
.second = 0U
};

3) through messages implemented on a uart I can set and read the time of the RTC timer
4) I do it, now the microcontroller clock is set at 15:00 on May 16, 2022: everything is working.
5) I turn off the main power and leave only Vbatt
6) I wait 5 -10 seconds
7) I reconnect the main power supply and the microcontroller performs a reset (I would like the RTC not to reset too: Vbatt should keep it working)
at start the microcontroller executes the RTC_init (void) function that I have reported above.
9) I expect that on line 3 or at most on line 4 the microcontroller jumps at the end of the function without executing lines 5..8
10) I interrogate the microcontroller on the uart and read the time of its RTC. He answers me: 9:00 on May 5, 2022. evidently the RTC has reset itself :-(((

I don't know if I have explained myself better now,
thanks for your attention

0 Kudos

2,666 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi 

When power on LPC55, it perform POR reset. According to below table POR triggers RTC reset. That's to say, RTC counter will be initialized and cleaned.

ZhangJennie_0-1665382746642.png

 

So in order to keep RTC running and  disregard POR reset, I have two options:

1. Using exernal RTC

2. using low power mode (eg, power down mode) to replace powerdown MCU, waking up power down mode doesn't reset RTC.

 

Hope this helps,

Jun Zhang 

 

 

0 Kudos

2,663 Views
AndreaM
Contributor I

Thanks for the reply
if I want to use the second option. how can i activate it?

0 Kudos

2,645 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

There is demo code under  SDK package power_manager_lpc. It shows how to enter each low power mode.

0 Kudos

2,550 Views
dank60
Contributor III

Hi Jennie,

my question is the following: how many microamps does the micro consume in these conditions? In my project it must not consume more than 2uA ... For this I have resorted to an external RTC

0 Kudos

2,551 Views
dank60
Contributor III

Hi Jennie,

my question is the following: how many microamps does the micro consume in these conditions? In my project it must not consume more than 2uA ... For this I have resorted to an external RTC

0 Kudos

2,513 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

If so, yes, please use external RTC

0 Kudos

2,711 Views
AndreaM
Contributor I

Hello. I also have the same problem as you. You solved? Can you tell me how
thanks for your help

0 Kudos

2,704 Views
dank60
Contributor III

Hi Andrea,

in my opinion the problem is not solvable: we have adopted an external RTC (RV-3028-C7)!

 

0 Kudos

2,701 Views
AndreaM
Contributor I

Hi dank60 

Thank you for your answer. if I find a solution I will let you know.

 

0 Kudos

2,690 Views
dank60
Contributor III

ok thanks a lot.

Our project was to remove the power supply to the microcontroller except VBATT_PMU: when VDD returns, the on chip RTC resets!

0 Kudos