EmbeddedRelated.com
Forums
Memfault Beyond the Launch

RTC Power Down Problem

Started by Shashank Maheshwari October 6, 2012
Hello

I have issues with the RTC of my LPC2148 board. The system is always in PD
mode. I want it to wake up every few seconds(say 5sec) transmit at UART and
go back to PD mode. I use external 32kHz oscillator with external 3.0 V
battery for the RTC.
The same when added with external interrupts works perfect for external
interrupts however no result on the RTC peripheral.

Following is the code for the same. The system goes in the PD mode in the
while(1) loop.

void setup_RTCint(void)
{
// setup RTC interrupt
VICVectCntl2 = 0x0000002d; //select a priority slot for a given
interrupt (RTC from the table)
VICVectAddr2 = (unsigned)RTCVectoredIRQ; //pass the address of the IRQ
into the VIC slot
EXTWAKE |= (1<<15); // same as INTWAKE (wake RTC from Power Down
mode)
PCONP |= (1<<9);
CIIR = 0x00;
AMR = 0xfe; // ALARM mask: Only seconds value is compared
ALSEC = 0x05; // Set seconds alarm register to 10 sec
ILR = 0x02; //Clear the RTC ALARM interrupt flag
CCR = 0x13; // Take clock from external crystal 32Khz & CLOCK ENABLE &
RESET
YEAR=MONTH=DOY=DOW=DOM=HOUR=MIN=SEC=0; // Set initial time to zero
VICIntEnable |= (1<<13); //enable RTC interrupt
}

void RTCVectoredIRQ (void) __irq
{
unsigned int i;
setup_PLL0();
for(i=0;i<60000;i++); // delay for oscillator to setup properly
after wakeup
UART1Tx('R');
UART1Tx('T');
UART1Tx('C');
UART1Tx(' ');
// interrupt end functions
SEC = 0;
ILR = 0x02; //Clear the RTC ALARM interrupt flag
VICVectAddr = 0x00000000; //Dummy write to signal end of interrupt
}
However I do not even a single time see any RTC transmission.
I would really appreciate some help.

Regards
Shashank


An Engineer's Guide to the LPC2100 Series

Dear Shashank
Thats not problem with your code. Your code is doing fine. Check with your hardware. May be Hardware damage. We also faced such problems. changed the board it works fine.
contact: http://www.infotronix-india.com

i...@infotronix-india.com
RegardsMMK

--- On Sat, 6/10/12, Shashank Maheshwari wrote:

From: Shashank Maheshwari
Subject: [lpc2000] RTC Power Down Problem
To: l...
Date: Saturday, 6 October, 2012, 6:39 PM

 





Hello

I have issues with the RTC of my LPC2148 board. The system is always in PD

mode. I want it to wake up every few seconds(say 5sec) transmit at UART and

go back to PD mode. I use external 32kHz oscillator with external 3.0 V

battery for the RTC.

The same when added with external interrupts works perfect for external

interrupts however no result on the RTC peripheral.

Following is the code for the same. The system goes in the PD mode in the

while(1) loop.

void setup_RTCint(void)

{

// setup RTC interrupt

VICVectCntl2 = 0x0000002d; //select a priority slot for a given

interrupt (RTC from the table)

VICVectAddr2 = (unsigned)RTCVectoredIRQ; //pass the address of the IRQ

into the VIC slot

EXTWAKE |= (1<<15); // same as INTWAKE (wake RTC from Power Down

mode)

PCONP |= (1<<9);

CIIR = 0x00;

AMR = 0xfe; // ALARM mask: Only seconds value is compared

ALSEC = 0x05; // Set seconds alarm register to 10 sec

ILR = 0x02; //Clear the RTC ALARM interrupt flag

CCR = 0x13; // Take clock from external crystal 32Khz & CLOCK ENABLE &

RESET

YEAR=MONTH=DOY=DOW=DOM=HOUR=MIN=SEC=0; // Set initial time to zero

VICIntEnable |= (1<<13); //enable RTC interrupt

}

void RTCVectoredIRQ (void) __irq

{

unsigned int i;

setup_PLL0();

for(i=0;i<60000;i++); // delay for oscillator to setup properly

after wakeup

UART1Tx('R');

UART1Tx('T');

UART1Tx('C');

UART1Tx(' ');

// interrupt end functions

SEC = 0;

ILR = 0x02; //Clear the RTC ALARM interrupt flag

VICVectAddr = 0x00000000; //Dummy write to signal end of interrupt

}

However I do not even a single time see any RTC transmission.

I would really appreciate some help.

Regards

Shashank













Do you reconfigure the UART when you come out of power down mode? If the
RTC interrupt handler executes immediately out of power down mode, then
it looks like the UART will be unconfigured. This means it will not
transmit the characters, even if the interrupt handler is called.

Mike
-----Original Message-----
From: l... [mailto:l...]On Behalf
Of Shashank Maheshwari
Sent: Saturday, October 06, 2012 7:10 AM
To: l...
Subject: [lpc2000] RTC Power Down Problem
Hello

I have issues with the RTC of my LPC2148 board. The system is always in PD
mode. I want it to wake up every few seconds(say 5sec) transmit at UART and
go back to PD mode. I use external 32kHz oscillator with external 3.0 V
battery for the RTC.
The same when added with external interrupts works perfect for external
interrupts however no result on the RTC peripheral.

Following is the code for the same. The system goes in the PD mode in the
while(1) loop.

void setup_RTCint(void)
{
// setup RTC interrupt
VICVectCntl2 = 0x0000002d; //select a priority slot for a given
interrupt (RTC from the table)
VICVectAddr2 = (unsigned)RTCVectoredIRQ; //pass the address of the IRQ
into the VIC slot
EXTWAKE |= (1<<15); // same as INTWAKE (wake RTC from Power Down
mode)
PCONP |= (1<<9);
CIIR = 0x00;
AMR = 0xfe; // ALARM mask: Only seconds value is compared
ALSEC = 0x05; // Set seconds alarm register to 10 sec
ILR = 0x02; //Clear the RTC ALARM interrupt flag
CCR = 0x13; // Take clock from external crystal 32Khz & CLOCK ENABLE &
RESET
YEAR=MONTH=DOY=DOW=DOM=HOUR=MIN=SEC=0; // Set initial time to zero
VICIntEnable |= (1<<13); //enable RTC interrupt
}

void RTCVectoredIRQ (void) __irq
{
unsigned int i;
setup_PLL0();
for(i=0;i<60000;i++); // delay for oscillator to setup properly
after wakeup
UART1Tx('R');
UART1Tx('T');
UART1Tx('C');
UART1Tx(' ');
// interrupt end functions
SEC = 0;
ILR = 0x02; //Clear the RTC ALARM interrupt flag
VICVectAddr = 0x00000000; //Dummy write to signal end of interrupt
}
However I do not even a single time see any RTC transmission.
I would really appreciate some help.

Regards
Shashank


Hi Mike

According to the user manual when device goes in power down mode all the
peripheral registers are saved to their present values thus according to me
the UART should still remain configured.

When I run the system with external interrupts enabled (RTC disabled or
enabled with them), every time when external interrupt handler is executed
I do not re confugure the UART and is still transmits perfectly.

But I will still surely try this and get back. Till then any other inputs
will be really helpful.

Thanks
Shashank

On Mon, Oct 8, 2012 at 12:43 AM, Michael Anton wrote:

> **
> Do you reconfigure the UART when you come out of power down mode? If the
> RTC interrupt handler executes immediately out of power down mode, then
> it looks like the UART will be unconfigured. This means it will not
> transmit the characters, even if the interrupt handler is called.
>
> Mike
> -----Original Message-----
> From: l... [mailto:l...]On Behalf
> Of Shashank Maheshwari
> Sent: Saturday, October 06, 2012 7:10 AM
> To: l...
> Subject: [lpc2000] RTC Power Down Problem
>
> Hello
>
> I have issues with the RTC of my LPC2148 board. The system is always in PD
> mode. I want it to wake up every few seconds(say 5sec) transmit at UART and
> go back to PD mode. I use external 32kHz oscillator with external 3.0 V
> battery for the RTC.
> The same when added with external interrupts works perfect for external
> interrupts however no result on the RTC peripheral.
>
> Following is the code for the same. The system goes in the PD mode in the
> while(1) loop.
>
> void setup_RTCint(void)
> {
> // setup RTC interrupt
> VICVectCntl2 = 0x0000002d; //select a priority slot for a given
> interrupt (RTC from the table)
> VICVectAddr2 = (unsigned)RTCVectoredIRQ; //pass the address of the IRQ
> into the VIC slot
> EXTWAKE |= (1<<15); // same as INTWAKE (wake RTC from Power Down
> mode)
> PCONP |= (1<<9);
> CIIR = 0x00;
> AMR = 0xfe; // ALARM mask: Only seconds value is compared
> ALSEC = 0x05; // Set seconds alarm register to 10 sec
> ILR = 0x02; //Clear the RTC ALARM interrupt flag
> CCR = 0x13; // Take clock from external crystal 32Khz & CLOCK ENABLE &
> RESET
> YEAR=MONTH=DOY=DOW=DOM=HOUR=MIN=SEC=0; // Set initial time to zero
> VICIntEnable |= (1<<13); //enable RTC interrupt
> }
>
> void RTCVectoredIRQ (void) __irq
> {
> unsigned int i;
> setup_PLL0();
> for(i=0;i<60000;i++); // delay for oscillator to setup properly
> after wakeup
> UART1Tx('R');
> UART1Tx('T');
> UART1Tx('C');
> UART1Tx(' ');
> // interrupt end functions
> SEC = 0;
> ILR = 0x02; //Clear the RTC ALARM interrupt flag
> VICVectAddr = 0x00000000; //Dummy write to signal end of interrupt
> }
>
> However I do not even a single time see any RTC transmission.
> I would really appreciate some help.
>
> Regards
> Shashank
>
>
>
>

Memfault Beyond the Launch