2020-10-16 04:22 PM
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?
Solved! Go to Solution.
2020-10-19 07:52 AM
For pure GPIOs (i.e. not assigned to a functional IP), you should assign to Cortex-M4 using right-click:
2020-10-16 04:41 PM
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);
2020-10-19 07:52 AM
For pure GPIOs (i.e. not assigned to a functional IP), you should assign to Cortex-M4 using right-click: