Skip to main content
FAuza.1
Associate II
October 6, 2022
Solved

Can't blink a LED on STM32MP157-DK2

  • October 6, 2022
  • 4 replies
  • 2630 views

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.

This topic has been closed for replies.
Best answer by FAuza.1

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

4 replies

FAuza.1
FAuza.1AuthorBest answer
Associate II
October 7, 2022

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

TArre.1
Associate III
October 10, 2022

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
FAuza.1Author
Associate II
October 10, 2022

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
October 10, 2022

I forgot to reserve it to M4. Thank you! ;)