cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get STM32MP157C-DK2 LED 7 flashing from STM32

AStev.2
Associate III

Trying and failing to toggle LED 7 of the STM32MP157C-DK2 from the STM32. The IOC file indicates that PH7 is configured as GPIO. The mode is Output Push Pull, the GPIO Pull-up/Pull-down state is No pull-up and no-pull-down. The Maximum output speed is Low. I have added the following lines to the following lines to main.c:

while (1)

{

HAL_GPIO_TogglePin(GPIOH, GPIO_PIN_7);

HAL_Delay(1000);

  /* USER CODE END WHILE */

The code is executing but the LED is not changing state. I looked in the MX_GPIO_Init() on the STM32 side and there appears to be no code to setup the GPIO port:

static void MX_GPIO_Init(void)

{

 /* GPIO Ports Clock Enable */

 __HAL_RCC_GPIOC_CLK_ENABLE();

 __HAL_RCC_GPIOH_CLK_ENABLE();

}

I looked in the CA7 side at the kernel dts file and could find no reference to GPIO H7. From what I read in the documentation I thought the STM32CubeIDE was supposed to generate the setup code for this port. I am using the OpenSTL v2.0.0 Starter Kit image.

Does anyone have any clue how to resolve this problem?

This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
PatrickF
ST Employee

For pure GPIOs (i.e. not assigned to a functional IP), you should assign to Cortex-M4 using right-click:

0693W000004KHEuQAO.png

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
NEW ! Sidekick STM32 AI agent, see here

View solution in original post

2 REPLIES 2
AStev.2
Associate III

The LED works if I manually add the required code (below), so now I am wondering why the IDE is not generating this for me - it used to do this with the standalone CubeMX:

    GPIO_InitTypeDef GPIO_InitStruct;

   GPIO_InitStruct.Pin = GPIO_PIN_7;

   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

   GPIO_InitStruct.Pull = GPIO_PULLUP;

   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

   HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);

PatrickF
ST Employee

For pure GPIOs (i.e. not assigned to a functional IP), you should assign to Cortex-M4 using right-click:

0693W000004KHEuQAO.png

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
NEW ! Sidekick STM32 AI agent, see here