@@ -272,24 +272,25 @@ static void clock_pll_off(void)
272272
273273}
274274
275- /*This implementation will setup MSI 48 MHz as PLL Source Mux, PLLCLK as System Clock Source*/
275+ /* If PLL_SRC_HSE is set then HSE (8MHz) is used otherwise HSI 64 MHz is used
276+ * and system clock is 250MHz */
276277
277278static void clock_pll_on (void )
278279{
279280 uint32_t reg32 ;
280281 uint32_t plln , pllm , pllq , pllp , pllr , hpre , apb1pre , apb2pre , apb3pre , flash_waitstates ;
281282
282283#if PLL_SRC_HSE
283- pllm = 4 ;
284- plln = 250 ;
285- pllp = 2 ;
286- pllq = 2 ;
284+ pllm = 1 ;
285+ plln = 62 ;
286+ pllp = 2 ; /* 250Mhz */
287+ pllq = 5 ; /* 100Mhz */
287288 pllr = 2 ;
288289#else
289- pllm = 1 ;
290- plln = 129 ;
290+ pllm = 4 ;
291+ plln = 31 ;
291292 pllp = 2 ;
292- pllq = 2 ;
293+ pllq = 5 ;
293294 pllr = 2 ;
294295#endif
295296 flash_waitstates = 5 ;
@@ -432,8 +433,8 @@ static void periph_unsecure(void)
432433 volatile uint32_t * nvic_itns ;
433434 uint32_t nvic_reg_pos , nvic_reg_off ;
434435
435- /*Enable clock for User LED GPIOs */
436- RCC_AHB2_CLOCK_ER |= LED_AHB2_ENABLE ;
436+ /* Enable clock for User LED GPIOs */
437+ RCC_AHB2_CLOCK_ER |= LED_AHB2_ENABLE ;
437438
438439 /* Enable GPIO clock for accessing SECCFGR registers */
439440 RCC_AHB2_CLOCK_ER |= GPIOA_AHB2_CLOCK_ER ;
@@ -449,10 +450,10 @@ static void periph_unsecure(void)
449450
450451
451452 PWR_CR2 |= PWR_CR2_IOSV ;
452- /*Un-secure User LED GPIO pins */
453- GPIO_SECCFGR (GPIOG_BASE ) &= ~(1 << 4 );
454- GPIO_SECCFGR (GPIOB_BASE ) &= ~(1 << 0 );
455- GPIO_SECCFGR (GPIOF_BASE ) &= ~(1 << 4 );
453+ /* Un-secure User LED GPIO pins */
454+ GPIO_SECCFGR (GPIOG_BASE ) &= ~(1 << LED_BOOT_PIN ); /* PG4 - Nucleo board - Orange Led */
455+ GPIO_SECCFGR (GPIOB_BASE ) &= ~(1 << LED_USR_PIN ); /* PB0 - Nucleo board - Green Led */
456+ GPIO_SECCFGR (GPIOF_BASE ) &= ~(1 << LED_EXTRA_PIN ); /* PF4 - Nucleo board - Blue Led */
456457
457458 /* Unsecure LPUART1 */
458459 GPIO_SECCFGR (GPIOB_BASE ) &= ~(1 <<UART1_TX_PIN );
@@ -478,17 +479,6 @@ static void periph_unsecure(void)
478479 nvic_reg_off = NVIC_USART3_IRQ % 32 ;
479480 nvic_itns = ((volatile uint32_t * )(NVIC_ITNS_BASE + 4 * nvic_reg_pos ));
480481 * nvic_itns |= (1 << nvic_reg_off );
481-
482-
483- /* Disable GPIOs clock used previously for accessing SECCFGR registers */
484- #if 0
485- RCC_AHB2_CLOCK_ER &= ~GPIOA_AHB2_CLOCK_ER ;
486- RCC_AHB2_CLOCK_ER &= ~GPIOB_AHB2_CLOCK_ER ;
487- RCC_AHB2_CLOCK_ER &= ~GPIOC_AHB2_CLOCK_ER ;
488- RCC_AHB2_CLOCK_ER &= ~GPIOD_AHB2_CLOCK_ER ;
489- #endif
490-
491-
492482}
493483#endif
494484
0 commit comments