2022-09-13 03:38 AM
Hello,
I use STM32F091VC the from 4 year without problem, I have used more than 20000 STM32F091VC.
Recently, I have several STM32F091VC who have a big problem of accuracy on the clock HSI. The error is about 30% ! For exemple, the STM32F091VC give about 7000 ms instead 10000 ms in real. The maximum error for the STM32F091VC should be 1%. I have try to change the value RCC_OscInitStruct.HSICalibrationValue but this resolve not the problem.
With the shortage components, I had to change supplier for the last order. Is possible that I have received an order with faulty STM32F091VC?
Can you help me please?
Here the configuration of the clock :
void SystemClock_Config(void)
{
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSI14;
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSI14State = RCC_HSI14_ON;
RCC_OscInitStruct.HSI14CalibrationValue = 16;
RCC_OscInitStruct.HSICalibrationValue = 16;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_OFF;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct)!= HAL_OK)
{
/* Initialization Error */
while(1);
}
/* Select PLL as system clock source and configure the HCLK and PCLK1 clocks dividers */
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1);
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI ; RCC_SYSCLKSOURCE_HSI
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1)!= HAL_OK)
{
/* Initialization Error */
while(1);
}
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART3|RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_I2C1;
PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK1;
PeriphClkInit.Usart3ClockSelection = RCC_USART3CLKSOURCE_PCLK1;
PeriphClkInit.I2c1ClockSelection = RCC_I2C1CLKSOURCE_HSI;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
}
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}
2022-09-14 02:38 AM
Thanks for the analysis. I'm surprised about this drift.
If you have an old one to proceed with the same measurement it should be good.
In function of your result, I will open an internal Bugzilla ticket.
Best Regards,
Gwénolé
2022-09-14 02:39 AM
I have just tried with an old mcu buy in 2021 from another provider. It seems ok, 8 MHz ! Of course, I am using exactly the same code to test the mcu.
An idea why some mcu have a defect clock ?
2022-09-14 02:48 AM
Hello @Nikita91,
The code is right :) This line compute the prescaler to get 10kHz as counter frequency. Then, 800 is not the the clock frequency but the prescaler value. That means 8000000/(PRESC+1) = 8000000/(799+1) = 10kHz.
Best Regards,
Gwénolé
2022-09-14 02:49 AM
Can you join a picture of each MCU? And if possible the sales type.
I will indicate the manufacturing location.
Best Regards,
Gwénolé
2022-09-14 03:32 AM
Please find the both pictures, I hope you could read them. I have only my phone for photo today, but tomorrow, it will be possible for me with a microscope.
Correct MCU :
STM32F091VCT6 A
7B754 93
PHL 7B 115
Defect MCU :
STM32F091VCT6
992NX 93
MYS 99 146 A
2022-09-14 05:16 AM
Quality is good :)
I have to check some information internally, I will probably ask to get some data soon.
Normally this kind of drift is scraped in production.
BR,
Gwénolé
2022-09-14 05:34 AM
Thanks for your help and feedback. Just a question, the defects mcu could be recalibrated at your factory in this case?
BR
Arnaud
2022-09-14 07:04 AM
Dear @Arnaud,
"Internal ticket number: 134635 (This is an internal tracking number and is not accessible or usable by customers) has been created."
Best Regards,
Gwénolé