cancel
Showing results for 
Search instead for 
Did you mean: 

How to specify external interrupt rather than event

markb
Associate II
Posted on June 15, 2015 at 10:41

Hi,

Using the cube 4.8.0 I configured PA2 to be GPIO_EXTI2 because I want an interrupt generated

when the signal connected to that pin goes low but the code that gets generated for me looks

like this:

  /*Configure GPIO pin : PA2 */

  GPIO_InitStruct.Pin = GPIO_PIN_2;

  GPIO_InitStruct.Mode = GPIO_MODE_EVT_RISING;

  GPIO_InitStruct.Pull = GPIO_NOPULL;

  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

I want the mode to be GPIO_MODE_IT_FALLING but I can't find any way of telling the cube that. Is the GUI

missing something, or am I just thick?

Cheers,

Mark

2 REPLIES 2
takahasi
Associate II
Posted on June 15, 2015 at 11:05

Hi, the answer is

1) select Cofigration tab

2) push GPIO button

3) select PA2

4) select GPIO mode - External Interrupt Mode with Falling edge trigger detection

5) push NVIC button (from Configuration tab)

6) enable ''EXTI line 2 and line 3 interrupts''

7) implement HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)

Note: GPIO_Pin is GPIO_PIN_2

markb
Associate II
Posted on June 15, 2015 at 11:50

Many thanks for the swift reply. I thought it would be something like that. The problem is

that the section of the configuration dialog that lets you specify the GPIO pin mode is

not visible when I run the cube using Linux Java. If I run the same version of the cube

using Wine then I can see the option to change the GPIO mode. So it's a problem with

the GUI when running the cube using Linux Java.

Cheers,

Mark