cancel
Showing results for 
Search instead for 
Did you mean: 

Can't get a simple GPIO External Interrupt to fire

SWill.10
Associate II

Hi there. I'm having a lot of trouble.

I've managed to get UART (just direct calls, not interrupt based), PWM, and ADC working on a Nucleo board (namely, the STM32F070RB board). However, I'm having serious trouble getting a simple push-button to fire an interrupt.

I'm using the on-board user button, tied to C13. I know this works and is not a hardware/solder bridge problem, because I've probed the exposed pin and it certainly changes between 3.3V/0V when released/pressed.

I watched this tutorial video and it seemed simple enough (like most things, thanks to STM32Cube): https://www.youtube.com/watch?v=UtkszckecV8

Sadly, I've had no luck. Here's a look at some of my code.

gpio.c generated from STM32Cube:

0690X000006CmDsQAK.png

Callback function, as shown in the video, present in main.c:

0690X000006CmE7QAK.png

Using the boolean the interrupt *should* set. The CommandLine() function is not blocking (even if it was, it shouldn't matter anyway, if this is an interrupt) and the PrintLn function I have made works perfectly fine (just based on normal HAL_UART_Transmit(), with an added \r\n).0690X000006CmE2QAK.png

If anyone has any ideas on what might be missing, not set, or configured incorrectly I would really appreciate it. This is the most simple part of the project, but is taking me the longest :face_without_mouth:

Cheers!

1 ACCEPTED SOLUTION

Accepted Solutions
SWill.10
Associate II

Hi there.

Sorry. It was actually a problem with my programmer/ELF file. It turned out for some reason the new compiled hex/bin (which had the interrupt implemented) wasn't getting flashed, and so things weren't working before. The code I have posted does in fact work.

I tried deleting the post about 5 minutes after posting it here, but it says "Administrator has disabled deleting posts and comments" so I can't. So please ignore this issue.

Thanks.

View solution in original post

4 REPLIES 4

How do you set the EXTI registers?

JW

SWill.10
Associate II

Hi there.

Sorry. It was actually a problem with my programmer/ELF file. It turned out for some reason the new compiled hex/bin (which had the interrupt implemented) wasn't getting flashed, and so things weren't working before. The code I have posted does in fact work.

I tried deleting the post about 5 minutes after posting it here, but it says "Administrator has disabled deleting posts and comments" so I can't. So please ignore this issue.

Thanks.

Thank you for coming back with the solution. Even if you might think that it was an irrelevant and trivial error, it's far from being so, and these lessons are very important to be told about.

Please mark your answer "Best" so that the thread will be tagged as solved.

JW

Hi Jan,

Thanks for guidelines you provided. I totally agree with what you suggested.

I marked the answer as best.

-Amel

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.