2008-03-27 03:25 AM
2008-03-27 03:25 AM
Hi all,
I work with STR751 device and i have strange phenomenon with some of the devices. I configured the RTC EXTIT line 15 and P1.15 as shown below. The code is work fine but I have some devices thet didn't jump to the WAKUP_IRQHandler (EXTIT_Line15) interrupt after every 10 seconds. after some testing I found that the RTC_FLAG_Alarm is set after every 10 seconds but EXTIT_ITLine15 pending bit is remain in reset. I tried to stimulate EXTIT_ITLine15 interrupt by setting P1.15 GPIO_WriteBit(GPIO1, GPIO_Pin_15, Bit_RESET); GPIO_WriteBit(GPIO1, GPIO_Pin_15, Bit_SET); GPIO_WriteBit(GPIO1, GPIO_Pin_15, Bit_RESET); But EXTIT_ITLine15 pending bit is remain in reset. Did anyone have an idea why the EXTIT_ITLine15 pending bit remain in reset???? /////////////////////////////////////////////////////////// // RTC configuration // Enable RTC Clock MRCC_PeripheralClockConfig(MRCC_Peripheral_RTC, ENABLE); // Wait for RTC registers synchronization RTC_WaitForSynchro(); // Wait until last write operation on RTC registers has finished RTC_WaitForLastTask(); // Set RTC prescaler: set RTC period to 1 second RTC_SetPrescaler(32767); // Wait until last write operation on RTC registers has finished RTC_WaitForLastTask(); // Enable the RTC Second interrupt //RTC_ITConfig(RTC_IT_Second, ENABLE); RTC_ITConfig((RTC_IT_Second | RTC_IT_Overflow | RTC_IT_Alarm), DISABLE); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; GPIO_Init(GPIO1, &GPIO_InitStructure); GPIO_WriteBit(GPIO1, GPIO_Pin_15, Bit_RESET); // Enable EXTIT line 15 (RTC Alarm) on rising edge EXTIT_ClearITPendingBit(EXTIT_ITLine15); Init_EXTIT(EXTIT_ITLine15, EXTIT_ITTrigger_Rising, ENABLE); /////////////////////////////////////////////////////////// void WAKUP_IRQHandler(void) { if(RTC_GetFlagStatus(RTC_FLAG_Alarm) != RESET) { // Clear the RTC Alarm pending bit RTC_ClearFlag(RTC_FLAG_Alarm); SleepCounter++; if (SleepCounter == NumOfCountToSleep) { ...... } // Wait until last write operation on RTC registers has finished RTC_WaitForLastTask(); // Alarm in 10 seconds RTC_SetAlarm(RTC_GetCounter() + 10); // Wait until the write operation is performed while(RTC_GetFlagStatus(RTC_FLAG_RTOFF) == RESET); } // Clear EXTIT line15 pending bit EXTIT_ClearITPendingBit(EXTIT_ITLine15); } Thanks in advance.