cancel
Showing results for 
Search instead for 
Did you mean: 

Wanting to use external interrupt to turn on internal led.

SRees.2
Associate II

I am not wanting to use the HAL interface because I want to try and gain experience with the ARM bare metal programming. I have examples online and seem to be following them exactly but the led will not light up when a pin is pulled to ground. I measured the voltage on the pull up and do get voltage. The led will turn on if I put the code in the main while loop. I am using PB5 as the input.

6 REPLIES 6
S.Ma
Principal

Use the debugger ans put a breakpoint in the exti interrupt routine. Check exri works alone, then check led.control. view the he registerd, edit them manually live to get a feel and learn with fewer project rebuild cycles.

SRees.2
Associate II

Hello,

Thanks so much for responding to my question. I've used the debugger and have checked the registers as I went through. All the registers are changing as expected with the exception of the NVIC. When I get to that point, I notice the SETENA and CLRENA both get a new value. When I pull the PB5 to zero volts nothing happens. If I use PB5 as a regular input and with the pull up and use an if statement, then the led will come on when the input is pulled to ground so I know I have my pin inputs and outputs set right. It's like the interrupt is just not enabled. Checking the PR5 bit it actually does change to 1 when I pull the PB5 low. Are there some additional settings or check boxes hidden away?

S.Ma
Principal

Older EXTI have only PR bit for falling edge. Newer ones have both. Without mentionning the STM32 code product name, answers will remain general.

SRees.2
Associate II

It's a STM32F303RE. I wonder if the HAL files are causing a problem. I may try and start an empty project and add only needed files. When I go to the graphic interface to see available interrupts it actually shows only to available, the exti15-10. I tried that one and still nothing happens.

S.Ma
Principal

Read in detail the EXTI chapter in the refmanual. Now EXTI does not generate 1 unique interrupt vector per pin, it is by group of pins. Pin 0,1,2,3 are usually 1 vector per pin, not the others... you will need to poll the PR bit to find the source.

SRees.2
Associate II

I only selected whichever interrupt I wanted with the IMR mask register. So only one pending interrupt will be triggered.