cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L562VET6 won't enter EXTI callback function.

Giridhara_Datta_G
Associate III

I'm unable to receive the external interrupt from both EXTI1 and EXTI8 interrupt lines
The triggering is set to faling edge detection and the pin is pulled up externally and the push button connected to the pin shorts it with the ground to create faling edge pulse.
But when I debug the program isn't entering the Interrupt callback funtion when it encounters falling edge.
Any help will be appreciated.
Thanks a lot in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Giridhara_Datta_G ,

After having a look at your example, I noticed that you're using a callback named HAL_GPIO_EXTI_Callback() 

which is used in oldest HAL products while you need to use HAL_GPIO_EXTI_Falling_Callback() in your case.

After making the fix, the callback is called when one of the two EXTI interrupts is fired.

Hope it helps.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

8 REPLIES 8
SofLit
ST Employee

Hello,

I don't see an issue in your test code!

Unfortunately I don't have an L5 board to do the test.

Meanwhile, Are you sure there is nothing connected externally to PB1 and PA8 (except the pull-ups)?

And it you try to test these I/Os in output mode and toggle them? are you seeing something on their outputs (just to ensure that they are not broken)?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

When I observe the GPIO levels in the live update of the GPIOB->IDR1 Register under SFRs I'm seeing the change in the levels according to my input. But that is not reflecting to the ISR funtion. the falling edge is not triggering the callback function.

There is nothing else connected to the interrupt pins except the pull-up. the same code and the pullup circuit is working fine with the corresponding pins in STM32L432kc Nucleo board.

Is there any other configuration settings that I have missed?

 

> When I observe the GPIO levels in the live update of the GPIOB->IDR1 Register under SFRs I'm seeing the change in the levels according to my input.

So you observe PB8 is changing?

> #define NDRDY_Pin GPIO_PIN_8
> #define NDRDY_GPIO_Port GPIOA
> #define NDRDY_EXTI_IRQn EXTI8_IRQn

You defined the pin as PA8. GPIOB->IDR won't have any effect on it. Maybe recheck your pin assignments/assumptions here.

Always helps to show screenshots to show us what you're seeing.

If you feel a post has answered your question, please click "Accept as Solution".

> So you observe PB8 is changing?

I have defined 2 interrupts here i.e,
> #define NDRDY_Pin GPIO_PIN_8
> #define NDRDY_GPIO_Port GPIOA
> #define NDRDY_EXTI_IRQn EXTI8_IRQn
and
> #define NDRDY_Pin GPIO_PIN_1
> #define NDRDY_GPIO_Port GPIOB
> #define NDRDY_EXTI_IRQn EXTI1_IRQn
I have easy controll on pin PB1 as it is connected to the external pushbutton with a pull-up circuit.
when the pushbutton is not pressed :

 Screenshot 1.png

 GPIOB -> IDR1 is high
when the pushbutton is pressed :

Screenshot 2.png

 

 GPIOB -> IDR1 is becoming low

 

 

SofLit
ST Employee

Hello @Giridhara_Datta_G ,

I will try the project during this week with NUCLEO-L552ZE-Q board and get back to you as soon as I have an answer/feedback.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Hello @Giridhara_Datta_G ,

After having a look at your example, I noticed that you're using a callback named HAL_GPIO_EXTI_Callback() 

which is used in oldest HAL products while you need to use HAL_GPIO_EXTI_Falling_Callback() in your case.

After making the fix, the callback is called when one of the two EXTI interrupts is fired.

Hope it helps.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Thanks a lot @SofLit!! ,
Changing the callback function from
>HAL_GPIO_EXTI_Callback()
to 
>HAL_GPIO_EXTI_Falling_Callback()
solved the issue