2025-03-12 8:45 AM - last edited on 2025-03-12 10:19 AM by Andrew Neil
Hello,
I have a STM32L552E-EV, and I would like to know how to detect the RESET button ?
Thank you for your helps.
2025-03-12 9:47 AM
The reset button pulls down the NRST pin, which is not the one you are showing. When the button is released, the CPU will start executing code from the Reset Handler.
2025-03-12 10:17 AM
Look at the board schematics:
You can see that, as @Chris21 said, the RESET button pulls the NRST signal low.
The NRST signal is connected to the STM32's NRST pin:
So pressing the RESET button will cause a hardware reset of the STM32.
So software can't directly detect the button being pressed.
But you can detect the reason for a reset:
2025-03-12 11:05 AM
Thank you,
The button B4 is not the picture that I show before ? PB4.(PORT B, number 4). To detect a button press by interruption, we can always know in the callback when the user presses the button, Right ?
For one of my programs I just need when the user presses the RESET button
2025-03-12 11:10 AM
There is a button (switch) on the board which is labeled RESET and has a black cap. We have described what that button does.
2025-03-12 11:14 AM
@Chris21 wrote:There is a button (switch) on the board which is labeled RESET and has a black cap. We have described what that button does.
Yes I know B4 and I can see on my board so ? My question is how to detect the pressing of this button via the program, but apparently it is impossible, it is strange ? Is it really impossible ?
2025-03-12 11:19 AM
PB4 is a microcontroller pin, not a button. Do you have a button (switch) connected to PB4?
2025-03-12 11:28 AM
Following a reset (which has nothing to do with pin PB4 [NJTRST is not NRST]), the Reset Handler code executes, typically followed by SystemInit(), and then main(). Usually, if code at the start of main() is executed, a reset or power on has occurred.
2025-03-12 1:16 PM
I noticed that the schematic labels the reset button with "B4" as well as "RESET".
That may have caused some confusion. Again the button interacts with the NRST pin as described above.
2025-03-12 1:21 PM
@Chris21 wrote:PB4 is a microcontroller pin, not a button. Do you have a button (switch) connected to PB4?
Yes, I was mistaken but when I press the button, can't it be detected by software ?