stm32l476disco: fix uninitialized filed usage
Field PLLState was not initialized in RCC_OscInitStruct.PLL in function SystemClock_Config(). Value is used in HAL_RCC_OscConfig() regardless of oscillator. In lucky case value would be 0 RCC_PLL_NONE and nothing would happen. If value was incorrect following line would end up in assert: assert_param(IS_RCC_PLL(RCC_OscInitStruct->PLL.PLLState)); If value was valid but no RCC_PLL_NONE pll could be configured with some other random values. Setting PLLState to RCC_PLL_NONE eliminates potential problem.
This commit is contained in:
		@@ -86,9 +86,10 @@ static void SystemClock_Config(void)
 | 
				
			|||||||
  RCC_OscInitTypeDef RCC_OscInitStruct;
 | 
					  RCC_OscInitTypeDef RCC_OscInitStruct;
 | 
				
			||||||
  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
 | 
					  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* Enable the LSE Oscilator */
 | 
					  /* Enable the LSE Oscillator */
 | 
				
			||||||
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
 | 
					  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
 | 
				
			||||||
  RCC_OscInitStruct.LSEState = RCC_LSE_ON;
 | 
					  RCC_OscInitStruct.LSEState = RCC_LSE_ON;
 | 
				
			||||||
 | 
					  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
 | 
				
			||||||
  HAL_RCC_OscConfig(&RCC_OscInitStruct);
 | 
					  HAL_RCC_OscConfig(&RCC_OscInitStruct);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* Enable the CSS interrupt in case LSE signal is corrupted or not present */
 | 
					  /* Enable the CSS interrupt in case LSE signal is corrupted or not present */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user