Interrupt stuff -> How to get a signal connected to an ExtInt0 Port triggering an ISR

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


AT32UC3L064

 

Hi there.

 

I'm stuck with interrupt stuff. What I want:

 - Using a signal connected to PB06 using the ExtInt[0] to generate an interrupt that triggers an ISR.

 

What I found:

 

/* EIC */
#define AVR32_EIC_ADDRESS                  0xFFFF2400
#define AVR32_EIC                          (*((volatile avr32_eic_t*)AVR32_EIC_ADDRESS))
#define AVR32_EIC_IRQ_1                   352
#define AVR32_EIC_IRQ_2                   353
#define AVR32_EIC_IRQ_3                   354
#define AVR32_EIC_IRQ_4                   355
#define AVR32_EIC_IRQ_5                   384
#define AVR32_EIC_STD_NUM                  5
#define AVR32_EIC_EXTINT_0_0_PIN           7
#define AVR32_EIC_EXTINT_1_0_PIN           9
...

 

 

Which IRQ do I need to choose? According to chapter "3.2 Peripheral Multiplexing on I/O lines" (Datasheet: AT32UC3L016/32/64, 32099I–01/2012) there are ExtInt[0] to ...[5] so 6 lines. The header file "uc3l064.h" only states IRQ_1 to _5 (which correlates with "Table 3-7. Signal Descriptions List" and "Table 11-3. Interrupt Request Signal Map") => But where is the 'EXTINT0'

 

The header file "eic_301.h" is then talking about 15 interrupts...???frown

 

 

So what I am going to do is:

/*** ISR *******************************************************/

__attribute__((__interrupt__))
static void Isr_External_Signal_Input(void)
{
    eic_clear_interrupt_line( &AVR32_EIC, AVR32_EIC_INT???);
    
    light_single_led(LED_RED_PIN);
}

/*** MAIN ******************************************************/
int main (void)

    /*--- Register ISR -------------------*/

    Disable_global_interrupt();

    INTC_init_interrupts();
    INTC_register_interrupt(&Isr_External_Signal_Input,
                            AVR32_EIC_IRQ_???, 
                            AVR32_INTC_INTLEVEL_INT0);
                            
    Enable_global_interrupt();

    /*--- Configure and Initialize EIC -------------------*/

    eic_options_t eic_options = 
    {
        eic_options.eic_mode   = EIC_MODE_EDGE_TRIGGERED,
        eic_options.eic_edge   = EIC_EDGE_FALLING_EDGE;
        eic_options.eic_filter = EIC_FILTER_ENABLED,
        eic_options.eic_async  = EIC_ASYNCH_MODE, /* For Wake Up mode, initialize in asynchronous mode */
        eic_options.eic_line   = AVR32_EIC_INT???
    };

    eic_init(&AVR32_EIC, &eic_options,1);
    eic_enable_line(&AVR32_EIC, AVR32_EIC_INT???);
    

    /*--- Configure and Enable GPIO Pin -------------------*/

    gpio_configure_pin(AVR32_EIC_EXTINT_0_1_PIN, GPIO_INTERRUPT); /* that is "38" and "6" */
    gpio_enable_module_pin(AVR32_EIC_EXTINT_0_1_PIN, AVR32_EIC_EXTINT_0_1_FUNCTION); 

    ...
    while(1)
}

 

So, which which interrupt line do I choose and why?


AVR32_EIC_IRQ_???

AVR32_EIC_INT???

 

Thank you very much in forward for your help!


Cheers

This topic has a solution.
Last Edited: Tue. Aug 27, 2019 - 09:04 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

EXTIN0 is 'special', it is the NMI interrupt, and you will need to write your own exception handler. (or modify exception.S ).
Can you use another EXTINT pin ?


As to why eic_301.h defines 15 interrupts., my guess is that whoever wrote that header file knew that there were never going to more than 15.
The UC3Dxxx has a maximum of 9 EXTINTs but the other UC3?xxx chips have 8 or less.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Thank you very much for your reply!


Well, EXTINT0 => NMI, that's an important input, thx! Just figured out that one might be lucky or not depending on which chip, and so which datasheet one is looking at. AT32UC3L doesn't make this match whereas AT32UC3C states this.

 

Datasheet AT32UC3L:

 

 

Datasheet AT32UC3C:

 

 

Ok, got it so far. Thx!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In the above posted code I forgot to enable the "interrupt line"!! I.e.:

eic_enable_interrupt_line(&AVR32_EIC, AVR32_EIC_INT???);

 

 

/*--- Configure and Initialize EIC -------------------*/
    ...

    eic_init(&AVR32_EIC, &eic_options,1); 
    eic_enable_line(&AVR32_EIC, AVR32_EIC_INT??? ); 
    eic_enable_interrupt_line(&AVR32_EIC, AVR32_EIC_INT??? );

 

well, now it works fine.

thanks for your help.