AnsweredAssumed Answered

STM32Cube_FW_F4 HAL_RCC_OscConfig does not change HSI calibration

Question asked by Dan K. on May 25, 2014
Latest reply on May 29, 2014 by Montassar BEN ROMDHANE
On the NUCLEO-F401RE, using the SystemClock_Config() funtion from the STM32F4xx-Nucleo template from the following file:
 STM32Cube_FW_F4_V1.1.0\Projects\STM32F4xx-Nucleo\Templates\Src\main.c
I cannot get the HSI calibration trim value to change with the value in the following line (line 125):
  RCC_OscInitStruct.HSICalibrationValue = 16;

I have tried all values from 0 to 31 and the actual HSI does not change, as determined by reading the RCC->CR and measuring the baud rate on the output from the USART2 Tx pin.

However, after the MCU initialization is complete, if I attempt to change the HSI calibration trim using the __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST() macro, I can successfully change the HSI clock rate, again as determined by reading the RCC->CR and measuring the baud rate on the output from the USART2 Tx pin.

Is it possible the PLL configuation changes made later after the __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST() macro call in HAL_RCC_OscConfig() function in stm32f4xx_hal_rcc.c affect the HSI calibration trim setting? It appears the HSI calibration trim is always being set to 16, the same as the value in the template.

NUCLEO-F401RE
STM32F401RE
CPU ID: 0x410fc241
        Implementer : 0x41
        Variant     : 0x0
        Constant    : 0xf
        PartNo      : 0xc24
        Revision    : 0x1
MCU ID: 0x10006433
        Revision : 0x1000
        Device   : 0x433
HAL Version: 0x01000000
CMSIS Version: 0x02000000

Outcomes