RTC ALARM interrupt problem

i use RTC to generate an ALARM.
i have a function that sets the values of ALHOUR and ALMIN. after doing that i call a function (see below) that handles the interrupt initialization. immediately when i call this function an interrupt is generated even though time condition is not matched. when time condition is matched interrupt is not asserted.

/***************************/
/*      Init ALARM       */
/***************************/
void ALARM_init (void)
{
  RTC_AMR = 0xFF;                       //Mask all bits
  RTC_AMR &= 0xF9;                  //enable MIN,HOUR

  /* Setup the VIC */
  VICIntEnClr |= 1<<13;                     // clear 13th bit (is the RTC)
  VICVectAddr13  = (unsigned long int) &start_ALARM_ISR;
  VICVectCntl13  = 0x07;              // Interrupt priority
  VICIntEnable  |= 1<<13;                   //enable RTC interrupt, 13th bit
  return;
}

/***************************/
/*      ALARM ISR          */
/***************************/
 void start_ALARM_ISR (void) __irq
{

Parents
  • Meir,
    Did you following this procedure exactly?
    I assume you are using an ARM7 core.

    4 CONFIGURATION MODE
    To write in the RTC_PRL, RTC_CNT, RTC_ALR registers, the peripheral must enter Configuration
    mode. This is done by setting the CNF bit in the RTC_CRL register.
    In addition, writing to any RTC register is only enabled if the previous write operation is finished.
    To enable the software to detect this situation, the RTOFF status bit is provided in the
    RTC_CR register to indicate that an update of the registers is in progress. A new value can be
    written to the RTC counters only when the RTOFF status bit value is 1.
    Configuration Procedure:
    1. Poll RTOFF, wait until its value goes to 1
    2. Set CNF bit to enter configuration mode
    2. Write to one or more RTC registers
    3 Clear CNF bit to exit configuration mode
    The write operation only executes when the CNF bit is cleared and it takes at least two
    Clock32 cycles to complete.
    

Reply
  • Meir,
    Did you following this procedure exactly?
    I assume you are using an ARM7 core.

    4 CONFIGURATION MODE
    To write in the RTC_PRL, RTC_CNT, RTC_ALR registers, the peripheral must enter Configuration
    mode. This is done by setting the CNF bit in the RTC_CRL register.
    In addition, writing to any RTC register is only enabled if the previous write operation is finished.
    To enable the software to detect this situation, the RTOFF status bit is provided in the
    RTC_CR register to indicate that an update of the registers is in progress. A new value can be
    written to the RTC counters only when the RTOFF status bit value is 1.
    Configuration Procedure:
    1. Poll RTOFF, wait until its value goes to 1
    2. Set CNF bit to enter configuration mode
    2. Write to one or more RTC registers
    3 Clear CNF bit to exit configuration mode
    The write operation only executes when the CNF bit is cleared and it takes at least two
    Clock32 cycles to complete.
    

Children
More questions in this forum