EmbeddedRelated.com
Forums

Incorrect RTC Alarm(23:59:59) Issue in LPC2101

Started by prab...@yahoo.co.in May 28, 2009
Hi all,
I am working on LPC2101 for past 4 months.
I am facing one unexpected behavior when put LPC in to Powerdown mode
long time and wakeup using RTC Alarm.
Sample code step:

1.Enable RTC

Reset RTC clock in CCR register.
then

ILR = 0x03;
CCR = 0x11;
CIIR = 0x00;

SEC = 0;
MIN = 0;
HOUR = 0;

2.Set Alarm

ALHOUR = 24;
ALMIN = 59;
ALSEC = 59;

AMR = 0xF8;

EXTWAKE = 0x8000;

3.Put LPC in to Powerdown.
PCONP = 0;
PCON |= 2;

4.After wake up disable RTC,clr interrups etc and then send some data on serial port,then go to step 1.
LPC goes to powerdown mode and wakesup after 23:59:59.
But some time LPC wakesup before the interval 23:59:59.

Any body faced this problem already?If u have any idea why this random issue happens,please share with me?

I know there is another possibilities to wake from Power down mode
Extint 0,1,2.But i havn't configured that?

How LPC wakes up from powerdown mode before specific interval???

Thanks for ur help.

An Engineer's Guide to the LPC2100 Series

p...@yahoo.co.in ha scritto:
> Hi all, I am working on LPC2101 for past 4 months. I am facing one
> unexpected behavior when put LPC in to Powerdown mode long time and
> wakeup using RTC Alarm. Sample code step:
>
> 1.Enable RTC
>
> Reset RTC clock in CCR register. then
>
> ILR = 0x03; CCR = 0x11; CIIR = 0x00;
>
> SEC = 0; MIN = 0; HOUR = 0;
>
> 2.Set Alarm
>
> ALHOUR = 24; ALMIN = 59; ALSEC = 59;
Is this 23:59:59? Because 24:59:59 is wrong, it would be 0:59:59
>
> AMR = 0xF8;
>
> EXTWAKE = 0x8000;
>
> 3.Put LPC in to Powerdown. PCONP = 0; PCON |= 2;
>
> 4.After wake up disable RTC,clr interrups etc and then send some data
> on serial port,then go to step 1.
>
> LPC goes to powerdown mode and wakesup after 23:59:59. But some time
> LPC wakesup before the interval 23:59:59.
How much before? Are you sure there is no other reason to leave power
down mode? A simple debug may be to write the power up reason in a ram
variable if mcu leaves power down mode from rtc wakeup, if not you can
leave its default value (may be 0xff or 0x00).
>
> Any body faced this problem already?If u have any idea why this
> random issue happens,please share with me?
>
> I know there is another possibilities to wake from Power down mode
> Extint 0,1,2.But i havn't configured that?
>
> How LPC wakes up from powerdown mode before specific interval???
>
> Thanks for ur help.
>
>



4.After wake up disable RTC,clr interrups etc and then send some data
> on serial port,then go to step 1.
>
> LPC goes to powerdown mode and wakesup after 23:59:59. But some time
> LPC wakesup before the interval 23:59:59.
How much before? Are you sure there is no other reason to leave power
down mode? A simple debug may be to write the power up reason in a ram
variable if mcu leaves power down mode from rtc wakeup, if not you can
leave its default value (may be 0xff or 0x00).

Manca,
Thanks for reply.Sorry.... I forgot to mention one more more information.
Here is this,
" But some time LPC wakes up before the interval 23:59:59" means LPC Resetting ( Not wakeup).
Is there any way to LPC Resetting while in power down mode???
One more thing "I am using Watchdog Feature also"
Before Powerdown i am reporting by Watchdog feeeding(WDFEED).I have
Watchdog report interval is for one minit.(in WDTC).

I am using internal watchdog.So i assumed and checked,In powerdown mode WDTC is not decrement(Just in hold).Because processor clock is off.After wakeup from power down mode again WDTC count decrementing and i am reporting as soon as wake up from POwerdown mode.So i am assuming this is not cause resetting??If i am wrong please correct me?

This reset(While in Power down) also happens in radomly..(2 out of 7).

LPC wakes up before the interval 23:59:59.
How much before?
Some times with in 20 min,within 2hrs,within 12 hrs..Randomly resetting...
How to debug this issue.I dont have JTAG also.

What are the possibilities LPC resetting while in Powerdown mode??

Thanks for ur help...

p...@yahoo.co.in ha scritto:
> 4.After wake up disable RTC,clr interrups etc and then send some data
>
>> on serial port,then go to step 1.
>>
>> LPC goes to powerdown mode and wakesup after 23:59:59. But some
>> time LPC wakesup before the interval 23:59:59.
> How much before? Are you sure there is no other reason to leave power
> down mode? A simple debug may be to write the power up reason in a
> ram variable if mcu leaves power down mode from rtc wakeup, if not
> you can leave its default value (may be 0xff or 0x00).
>
> Manca, Thanks for reply.Sorry.... I forgot to mention one more more
> information. Here is this, " But some time LPC wakes up before the
> interval 23:59:59" means LPC Resetting ( Not wakeup). Is there any
> way to LPC Resetting while in power down mode???
Yes, of course, they are the same reset sources as in normal mode; I
disable always watchdog before entering power down mode, 2nd I would
check voltage source and reset controller, then I would rewrite the
reset function (function to execute at power up) to check if there is a
reason to be on active mode or the processor has to enter in power down
mode. Last point it is not necessary if all works well but I saw a lot
of times things went bad, so it is a better security.
One more thing "I am
> using Watchdog Feature also" Before Powerdown i am reporting by
> Watchdog feeeding(WDFEED).I have Watchdog report interval is for one
> minit.(in WDTC).
>
> I am using internal watchdog.So i assumed and checked,In powerdown
> mode WDTC is not decrement(Just in hold).Because processor clock is
> off.After wakeup from power down mode again WDTC count decrementing
> and i am reporting as soon as wake up from POwerdown mode.So i am
> assuming this is not cause resetting??If i am wrong please correct
> me?
>
> This reset(While in Power down) also happens in radomly..(2 out of
> 7).
May be also some noise on mcu reset line, may be better to use a
brownout detector or a better externcal i.c. to control mcu reset; may
be also some noise on vcc/gnd power lines.
>
> LPC wakes up before the interval 23:59:59. How much before? Some
> times with in 20 min,within 2hrs,within 12 hrs..Randomly resetting...
> How to debug this issue.I dont have JTAG also.
>
> What are the possibilities LPC resetting while in Powerdown mode??
>
> Thanks for ur help...
>
>



Manca thanks for ur quick and detail response.Please check below points.

1. Power up Code:

a)In power up code Have to check resource of Reset using RSIR .
If resource of Reset is not Power on Reset and and If reset happens while LPC is in Power down mode means( Refer Point b),
again Put LPC into power down mode else Execute active mode code
If reset is POR(Power on reset)means,
To initialize One RTC register which is used to identify whether LPC is in power down mode or not before reset.

b)Before go to Power down mode write some specified value(which is used to identify whether LPC is in power down mode or not when reset) in one unused RTC register and reset that value on after wake up from power down mode.This RTC register will retain that value after reset.

2.I am going to check voltage source and reset controller with help of H/W team.may also check whether noise on vcc/gnd power lines.

I am assuming modification of Power up Code will solve all those issue(LPC reset while in Power down mode because of any noises) except Power on reset

Give ur comments and idea.

Hi all,
> I am working on LPC2101 for past 4 months.
>I am facing one unexpected behavior when put LPC in to Powerdown mode
>long time and wakeup using RTC Alarm.
>Sample code step:
>
>1.Enable RTC
>
> Reset RTC clock in CCR register.
> then
>
> ILR = 0x03;
> CCR = 0x11;
> CIIR = 0x00;
>
> SEC = 0;
> MIN = 0;
> HOUR = 0;
>
>2.Set Alarm
>
> ALHOUR = 24;
> ALMIN = 59;
> ALSEC = 59;
>
> AMR = 0xF8;
>
> EXTWAKE = 0x8000;
>
>3.Put LPC in to Powerdown.
> PCONP = 0;
> PCON |= 2;
>
>4.After wake up disable RTC,clr interrups etc and then send some data on serial port,then go to step 1.
>LPC goes to powerdown mode and wakesup after 23:59:59.
>But some time LPC wakesup before the interval 23:59:59.
>
>Any body faced this problem already?If u have any idea why this random issue happens,please share with me?
>
>I know there is another possibilities to wake from Power down mode
>Extint 0,1,2.But i havn't configured that?
>
>How LPC wakes up from powerdown mode before specific interval???
>
>Thanks for ur help.
>