I'm trying to use the RTC on my MCB2300 with Keil IDE. The NXP example is only using the internal clock. My initialization seems to be ok, according to the lpc23xx manual. But I'm facing 2 issues. First, my code is running only in debug mode. When not in debug mode, it seems that interrupt is never fired. In debug mode (even without breakpoint) interrupt behaviour is great but timing is really slow (1seconde every 4 or 5sec). I'm powering RTC with PCONP register before initialization, then I set CCR register to use external oscillator. Then I set my interrupt and I enable my RTC. I don't understand what I'm missing here. Thanks for any help !
Thanks for answering. I tryed a lot of different initialization but I took care about the RTC_CIIR register. Actually, here is my RTCinit() :
void RTCInit( void ) { alarm_on = 0; PCONP |= (1<<9); /* must be powered during configuration*/ /*--- Initialize registers ---*/ RTC_ILR = ILR_RTCALF | ILR_RTCCIF; /* Disable 32'768 interrupt */ RTC_AMR = 0; /* alarm mask register */ RTC_CIIR = 0; /* counter increment interrupt */ RTC_CCR |= CCR_CLKSRC; /* CCR_CLKSRC = 0x10 : external oscillator */ /* //RTC_PREINT = PREINT_RTC; // 0 //RTC_PREFRAC = PREFRAC_RTC; // 0 */ RTC_CIIR |= 1; /* sec interrupt */ return; }
Any idea ? Thanks again.