Hello everybody,
I am trying to realize external gpio interrupts using HAL driver. My first attempt with Arduino Library using "attachInterrupt(...)" works but I figured out that there is an higher priority interrupt with 1ms period which "destroys" my project. So I decided to solve that in using the HAL drivers. Below is my code for the "M4Core", but unfortunately the IRQ handler is never raised, means the PC6 GPIO is never high...
Thank you very much !
#include "stm32h7xx_hal_gpio.h"
#include "stm32h7xx_hal_exti.h"
void EXTI9_5_IRQHandler(void)
{
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_6, GPIO_PIN_SET);
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_7);
}
void setup() {
HAL_Init();
__HAL_RCC_GPIOC_CLK_ENABLE();
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = GPIO_PIN_6; // PC6 which should be set high in the interrupt
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = GPIO_PIN_7; // Interrupt pin
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
HAL_NVIC_SetPriority(EXTI9_5_IRQn,5, 0);
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
}
void loop() {
}