cancel
Showing results for 
Search instead for 
Did you mean: 

RTC Periodic interrupt

languera
Associate II
Posted on February 08, 2007 at 14:24

RTC Periodic interrupt

10 REPLIES 10
languera
Associate II
Posted on May 17, 2011 at 09:35

Hi all,

We made a code with 2 interrupts on a STR912FW44 : Timer 0 and the periodic RTC at 1024Hz.

The two handlers are :

void TIM0_IRQHandler(void)

{

GPIO_WriteBit(GPIO0,GPIO_Pin_4,Bit_SET);

GPIO_WriteBit(GPIO0,GPIO_Pin_4,Bit_RESET);

/*Clear the TIM OC1 flag */

TIM_ClearFlag(TIM0, TIM_FLAG_OC2);

}

void RTC_IRQHandler(void)

{

GPIO_WriteBit(GPIO0,GPIO_Pin_7,Bit_SET);

GPIO_WriteBit(GPIO0,GPIO_Pin_7,Bit_RESET);

RTC_PeriodicIntConfig(RTC_Per_DISABLE);

RTC_ClearFlag(RTC_FLAG_Per);

RTC_PeriodicIntConfig(RTC_Per_1024Hz);

}

When these 2 interrupts are too near, a repetition of the RTC handler is noted. Can you give us reasons ?

Best regards.

amira1
Associate II
Posted on May 17, 2011 at 09:35

Hi Bobotic,

could you please send me your project to check with you the problem.

Best regards

mirou

languera
Associate II
Posted on May 17, 2011 at 09:35

Hi Mirou

This is a simple project made with IAR, and ST libraries.

I join a screem shoot of the problem...

I added a dummy routine to the DVAR register of VIC0 and VIC1 (see 91x_IT.c). Then the program don't freeze, but there is this double interrupt !! I dont't see why !??

Thank, for your help !!!

🙂

languera
Associate II
Posted on May 17, 2011 at 09:35

Nobody finds the same problem ?

nanuradha
Associate II
Posted on May 17, 2011 at 09:35

hi all

we are facing a different problem with RTC periodic interrupt. the ISR is gettting executed only once but not periodically. while working in the polling mode, the flag is working correctly, but in the interrupt mode of operation, it is not. the code is as follows:

#include

GPIO_InitTypeDef GPIO_InitStructure;

void SCU_Configuration(void);

void GPIO_Configuration(void);

void VIC_Configuration(void);

void RTC_Configuration(void);

extern u8 k;

void main()

{

RTC_TIME time;

RTC_DATE date;

#ifdef DEBUG

debug();

#endif

SCU_Configuration();

GPIO_Configuration();

RTC_Configuration();

VIC_Configuration();

date.day = 7 ; /* set day */

date.weekday = 1; /* set weekday */

date.month = 1; /* set month */

date.year = 7; /* set year */

date.century = 20; /* set century */

time.hours = 11; /* set hours */

time.minutes = 32; /* set minutes */

time.seconds = 30; /* set seconds */

time.milliseconds = 0; /* set milliseconds */

/*set time & date*/

RTC_SetDate(date); /* set date in RTC */

RTC_SetTime(time); /* set time in RTC registers */

k=0x00;

RTC_PeriodicIntConfig(RTC_Per_2Hz);

while(1)

{

GPIO_Write (GPIO7, k);

}

}

/********************************Subroutines******************************/

void VIC_Configuration(void)

{

VIC_DeInit();

VIC_Config(RTC_ITLine, VIC_IRQ, 1);

VIC_ITCmd(RTC_ITLine, ENABLE);

}

void SCU_Configuration(void)

{

SCU_APBPeriphClockConfig(__GPIO7, ENABLE);

SCU_AHBPeriphClockConfig(__VIC,ENABLE);

SCU_APBPeriphClockConfig(__RTC, ENABLE);

}

void RTC_Configuration()

{

RTC_DeInit();

RTC_TamperCmd(DISABLE);

RTC_AlarmCmd(DISABLE);

RTC_ITConfig(RTC_IT_Per, ENABLE);

RTC_ClearFlag(RTC_FLAG_Per|RTC_FLAG_Per|RTC_FLAG_Tamper);

}

void GPIO_Configuration(void)

{

GPIO_DeInit(GPIO7); /*Gonfigure LEDS*/

GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;

GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;

GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Disable;

GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt1 ;

GPIO_Init (GPIO7, &GPIO_InitStructure);

}

the isr is:

u8 k;

void RTC_IRQHandler(void)

{

k++;

RTC_PeriodicIntConfig(RTC_Per_DISABLE);

RTC_ClearFlag(RTC_FLAG_Per);

RTC_PeriodicIntConfig(RTC_Per_1024Hz);

}

nanuradha
Associate II
Posted on May 17, 2011 at 09:35

hi all,

Solution for the above problem is required very urgently.

regards,

HBL team.

[ This message was edited by: anuradha on 06-02-2007 08:14 ]

nanuradha
Associate II
Posted on May 17, 2011 at 09:35

hi all

we are facing a different problem with RTC periodic interrupt. the ISR is gettting executed only once but not periodically. while working in the polling mode, the flag is working correctly, but in the interrupt mode of operation, it is not. can you give any solution for it?

regards,

HBL Team.

[ This message was edited by: anuradha on 06-02-2007 08:10 ]

Posted on May 17, 2011 at 09:35

Hi anuradha,

I didn't test your code,

for what I see in the irq

>>void RTC_IRQHandler(void)

>>{

>>k++;

>>

>>RTC_PeriodicIntConfig(RTC_Per_DISABLE);

>>RTC_ClearFlag(RTC_FLAG_Per);

>>RTC_PeriodicIntConfig(RTC_Per_1024Hz);

>>}

you disable the RTC ''RTC_PeriodicIntConfig(RTC_Per_DISABLE);''

I have to implement the RTC so

If I can find a couple of minuts I'll try to check your code.

Ciao

nanuradha
Associate II
Posted on May 17, 2011 at 09:35

Hi Stevejamal,

Thankyou for the reply. I made the suggested change in the code but no change in the o/p. interuupt is getting executed only once. i've slightly modified the code and it is given below.

Code:

#include

GPIO_InitTypeDef GPIO_InitStructure;

void SCU_Configuration(void);

void GPIO_Configuration(void);

void VIC_Configuration(void);

void RTC_Configuration(void);

extern u8 k;

void main()

{

#ifdef DEBUG

debug();

#endif

SCU_Configuration();

GPIO_Configuration();

RTC_Configuration();

VIC_Configuration();

k=0;

while(1)

{

GPIO_Write (GPIO7,k);

}

}

/********************************Subroutines******************************/

void VIC_Configuration(void)

{

VIC_DeInit();

VIC_Config(RTC_ITLine, VIC_IRQ, 1);

VIC_ITCmd(RTC_ITLine, ENABLE);

}

void SCU_Configuration(void)

{

SCU_APBPeriphClockConfig(__GPIO7, ENABLE);

SCU_AHBPeriphClockConfig(__VIC,ENABLE);

SCU_APBPeriphClockConfig(__RTC, ENABLE);

SCU_APBPeriphReset(__RTC,DISABLE); /*RTC out of RESET state*/

}

void RTC_Configuration()

{

RTC_TIME time;

RTC_DATE date;

RTC_DeInit();

/************** RTC Time setting*******************/

date.day = 7 ; /* set day */

date.weekday = 1; /* set weekday */

date.month = 1; /* set month */

date.year = 7; /* set year */

date.century = 20; /* set century */

time.hours = 11; /* set hours */

time.minutes = 32; /* set minutes */

time.seconds = 30; /* set seconds */

time.milliseconds = 0; /* set milliseconds */

/*set time & date*/

RTC_SetDate(date); /* set date in RTC */

RTC_SetTime(time); /* set time in RTC registers */

/***************** RTC Periodic Interrupt Settings***************/

RTC_ITConfig(RTC_IT_Per, ENABLE);

RTC_ClearFlag(RTC_FLAG_Per);

RTC_PeriodicIntConfig(RTC_Per_2Hz); /* enable alarm */

}

void GPIO_Configuration(void)

{

GPIO_DeInit(GPIO7); /*Gonfigure LEDS*/

GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;

GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;

GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Disable;

GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt1 ;

GPIO_Init (GPIO7, &GPIO_InitStructure);

}

ISR:

u8 k;

void RTC_IRQHandler(void)

{

k++;

RTC_ClearFlag(RTC_FLAG_Per);

RTC_PeriodicIntConfig(RTC_Per_1024Hz);

}

Even if I include the VIC configuration in the ISR, it is not working. I need to get the solution very urgently.

Regards,

Neelima

[ This message was edited by: anuradha on 08-02-2007 10:21 ]