2021-07-14 05:53 AM
I have setup UART1 clocked with HSI clock, with drivers version 1.16
Which led to incorrect output on the line.
Same code with drivers version 1.14 worked completely fine. See picture.
Turns out HSI trimming value is not correct in clock setup
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
/** Initializes the CPU, AHB and APB busses clocks
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
/* RCC_HSICALIBRATION_DEFAULT seems to be wrong */
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/** Initializes the CPU, AHB and APB busses clocks
*/
in different versions of drivers it is hardcoded to different value:
v 1.14 - 0x10u
v 1.16 - 0x40u
Also, when I entered debug mode and checked actual value in the register, in first case it was the same, but in second case it was 0, instead of 0x40u.
Substituting value manually to 0x10u solved the issue.
Please, check it.
Solved! Go to Solution.
2021-07-14 06:27 AM
Sadly, this is a longstanding issue that was introduced in July 2020 and still persists a year later. What's worse is the older version of HAL worked correctly in this regard.
2021-07-14 06:27 AM
Sadly, this is a longstanding issue that was introduced in July 2020 and still persists a year later. What's worse is the older version of HAL worked correctly in this regard.