Skip to main content
Jshelson
Associate II
January 18, 2023
Question

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.

  • January 18, 2023
  • 1 reply
  • 1972 views

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.

This topic has been closed for replies.

1 reply

Amel NASRI
Technical Moderator
February 10, 2023

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.
Jshelson
JshelsonAuthor
Associate II
February 17, 2023

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

Amel NASRI
Technical Moderator
February 21, 2023

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.