cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_RTC_MSPInit generated code fails assert_params check in gpio initialization when "Generate peripheral initialization as a pair of .c/.h filer per peripheral" project option selected and PC13 is configured as RTC_OUT_CALIB.

Jshelson
Associate II

The generated code in rtc.c passes zeros in GPIO_InitStruct to HAL_GPIO_Init, causing assert_param(IS_GPIO_PIN_AVAILABLE(GPIOx, (GPIO_Init->Pin))); to fail.

void HAL_RTC_MspInit(RTC_HandleTypeDef* rtcHandle)
{
 
  GPIO_InitTypeDef GPIO_InitStruct = {0};
  if(rtcHandle->Instance==RTC)
  {
  /* USER CODE BEGIN RTC_MspInit 0 */
 
  /* USER CODE END RTC_MspInit 0 */
    /* RTC clock enable */
    __HAL_RCC_RTC_ENABLE();
 
    __HAL_RCC_GPIOC_CLK_ENABLE();
    /**RTC GPIO Configuration
    PC13     ------> RTC_OUT_CALIB
    */
    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
  /* USER CODE BEGIN RTC_MspInit 1 */
 
  /* USER CODE END RTC_MspInit 1 */
  }
}

Project settings:

STM32L071RBtx processor

Generate peripheral initialization as a pair of .c/.h files

Enable Full Assert checked

Firmware Package Name and Version: STM32Cube FW_L0 V1.12.1

Version 6.6.1 of STM32CubeMX

RTC Settings:

Activate Clock Source checked

Calibration set to "Calibration 1Hz"

PC13 configured as RTC_OUT_CALIB.

5 REPLIES 5
Amel NASRI
ST Employee

Hi @Jshelson​ ,

Sorry for delay to answer your request.

Please note that there is currently a new version of STM32CubeMX tool available (6.7.0).

Could you please make sure first to be aligned with last updates then let me know if described issue is still being faced?

Thanks.

-Amel

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.

I just tried again with the latest version of STM32CubeMX and the issue is still present.

Hello @Jshelson​ ,

Thanks for coming back and providing your answer.

As issue persists with latest STM32CubeMX version, I let our expert @Semer CHERNI​ review it deeply and take relevant corrective action.

-Amel

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.

Hi Amel,

Do you have an update on this? Was @Semer CHERNI​ able to reproduce the issue?

Hi @Amel NASRI​,

Do you have any progress to share on this issue?