File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
targets/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/device Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -377,10 +377,8 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
377
377
RCC_OscInitStruct .HSEState = RCC_HSE_BYPASS ; /* External 8 MHz clock on OSC_IN */
378
378
}
379
379
RCC_OscInitStruct .HSIState = RCC_HSI_OFF ;
380
- #if !defined (STM32L031xx ) && !defined (STM32L041xx ) && !defined(STM32L051xx ) && !defined(STM32L061xx ) && !defined(STM32L071xx ) && !defined(STM32L081xx ) && \
381
- !defined (STM32L011xx ) && !defined (STM32L021xx )
382
380
RCC_OscInitStruct .HSI48State = RCC_HSI48_ON ; /* For USB and RNG clock */
383
- #endif
381
+
384
382
// PLLCLK = (8 MHz * 8)/2 = 32 MHz
385
383
RCC_OscInitStruct .PLL .PLLState = RCC_PLL_ON ;
386
384
RCC_OscInitStruct .PLL .PLLSource = RCC_PLLSOURCE_HSE ;
@@ -391,6 +389,12 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
391
389
return 0 ; // FAIL
392
390
}
393
391
392
+ /* Select HSI48 as USB clock source */
393
+ RCC_PeriphCLKInitTypeDef PeriphClkInitStruct ;
394
+ PeriphClkInitStruct .PeriphClockSelection = RCC_PERIPHCLK_USB ;
395
+ PeriphClkInitStruct .UsbClockSelection = RCC_USBCLKSOURCE_HSI48 ;
396
+ HAL_RCCEx_PeriphCLKConfig (& PeriphClkInitStruct );
397
+
394
398
/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */
395
399
RCC_ClkInitStruct .ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2 );
396
400
RCC_ClkInitStruct .SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK ; // 32 MHz
You can’t perform that action at this time.
0 commit comments