cancel
Showing results for 
Search instead for 
Did you mean: 

had to use void HAL_GPIO_EXTI_Falling_Callback and void HAL_GPIO_EXTI_Rising_Callback

Weightwatcherphil
Associate II

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

 

1 ACCEPTED SOLUTION

Accepted Solutions

There are other STM32's, like STM32G071, STM32C0xx that are the same. 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

View solution in original post

3 REPLIES 3
Karl Yamashita
Lead III

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);
}

 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

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

 

There are other STM32's, like STM32G071, STM32C0xx that are the same. 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.