2017-03-22 02:46 PM
Hi,
I'd like to report a potential bug in the code generation / clock initialisation code for the STM32F103c8t6.
Cube version 4.2
STM32CubeF1 Release 1.4.0
Keil uVision 5.22
I have attached the very simple project and cube file. The line that fails is 339 in stm32f1xx_hal_rcc.c
I am not using HSI as a system clock.
Any help most appreciated.
2017-03-23 02:33 AM
Hello Glen,
this is a bug I found it yesterday too. Go to your main.c file and removeRCC_OSCILLATORTYPE_HSI on line 133.
This happens if you have setup HSI clock first, export project and later setup HSE clock as source.
Why it fails?
Because configuration for HSIState and HSICalibrationValue are missing now (removed from CubeMX generation tool) and have unknown value and assert_param goes to assert_failed function. When you removeRCC_OSCILLATORTYPE_HSI from first line, configuration won't try to init HSI clock.
How to reproduce the bug:
First code export
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON; //HSI State is here
RCC_OscInitStruct.HSICalibrationValue = 0; //HSI calibration value is here
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = 16;
RCC_OscInitStruct.PLL.PLLN = 432;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 2;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}�?�?�?�?�?�?�?�?�?�?�?�?�?
Second code export
//HSI is still here for oscillator type, but there are missing important HSI parameters
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE;
//missing here
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 25;
RCC_OscInitStruct.PLL.PLLN = 432;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 2;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
//First line should be
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
2017-03-23 03:44 AM
Hello,
Please note that this is a confirmed CubeMX bug which will be fixed in a patch to be delivered soon.
Sorry for such inconvenience.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2017-03-23 05:11 AM
Fantastic, thanks for the comprehensive reply.
Cheers
Glen.
2017-03-23 05:48 AM
Hi Amel,
Is the list of known issues with CubeMX available to view?
Cheers
Glen.
2017-03-23 06:23 AM
Hi Glen,
Unfortunately, no list currently available.
I raise this request -again- internally.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2017-03-23 06:32 AM
I second the motion. RELEASE NOTES is sorely needed.
2017-04-20 02:51 AM
Hello
glenc
,If you aren't already aware, this regression bug is fixed and a patch is delivered end of March (CubeMX v4.1).
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.