AnsweredAssumed Answered

bug report for stm32cubemx 4.25.0

Question asked by Bruno Hu on Mar 20, 2018
Latest reply on May 4, 2018 by Florin Costa

when use the stm32f103xx MCU  RTC module with HAL lib, the rtc init code generated with ll lib function.

 

the steps to replay the issue.

1) select MCU as stm32f103rct6;

2)check "Generate peripheral initialization as a pair of'.c/.h' files per peripheral" from "menu project->Code Generator->Generated files";

3) generate the source code;

4) the rtc init function in rtc.c file as below

void HAL_RTC_MspInit(RTC_HandleTypeDef* rtcHandle)
{
  if(rtcHandle->Instance==RTC)
  {
    /* USER CODE BEGIN RTC_MspInit 0 */
    /* USER CODE END RTC_MspInit 0 */
    LL_PWR_EnableBkUpAccess();
    /* Enable BKP CLK enable for backup registers */
    LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_BKP);
    /* RTC clock enable */
    __HAL_RCC_RTC_ENABLE();
    /* USER CODE BEGIN RTC_MspInit 1 */
    /* USER CODE END RTC_MspInit 1 */
  }
}

 

this two functions should been replace with 

HAL_PWR_EnableBkUpAccess();
__HAL_RCC_BKP_CLK_ENABLE();

 

otherwise, the rtc.c code can't been complied.

 

error informaton as below

Warning[Pe223]: function "LL_PWR_EnableBkUpAccess" declared implicitly D:\temp\rtc\Src\rtc.c 110
Warning[Pe223]: function "LL_APB1_GRP1_EnableClock" declared implicitly D:\temp\rtc\Src\rtc.c 112
Error[Pe020]: identifier "LL_APB1_GRP1_PERIPH_BKP" is undefined D:\temp\rtc\Src\rtc.c 112

Attachments

Outcomes