Skip to main content
Visitor II
December 13, 2007
Question

Desperate wirh Interrupt :( Please help me

  • December 13, 2007
  • 5 replies
  • 792 views
Posted on December 13, 2007 at 11:21

Desperate wirh Interrupt :( Please help me

    This topic has been closed for replies.

    5 replies

    amorenoAuthor
    Visitor II
    November 8, 2007
    Posted on November 08, 2007 at 12:35

    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?

    Visitor II
    November 8, 2007
    Posted on November 08, 2007 at 13:11

    Where do you enable the peripheral clock for the timers?

    MRCC_PeripheralClockConfig(MRCC_Peripheral_TIM2, ENABLE);

    amorenoAuthor
    Visitor II
    November 8, 2007
    Posted on November 08, 2007 at 14:06

    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.

    Visitor II
    December 3, 2007
    Posted on December 03, 2007 at 13:45

    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 a

    http://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 ;)

    amorenoAuthor
    Visitor II
    December 13, 2007
    Posted on December 13, 2007 at 11:21

    Hello Moderator

    Thank you very much for your reply. Now the program in runnig ok.

    Regards.

    AMoreno