Skip to main content
Visitor II
July 31, 2025
Solved

LED Blinks Automatically on Nucleo-H755ZI-Q Instead of Waiting for User Button Press

  • July 31, 2025
  • 3 replies
  • 405 views

Hi all! I'm using the Nucleo-H755ZI-Q board and trying to write a simple program where the LED should turn on (and stay on) only when I press the USER button (the blue one on the board). I’ve shared a screenshot of my code below. The code builds and debugs without any errors, but when I run it, the LED just starts blinking on its own... even when I haven’t pressed the button. What’s more interesting is that when I stop the program in the IDE, the LED keeps blinking, and it only stops if I enter debug mode again. I expected the LED to stay off by default and turn on steadily only when the button is pressed. Also, after flashing and starting debug, I only see a "Resume" button instead of "Run"... Not sure if that means something’s wrong or if it’s normal. Any help figuring this out would be great!
my programmy program

    This topic has been closed for replies.
    Best answer by TDK

    Might want to erase the chip so any CM4 firmware isn't active.

    3 replies

    Super User
    July 31, 2025

    > the LED just starts blinking on its own

    Which LED?

    This is a dual core device, what is the CM4 core doing?

    Hit pause and see where execution is at. Set a breakpoint within the if statement to see if it gets hit.

     

    arvind014Author
    Visitor II
    July 31, 2025

    Hi,
    I'm trying to turn on the LD1 LED on the NUCLEO board, which is on pin PB0 according to the .ioc file. The CM4 core doesn't seem to be doing anything. I assumed that just writing code for the CM7 core would be enough. When I click "Pause" during debugging, it either stops in the STM32H7xx_hal_gpio.c file or inside the while(1) loop in main.c of the CM7 core. (The while(1) code is in the screenshot I shared in the original post.)

    I also have another question: under the Board Project Options, should I select or unselect the User LEDs and Buttons? I assumed that selecting them is necessary in order to use them.

    Screenshot (19).png

    I also tried using break point in while(1) to see if that will do any difference but no the LED just blinks and it doesnt stop

    TDKAnswer
    Super User
    July 31, 2025

    Might want to erase the chip so any CM4 firmware isn't active.

    arvind014Author
    Visitor II
    August 1, 2025

    Thanks for the suggestion! I wasn’t exactly sure what you meant by “erase the chip so any CM4 firmware isn’t active,” so I tried a few things:

    1. First, I commented out all the code in the CM4 main.c file, then built and ran only the CM7 project. But the LED still blinked on its own.

    2. Then in the CM7 main.c, I found this line:

      HAL_HSEM_Release(HSEM_ID_0,0); /*Release HSEM in order to notify the CPU2(CM4)*/

      which wakes up CM4. I commented out just this line and ran the code again. This time, the LED didn’t blink at all — not even when I pressed the USER button. So it seemed like nothing was working. Found it interesting though

    3. Finally, I deleted the CM4 project completely and ran just the CM7 part again, but that didn’t help either.

    So I’m not sure what else to try...

    Super User
    August 1, 2025

    It sounds like you got it, but doing a full chip erase in STM32CubeProgrammer will erase all code on there, both CM7 and CM4.