cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G431 LED Toggle Issue – LED Stays ON Until Power Cycle

Sethnittu
Visitor

I am using an STM32G431CBT6. I wrote code to toggle an LED in stm32cubeide. When I build the project in STM32G431, the LED stays permanently ON. However, when I power the board OFF and ON again, the LED starts toggling. Why is this happening?

3 REPLIES 3
bramble
Senior

Hi @Sethnittu ,

Are you sure that you have started your application execution after downloading your build? If you are running in debug mode you'll need to start execution. 

The next thing to check would be to put a breakpoint at the point where your code writes to the GPIO that is wired to the led, and step through execution.

I think there's just a basic misunderstanding about how to use CubeIDE going on here. You can find many YouTube video tutorials that may be helpful. 

Good luck!

 

Hi @bramble,

Thank you for your reply. Actually, when I power my controller device OFF and ON, the LED blinks, but when I build and run the code, it doesn’t work  it stays permanently high. Why?

waclawek.jan
Super User

Maybe it toggles to fast to see by eye. Observe using oscilloscope or logic analyzer. Single-strep code in debugger.

Post more details, include source code.

JW