cancel
Showing results for 
Search instead for 
Did you mean: 

MX_GPIO_Init() is generated but not called in main(). STM32CubeMX6.4.0 with STM32H755XI

Lzhou.1
Associate

Environment:

tool: STM32CubeMX6.4.0 

cpu: STM32H755XI

Repos: STM32Cube_FW_H7_V1.9.1

I configured pins as GPIO input/output by STM32CubeMX GUI. MAX_GPIO_Init() is auto-generated and all pins are configured inside. However it is not called by any function. Usually it will be called in main().

Below is the auto-gernerated main() function code. MAX_GPIO_Init() is missed. Is it a abnormal case?

My ioc file for this case is also attached.

Thanks.

int main(void)

{

 /* USER CODE BEGIN 1 */

 /* USER CODE END 1 */

/* USER CODE BEGIN Boot_Mode_Sequence_0 */

 int32_t timeout;

/* USER CODE END Boot_Mode_Sequence_0 */

 /* Enable I-Cache---------------------------------------------------------*/

 SCB_EnableICache();

 /* Enable D-Cache---------------------------------------------------------*/

 SCB_EnableDCache();

/* USER CODE BEGIN Boot_Mode_Sequence_1 */

 /* Wait until CPU2 boots and enters in stop mode or timeout*/

 timeout = 0xFFFF;

 while((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) != RESET) && (timeout-- > 0));

 if ( timeout < 0 )

 {

 Error_Handler();

 }

/* USER CODE END Boot_Mode_Sequence_1 */

 /* MCU Configuration--------------------------------------------------------*/

 /* Reset of all peripherals, Initializes the Flash interface and the Systick. */

 HAL_Init();

 /* USER CODE BEGIN Init */

 /* USER CODE END Init */

 /* Configure the system clock */

 SystemClock_Config();

/* USER CODE BEGIN Boot_Mode_Sequence_2 */

/* When system initialization is finished, Cortex-M7 will release Cortex-M4 by means of

HSEM notification */

/*HW semaphore Clock enable*/

__HAL_RCC_HSEM_CLK_ENABLE();

/*Take HSEM */

HAL_HSEM_FastTake(HSEM_ID_0);

/*Release HSEM in order to notify the CPU2(CM4)*/

HAL_HSEM_Release(HSEM_ID_0,0);

/* wait until CPU2 wakes up from stop mode */

timeout = 0xFFFF;

while((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) == RESET) && (timeout-- > 0));

if ( timeout < 0 )

{

Error_Handler();

}

/* USER CODE END Boot_Mode_Sequence_2 */

 /* USER CODE BEGIN SysInit */

 /* USER CODE END SysInit */

 /* Initialize all configured peripherals */

 MX_DMA_Init();

 MX_UART7_Init();

 MX_RTC_Init();

 MX_MDMA_Init();

 MX_QUADSPI_Init();

 MX_I2C2_Init();

 MX_SDMMC1_MMC_Init();

 MX_TIM5_Init();

 MX_UART8_Init();

 MX_DAC1_Init();

 MX_SAI1_Init();

 MX_SPI4_Init();

 MX_SPI5_Init();

 MX_UART4_Init();

 MX_RNG_Init();

 /* USER CODE BEGIN 2 */

 /* USER CODE END 2 */

 /* Init scheduler */

 osKernelInitialize(); /* Call init function for freertos objects (in freertos.c) */

 MX_FREERTOS_Init();

 /* Start scheduler */

 osKernelStart();

 /* We should never get here as control is now taken by the scheduler */

 /* Infinite loop */

 /* USER CODE BEGIN WHILE */

 while (1)

 {

  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

 }

 /* USER CODE END 3 */

}

1 ACCEPTED SOLUTION

Accepted Solutions
Sara BEN HADJ YAHYA
ST Employee

Hello @Lzhou.1​ ,

Thanks for your feedback,

It seems that you checked the " Do not Generate Function Call " in your CubeMX configuration.

Could you please uncheck it and check the visibility field instead, just like the attachment below.

0693W00000JOyNOQA1.pngI hope this helps 🙂 !

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly 🙂

Sara.

View solution in original post

2 REPLIES 2
Sara BEN HADJ YAHYA
ST Employee

Hello @Lzhou.1​ ,

Thanks for your feedback,

It seems that you checked the " Do not Generate Function Call " in your CubeMX configuration.

Could you please uncheck it and check the visibility field instead, just like the attachment below.

0693W00000JOyNOQA1.pngI hope this helps 🙂 !

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly 🙂

Sara.

Yes, it works, thank you very much!