Discussion in "ARM Development" started by    bikashh    May 2, 2011.
Mon May 02 2011, 05:42 pm
#1
Dear friends,
I am using LPC2368 in my project and have successfully done RTC.RTC is given battery backup with external crystal connected.but now i want my RTC keep running when my mains supply is off.Because whenever i switch on the mains RTC registers are loaded again and the counting continues from start.

thanks in advance
Mon May 02 2011, 05:59 pm
#2
do i need to configure RTC RAM in startup file.

thank you
Tue May 03 2011, 12:00 am
#3
Your program is loading RTC or its happening by itself?
If its your program then instead of configuring RTC from inside, give option to user to set it just incase RTC date time is wrong.
Tue May 03 2011, 05:13 pm
#4
@ bikashh
define ur problem in some detail
Tue May 03 2011, 06:16 pm
#5
thanks for the reply friends,I've solved the problem but still have a small problem with it
->if i enable the RTC interrupt under main() the program works perfectly but when i write it separately under RTCinit() the code after VICIntEnable doesn't work.


VICVectAddr13 = (unsigned long)RTC_isr;/*Set Interrupt Vector*/
VICVectCntl13 = 15;
VICIntEnable |=(1<<13);

also in the above VICVectCntl13 the actual value to be loaded is 0x2D but doesn't work while it works correctly if i put 15;

please reply
Thu May 05 2011, 12:13 am
#6
in what sense you're loading 0x2D to that register? are you sure of what you're trying?
Thu May 05 2011, 10:29 am
#7
as per UM 5th bit is to enable the slot + 'D' is VIC no.

thank you
Thu May 05 2011, 11:00 am
#8
dear friend,
RTC works correctly but the remaining program under mains doesn't get executed.

Terminal Output:
Real Time Clock = 4 : 4 : 44 : 52 5 5 2011
Real Time Clock = 4 : 4 : 44 : 53 5 5 2011

main()
{
Init_UART0(9600); // Initilial UART0 = 9600,N,8,1
RTCIN();
while(1) //this loop doesn't get executed.
{
uart0Puts("hi \n\r");
}
}

I tried to debug by writing a sentence after "VICIntEnable |= ((unsigned long)1<<13); "
but that sentence never appear on the terminal except RTC time and date as above.

thanks for the reply
Thu May 05 2011, 11:36 pm
#9
can you share the complete program or atleast the ISR. its hard to determine what exactly you're doing. are you acknowledging interrupt before coming out from ISR?
Sun May 08 2011, 12:05 pm
#10
here is my program

main()
{
Init_UART0(9600);
InitTimer();
uart0Puts("Initialize OK \n\r");
RTC_Init();
while(1)//this loop doesn't get executed
{uart0Puts("embeded system");
delay_ms(2000);//2 sec delay
}
}

__irq void RTC_ISR(void)
{
if(RTC_ILR & 0x01)
{
uart0Puts("Counter incrementing\n\r");//
RTC_ILR = 0x01; //clear interrupt
}

VICVectAddr=0x00000000;//dummy write to signal end of enterrupt
}

void RTC_Init(void)
{
/*set all registers and enable counter*/
VICVectAddr13=(unsigned long)RTC_ISR;
VICVectCntl13=15;
VICIntEnable= 0x00002000;
uart0Puts("After ISR")//this line doesot appear on terminal
}

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

autogCar
Sat May 11 2024, 03:38 am
Dulcehet
Fri May 10 2024, 04:22 pm
ElvasKl
Fri May 10 2024, 04:54 am
RonaldNak
Thu May 09 2024, 07:45 pm
Jamescon
Thu May 09 2024, 12:52 pm
RobertSkats
Thu May 09 2024, 10:23 am
hvCar
Thu May 09 2024, 05:53 am
DJGlido
Wed May 08 2024, 09:28 pm