7 years, 1 month ago.

STM32F469 - How to write interrupts for lines 5-15? Do I need to start using a library with EXTI?

I'm trying to program interrupts for the STM32F469 Discovery Board. I have successfully managed to code it for pin A5 (PA_4), with the following setup code:

  1. define WASHER_SIGNAL_PIN GPIO_PIN_4
  2. define WASHER_SIGNAL_GPIO_PORT GPIOA
  3. define WASHER_SIGNAL_GPIO_CLK_ENABLE() HAL_RCC_GPIOA_CLK_ENABLE()
  4. define WASHER_SIGNAL_GPIO_CLK_DISABLE() HAL_RCC_GPIOA_CLK_DISABLE()
  5. define WASHER_SIGNAL_EXTI_IRQn EXTI4_IRQn

void EwBspConfigWasherPin( TPinCallback aPinCallback ) { GPIO_InitTypeDef GPIO_InitStructure;

/* Enable GPIOC clock */ WASHER_SIGNAL_GPIO_CLK_ENABLE();

/* Configure washer signal pin as input floating */ GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING_FALLING; GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pin = WASHER_SIGNAL_PIN; HAL_GPIO_Init( WASHER_SIGNAL_GPIO_PORT, &GPIO_InitStructure );

/* Enable and set EXTI lines 0 Interrupt to the lowest priority */ HAL_NVIC_SetPriority( WASHER_SIGNAL_EXTI_IRQn, 8, 0 ); HAL_NVIC_EnableIRQ( WASHER_SIGNAL_EXTI_IRQn );

WasherCallback = aPinCallback; }

This uses the HAL GPIO Library. But how can I use interrupts on pins 5-15? Do I need to start using a new library with the EXTI commands? Where is this library if so? If seems that the EXTI and GPIO commands are similar (i.e. mode, trigger, pin etc).

1 Answer

7 years, 1 month ago.

Hi,

Why don't you use the mbed HAL ?

For example:

InterruptIn extpin1(PA_4);
InterruptIn extpin2(PB_5);

All the GPIO and EXTI configuration are managed for you.

Well the reason is because I am using a GUI design software which doesn't use mbed HAL, so I am trying to use the same libraries that it uses, in order to interface with the GUI.

posted by James Elder 08 Mar 2017