cancel
Showing results for 
Search instead for 
Did you mean: 

Can't blink a LED on STM32MP157-DK2

FAuza.1
Associate III

I'm now trying to blink a LED on my STM32MP157-DK2 board.

I have managed to run and even modify the GPIO_EXTI example, but I'd like to do this from scratch.

1) I first created a project using CubeMX and wrote my code in the IDE.

It seems that I can't use the BSP_LED_*** instructions as the build gives compilation errors : why can't I build my code when using these instructions ? Do I miss an include​ ?

2) Then I tried to use the HAL_GPIO_*** instructions. This time, the build is successful, but the debug does not blink the LED.

I have seen in the manual UM2367 that the blue LED is connected to PD11, so I try this:

HAL_GPIO_TogglePin (GPIOD, GPIO_PIN_11);
	 HAL_Delay (100);  /* Insert delay 100 ms */

but it doesn't blink. What did I miss?

Thanks for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
FAuza.1
Associate III

I finally got it work. I declared the GPIO as GPIO_Output and reserved to M4

View solution in original post

4 REPLIES 4
FAuza.1
Associate III

I finally got it work. I declared the GPIO as GPIO_Output and reserved to M4

TArre.1
Associate III

how did you do it? Did you set the GPIO pin manually? I am having some problems configuring GPIO the pins.

Thank you!

FAuza.1
Associate III

Yes, I set the pins manually in CubeMX. I set the PD11 as Output (left click) and reserved it to M4 (right click). Maybe this is specific for the STM32MP1 which has 2 cores.

Then the generated code enables to use HAL_GPIO_*** instructions on that specific output

TArre.1
Associate III

I forgot to reserve it to M4. Thank you! 😉