# External interrupts in STM32CubeMx on both Rising/Falling?

I'm using STM32Cube to generate the configuration. It creates the following code by default for MX_GPIO_Init in main.c:

...
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
...


However, I also want it to be triggered on falling, so I have to manually change it to:

GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;


Since I need regularly to change the setup (because I am both a starter, and want to gradually add pins), is there a way in STM32CubeMX to set this, so it is generated?

• You need to disable interrupts before changing the trigger edge. maybe run it as an ISR? – Sparky256 Feb 5 '18 at 0:09
• @Sparky256 it's not about the code execution/order, it's about the generation of code from STM32CubeMX. I would expect a field/widget somewhere inside STM32CubeMX to set the trigger edge type (falling/rising/falling+rising). – Michel Keijzers Feb 5 '18 at 9:40