Skip to main content
LOlhe.1
Associate
October 11, 2021
Solved

STM32L562CET6 won't enter EXTI callback function.

  • October 11, 2021
  • 12 replies
  • 5296 views

I am quiet new to STM32 programming and can't get the external interrupt to work.

I started with the NUCLEO-L011K4 and wrote my programm without any issues. I switched to my own board (pdf included) and weren't able to get extrenal interrupts to work.

I use the STM32CubeIDE 1.5.1 and the ST-Link/V2 to programm.

The goal of the code is to change the PWM outputs frequency and duty cycle with incoming 5V high signals on pin "Change" and pin "Laser_On". The Controller itself gets 3,3V.

I can see in debug mode that the Callback function isn't entered when i provide the high signals.

Am I missing some crucial code? Help is appreciated.

This topic has been closed for replies.
Best answer by LOlhe.1

..

12 replies

TDK
October 11, 2021

Code seems okay to me. Should get an interrupt when PB6 goes from low to high.

If the code works on a Nucleo but not on your custom board, check to see if there are wiring issues. Make sure the PB6 pin itself is actually seeing the levels you expect.

"If you feel a post has answered your question, please click ""Accept as Solution""."
LOlhe.1
LOlhe.1Author
Associate
October 11, 2021

I can messure the 5V directly at PB6. They are connected.

Tesla DeLorean
Guru
October 11, 2021

Check linkage of routines via .MAP and listing files.

Confirm EXTI peripheral registers in debugger, or via telemetry data. Check event flagging

Confirm GPIO registers, reflect reporting in GPIOx->IDR for pin state.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
LOlhe.1
LOlhe.1Author
Associate
October 11, 2021

I am not quiet sure how to check the linkage of the routines and listing files.

I screenshoted for the other two ideas the Live Expressions before running, while running and while running with 5V connected.

There was no difference between 5V connected or disconnected.

LOlhe.1
LOlhe.1Author
Associate
October 11, 2021

..

TDK
October 11, 2021

> I screenshoted for the other two ideas the Live Expressions before running, while running and while running with 5V connected.

Look like PB6 is high "before running" as well, so no transition, so no interrupt. What is pulling it down to 0V when the phototransistor is off?

"If you feel a post has answered your question, please click ""Accept as Solution""."
LOlhe.1
LOlhe.1Author
Associate
October 11, 2021

I already tried it with the GPIO_InitStruct.Pull = GPIO_PULLDOWN; and without but it didnt make any difference.

TDK
October 11, 2021
And did you measure 0V on the pin?
If IDR reports it as high, and the voltage is 0V, there is a hardware issue. Note that pins are not 5V tolerant if VDD is not present.
"If you feel a post has answered your question, please click ""Accept as Solution""."