/** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * * Copyright (c) 2023 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ #include "main.h" static void Init(void); /** * @brief The application entry point. * @retval int */ int boot(void) { /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_SYSCFG); LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR); Init(); LL_GPIO_ResetOutputPin(GPIOA, LL_GPIO_PIN_3); LL_mDelay(100); LL_GPIO_SetOutputPin(GPIOA, LL_GPIO_PIN_3); /* Infinite loop */ while (1) { } } static void Init(void) { LL_FLASH_SetLatency(LL_FLASH_LATENCY_1); while (LL_FLASH_GetLatency() != LL_FLASH_LATENCY_1) { } LL_RCC_HSI_Enable(); /* Wait till HSI is ready */ while (LL_RCC_HSI_IsReady() != 1) { } LL_RCC_HSI_SetCalibTrimming(16); LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSI_DIV_2, LL_RCC_PLL_MUL_12); LL_RCC_PLL_Enable(); /* Wait till PLL is ready */ while (LL_RCC_PLL_IsReady() != 1) { } LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1); LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL); /* Wait till System clock is ready */ while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) { } LL_Init1msTick(48000000); LL_SetSystemCoreClock(48000000); LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; /* GPIO Ports Clock Enable */ LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA); /**/ LL_GPIO_ResetOutputPin(GPIOA, LL_GPIO_PIN_3); /**/ GPIO_InitStruct.Pin = LL_GPIO_PIN_3; GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; LL_GPIO_Init(GPIOA, &GPIO_InitStruct); } void Error_Handler(void) { /* User can add his own implementation to report the HAL error return state */ __disable_irq(); while (1) { } }