AnsweredAssumed Answered

STM32L452CEU6 HSI Problem

Question asked by riggs.rob on Jun 3, 2017
Latest reply on Oct 16, 2017 by Hayden Dekker

I have a board which was designed to use the STM32L433CCU6 and am attempting to use it with an STM32L452CEU6.  The board works perfectly fine with the 433, but I am struggling a bit with the 452.  The problem I was facing is that I am attempting (and failing) to use the HSI as the clock source for LPUART1.  The UART was transmitting but not being understood, and reporting errors when attempting to read.

 

After a bit of work, I have it working fine with the PCLK1 (via HSE/PLL) at 38400bps, but I need to operate at 9600bps.   This cannot be done with an 80MHz clock.

 

In order to see what was going on, I connected HSI to MCO and measured the frequency.  At an ambient temperature of 21C, the HSI on one MCU is running at 13.89MHz and another at 14.29MHz.  That seems excessively out of spec to me.  Doing some digging, it appears that the HSI is not being calibrated properly.

 

I am using STMCubeMX 4.20.1 and the 1.7.0 version of the L4 library to initialize the RCC. 

 

This is the code that is generated for the calibration for both the 433 and 452:

 RCC_OscInitStruct.HSICalibrationValue = 16;

This is the code that works:

 RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;

It seems that the proper calibration values are different for the two and the Cube doesn't know that. 

Outcomes