2007-06-21 09:33 PM
STR750-SK Dev Kit - External Interrupts
2007-06-20 01:35 AM
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, CARLOS2007-06-20 07:44 AM
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 followinghttp://www.st.com/stonline/products/support/micro/files/um0218.zip
With regards, Raouf.2007-06-20 06:48 PM
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