cancel
Showing results for 
Search instead for 
Did you mean: 

STM32N6 CubeMX I3C2 GPIO Configuration code missing from application context

Tuomas95
Associate

Hello,

With CubeMX version 6.16.0 and FW package version STM32Cube FW_N6 V1.3.0, the GPIO configuration's are missing from the generated HAL_I3C_MspInit and HAL_I3C_MspDeInit functions in stm32n6xx_hal_msp.c, when I3C is set to application context.

Application context stm32n6xx_hal_msp.c

/**
  * @brief I3C MSP Initialization
  * This function configures the hardware resources used in this example
  * @PAram hi3c: I3C handle pointer
  * @retval None
  */
void HAL_I3C_MspInit(I3C_HandleTypeDef* hi3c)
{
  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
  if(hi3c->Instance==I3C2)
  {
    /* USER CODE BEGIN I3C2_MspInit 0 */

    /* USER CODE END I3C2_MspInit 0 */

  /** Initializes the peripherals clock
  */
    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I3C2;
    PeriphClkInitStruct.I3c2ClockSelection = RCC_I3C2CLKSOURCE_CLKP;
    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
    {
      Error_Handler();
    }

    /* Peripheral clock enable */
    __HAL_RCC_I3C2_CLK_ENABLE();
    /* USER CODE BEGIN I3C2_MspInit 1 */

    /* USER CODE END I3C2_MspInit 1 */

  }

}

 FSBL context stm32n6xx_hal_msp.c

/**
  * @brief I3C MSP Initialization
  * This function configures the hardware resources used in this example
  * @PAram hi3c: I3C handle pointer
  * @retval None
  */
void HAL_I3C_MspInit(I3C_HandleTypeDef* hi3c)
{
  GPIO_InitTypeDef GPIO_InitStruct = {0};
  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
  if(hi3c->Instance==I3C2)
  {
    /* USER CODE BEGIN I3C2_MspInit 0 */

    /* USER CODE END I3C2_MspInit 0 */

  /** Initializes the peripherals clock
  */
    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I3C2;
    PeriphClkInitStruct.I3c2ClockSelection = RCC_I3C2CLKSOURCE_CLKP;
    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
    {
      Error_Handler();
    }

    /* Peripheral clock enable */
    __HAL_RCC_I3C2_CLK_ENABLE();

    __HAL_RCC_GPIOB_CLK_ENABLE();
    /**I3C2 GPIO Configuration
    PB11     ------> I3C2_SDA
    PB10     ------> I3C2_SCL
    */
    GPIO_InitStruct.Pin = CAM_I3C2_SDA_Pin|CAM_I3C2_SCL_Pin;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_PULLUP;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF2_I3C2;
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

    /* USER CODE BEGIN I3C2_MspInit 1 */

    /* USER CODE END I3C2_MspInit 1 */

  }

}

 

1 REPLY 1
Mahmoud Ben Romdhane
ST Employee

Hello @Tuomas95 

 

Let me thank you for posting.

For more investigation, I suggest that you provide your Ioc.File.

 

Thanks.

Mahmoud

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.