cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube_FW_F4 HAL_RCC_OscConfig does not change HSI calibration

dlkeng
Associate III
Posted on May 25, 2014 at 05:11

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

#hsi #rcc #cubef4 #stm32cubef4-nucleo #hal
1 REPLY 1
Posted on May 29, 2014 at 11:33

Hi,

A limitation on the STM32CubeF4 HAL RCC driver is already reported consists in calibrating the HSI oscillator when it is used as system clock without stopping it, which is not allowed using the current F4 HAL RCC driver because we need to switch the system clock to another source to allow the HSI oscillator calibration.

This feature will be implemented in next HAL version planned early July.

With regards.