cancel
Showing results for 
Search instead for 
Did you mean: 

Need help to blink LED with STM32F2

NSirm.1
Associate III

Hello all i am trying to implement a simple thing that is trying to blink LED using a function. Below attached are main.c, project.c and project.h. If i try the same thing without using a function it works fine but if i use the function it doesnot blink.

2 REPLIES 2
Imen.D
ST Employee

Hello @NSirm.1​ ,

You should check your GPIO configuration. Did you start the GPIO Clock ?

I recommend you to follow step by step tutorial that can help you to blink a led on your board.

You can also review the example within STM32CubeF2: STM32Cube_FW_F2_V1.9.2\Projects\NUCLEO-F207ZG\Examples\GPIO\GPIO_IOToggle. This sample code shows how to initialize and use GPIO HAL API to toggle LED1, LED2, LED3 and LED4 IOs.

STM32CubeF2/Projects/NUCLEO-F207ZG/Examples/GPIO/GPIO_IOToggle/Src/main.c

I hope that this brings some help.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Posting code snippets using the </> button, rather than screen shots

Don't break out the while() loop, no need for void there, consider toggling the LED so you can actually scope the pin. Add a delay so it would be visible to the eye.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..