AnsweredAssumed Answered

[BUG]STM32CubeMX STM32F1 FW. 1.6.0 LSI_VALUE undeclared

Question asked by marton.miklos on Aug 8, 2017
Latest reply on Mar 15, 2018 by Gene Kozin

I have just updated one of my projects to STM32F1 FW 1.6.0, and my code was not able to compiled anymore. IOC file attached.

 

Here is my clocking scheme:

 

As you can see the LSI oscillator is not used, so I assume this is why the LSI_VALUE is not generated to the stm32f1xx_hal_rcc.h file. However the LSI_VALUE constant is still used in the stm32f1xx_hal_rcc_ex.c:

 

 case RCC_PERIPHCLK_RTC:  
    {
      /* Get RCC BDCR configuration ------------------------------------------------------*/
      temp_reg = RCC->BDCR;

      /* Check if LSE is ready if RTC clock selection is LSE */
      if (((temp_reg & RCC_BDCR_RTCSEL) == RCC_RTCCLKSOURCE_LSE) && (HAL_IS_BIT_SET(temp_reg, RCC_BDCR_LSERDY)))
      {
        frequency = LSE_VALUE;
      }
      /* Check if LSI is ready if RTC clock selection is LSI */
      else if (((temp_reg & RCC_BDCR_RTCSEL) == RCC_RTCCLKSOURCE_LSI) && (HAL_IS_BIT_SET(RCC->CSR, RCC_CSR_LSIRDY)))
      {
        frequency = LSI_VALUE;
      }
      else if (((temp_reg & RCC_BDCR_RTCSEL) == RCC_RTCCLKSOURCE_HSE_DIV128) && (HAL_IS_BIT_SET(RCC->CR, RCC_CR_HSERDY)))
      {
        frequency = HSE_VALUE / 128U;
      }
      /* Clock not enabled for RTC*/
      else
      {
        frequency = 0U;
      }
      break;

Outcomes