2024-12-02 03:56 PM
i used stm32cubeMX to generate code to support GPIO external interrupts.
i expected to use HAL_GPIO_EXTI_Callback and it compiled but did not work.
i had to use HAL_GPIO_EXTI_Falling_Callback and HAL_GPIO_EXTI_Rising_Callback
i used a Nucleo-U5a5ZJ board.
cubeMX 6.12.1
cubeIDE 1.16.1
does anyone know why HAL_GPIO_EXTI_Callback does not work?
I noticed that HAL_GPIO_EXTI_Callback was not in the stm32u5xx_hal_gpio.h file
thanks
phil
Solved! Go to Solution.
2024-12-02 10:54 PM
There are other STM32's, like STM32G071, STM32C0xx that are the same.
2024-12-02 06:24 PM
ST just made 2 callbacks instead of 1. You can make your own callback and call it. Read the pin status as you would normally
uint8_t exti4_pinStatus = 1; // initialize to 1, assuming pin is pulled up
void GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if(GPIO_Pin == EXTI_4_Pin)
{
exti4_pinStatus = HAL_GPIO_ReadPin(EXTI_4_GPIO_Port, EXTI_4_Pin);
}
}
void HAL_GPIO_EXTI_Rising_Callback(uint16_t GPIO_Pin)
{
GPIO_EXTI_Callback(GPIO_Pin);
}
void HAL_GPIO_EXTI_Falling_Callback(uint16_t GPIO_Pin)
{
GPIO_EXTI_Callback(GPIO_Pin);
}
2024-12-02 07:48 PM
most of your examples say to call
HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
is the STM32_U5xx_hal_gpio.c the only library that does not support this function?
are there any examples that show the use of the code you suggested ?
thanks
phil
2024-12-02 10:54 PM
There are other STM32's, like STM32G071, STM32C0xx that are the same.