2007-12-13 02:21 AM
Desperate wirh Interrupt :( Please help me
2007-11-08 03:35 AM
Hello,
I’m really desperate with my first program with AMR. Trying to set up the timer2 to do a simple interrupt every certain time, it doesn’t work. My code is: ************************* MAIN CODE **************************** int main() { debug(); GPIO_Config (GPIO1, 0x0100, GPIO_OUT_PP); //Led GPIO_BitWrite(GPIO1, 8,0); /*********** TIMER ****************/ TIM_Init(TIM2 TIM_PrescalerConfig(TIM2,0x0000 ); TIM_ClockSourceConfig(TIM2, TIM_INTERNAL); TIM_ITConfig(TIM2, TIM_TO_IT, ENABLE); TIM_CounterConfig(TIM2, TIM_START); /************ EIC ******************/ EIC_IRQChannelConfig(T2TIMI_IRQChannel, ENABLE); EIC_IRQChannelPriorityConfig(T2TIMI_IRQChannel, 10); EIC_IRQConfig(ENABLE); while (1) {;} } ******************** INTERRUPT CODE 71x_IT.c ***************** void T2TIMI_IRQHandler(void) { GPIO_BitWrite(GPIO1, 8,0); GPIO_BitWrite(GPIO1, 8,1); } The program never goes to the interrupt routine. Why?? I don’t understand. The compilation doesn’t report any error but simply not works. Do I have to ''link'' the archive 71x_IT.C to project in any special form? Software: IAR Workbench 5.0 Quickstar (already tested on EV 4.0 and 5.0 and quickstar 4.4 versions) My hardware is: IAR quickstart Kit STR711 SK/IAR I’d appreciate your help very much. Note that this is my first program. Thanks Alfa P.D. Comparing with another examples interrupts I see that grup “startup� in not in my program. What is this?2007-11-08 04:11 AM
Where do you enable the peripheral clock for the timers?
MRCC_PeripheralClockConfig(MRCC_Peripheral_TIM2, ENABLE);2007-11-08 05:06 AM
Thank you for your quick reply.
I have added your suggestion but don’t work. An error is returned. I was looking for any information about this instruction but… is it really for STR71x ? I can’t find it in reference manuals… By the way, I have observed that ANY interrupt is served (tried also with UART). Let me explain please. If I take an example from library, the interrupts are served. No problem But if I start a new project, the interrupts never are served. Why ? I have observed that STARTUP group is in example but not in my project. (these group include 71x_vect.s and 71x_init.s). Could it be the problem? I don’t have these files included or generated in my project. How can I do it? Your help is much appreciated. Best regards.2007-12-03 04:45 AM
Dear amoreno,
To enable the clock for TIM2 on STR71x, you have to use the following function; '' /* Enable TIM2 clock on APB2 */ APB_ClockConfig (APB2, ENABLE, TIM2_Periph );'' However, ''MRCC_PeripheralClockConfig'' function is used with STR75x product. The 71x_vect.s and 71x_init.s need to be included in your project; The 71x_vect.s contains exception vectors and exception handlers while the 71x_init.s initializes stack pointers and interrupts for each mode. ST offers ahttp://www.st.com/mcu/download2.php?file=str71xfwlib.zip&info=STR7 Software STR71x&url=http://www.st.com/stonline/products/support/micro/files/str71xfwlib.zip
with project template for standard software toolchain to easy start with and reduce chance for error. Enjoy ;)2007-12-13 02:21 AM
Hello Moderator
Thank you very much for your reply. Now the program in runnig ok. Regards. AMoreno