Skip to main content
Visitor II
June 22, 2007
Question

STR750-SK Dev Kit - External Interrupts

  • June 22, 2007
  • 3 replies
  • 1032 views
Posted on June 22, 2007 at 06:33

STR750-SK Dev Kit - External Interrupts

    This topic has been closed for replies.

    3 replies

    montesnsAuthor
    Visitor II
    June 20, 2007
    Posted on June 20, 2007 at 10:35

    Hi everyone, this is my second day using ST micontrollers. I got a STR750-SK dev kit and I would like to force external hardware interrupts using the buttons on the board. This is what I've done to setup the pins connected to the chip:

    // EIC Init

    EIC_DeInit();

    // EXTIT Init

    EXTIT_DeInit();

    // Use pins 5, 7, 9 and 11 in Port 1 for detecting external interrupts

    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_7 | GPIO_Pin_9 | GPIO_Pin_11;

    GPIO_Init(GPIO1, &GPIO_InitStructure);

    // Enable and configure the priority of the EXT interrupt IRQ Channel

    EIC_IRQInitStructure.EIC_IRQChannel = EXTIT_IRQChannel;

    EIC_IRQInitStructure.EIC_IRQChannelPriority = 2;

    EIC_IRQInitStructure.EIC_IRQChannelCmd = ENABLE;

    EIC_IRQInit(&EIC_IRQInitStructure);

    // Set the External interrupts individually

    // Connect bottons B1 - B2 - B3 - B4 on the STR750-SK board

    EXTIT_InitStructure.EXTIT_ITLine = EXTIT_ITLine5 | EXTIT_ITLine7 | EXTIT_ITLine9 | EXTIT_ITLine11;

    EXTIT_InitStructure.EXTIT_ITTrigger = EXTIT_ITTrigger_Rising;

    EXTIT_InitStructure.EXTIT_ITLineCmd = ENABLE;

    EXTIT_Init(&EXTIT_InitStructure);

    // Enable the Interrupt controller to manage IRQ channel

    EIC_IRQCmd(ENABLE);

    __enable_interrupt();

    Any ideas why when I press the buttons the ISR doesn't get called?

    If anyone has some code I could use to learn how to setup and use external interrupts, that will be very useful.

    Thanks,

    CARLOS

    Visitor II
    June 20, 2007
    Posted on June 20, 2007 at 16:44

    Hello,

    Your code seems Ok; I want just to check if the EXTIT and GPIO clock are enabled?

    As reference code, you can refer to the EXTIT examples provided with the STR75x software library which demonstrates how to configure an external interrupt line. This library is available for download from the following

    http://www.st.com/stonline/products/support/micro/files/um0218.zip

    With regards,

    Raouf.

    montesnsAuthor
    Visitor II
    June 21, 2007
    Posted on June 21, 2007 at 03:48

    Thanks Raouf,

    I found it. I fortgot to enble the clock controlling the EXTIT:

    I had:

    MRCC_PeripheralClockConfig(MRCC_Peripheral_TIM0 | MRCC_Peripheral_GPIO, ENABLE);

    I needed:

    MRCC_PeripheralClockConfig(MRCC_Peripheral_EXTIT | MRCC_Peripheral_TIM0 | MRCC_Peripheral_GPIO, ENABLE);

    I really appreciate your help.

    CARLOS