74 (void)HAL_RCC_DeInit();
95 GPIO_InitTypeDef gpioInitStruct = {0};
104 gpioInitStruct.Mode = GPIO_MODE_INPUT;
105 gpioInitStruct.Pull = GPIO_PULLDOWN;
111 gpioInitStruct.Mode = GPIO_MODE_OUTPUT_PP;
112 gpioInitStruct.Pull = GPIO_NOPULL;
113 gpioInitStruct.Speed = GPIO_SPEED_FREQ_LOW;
118 gpioInitStruct.Mode = GPIO_MODE_OUTPUT_PP;
119 gpioInitStruct.Pull = GPIO_NOPULL;
120 gpioInitStruct.Speed = GPIO_SPEED_FREQ_LOW;
124 gpioInitStruct.Mode = GPIO_MODE_AF_PP;
125 gpioInitStruct.Pull = GPIO_NOPULL;
126 gpioInitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
136 gpioInitStruct.Mode = GPIO_MODE_AF_PP;
137 gpioInitStruct.Pull = GPIO_PULLUP;
138 gpioInitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
182 RCC_OscInitTypeDef rccOscInitStruct;
183 RCC_ClkInitTypeDef rccClkInitStruct;
184 RCC_PeriphCLKInitTypeDef rccPeriphClkInit;
191 rccOscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
192 rccOscInitStruct.MSIState = RCC_MSI_ON;
193 rccOscInitStruct.MSICalibrationValue = 0;
194 rccOscInitStruct.MSIClockRange = RCC_MSIRANGE_6;
195 rccOscInitStruct.PLL.PLLState = RCC_PLL_ON;
196 rccOscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_MSI;
197 rccOscInitStruct.PLL.PLLM = 1;
198 rccOscInitStruct.PLL.PLLN = 24;
199 rccOscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
200 rccOscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
201 rccOscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
202 if (HAL_RCC_OscConfig(&rccOscInitStruct) != HAL_OK)
207 rccClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK |
208 RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
209 rccClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
210 rccClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
211 rccClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
212 rccClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
214 if (HAL_RCC_ClockConfig(&rccClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
219 rccPeriphClkInit.PeriphClockSelection =
220 RCC_PERIPHCLK_SDMMC1 | RCC_PERIPHCLK_USART2;
221 rccPeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1;
222 rccPeriphClkInit.Sdmmc1ClockSelection = RCC_SDMMC1CLKSOURCE_PLLSAI1;
223 rccPeriphClkInit.PLLSAI1.PLLSAI1Source = RCC_PLLSOURCE_MSI;
224 rccPeriphClkInit.PLLSAI1.PLLSAI1M = 1;
225 rccPeriphClkInit.PLLSAI1.PLLSAI1N = 24;
226 rccPeriphClkInit.PLLSAI1.PLLSAI1P = RCC_PLLP_DIV2;
227 rccPeriphClkInit.PLLSAI1.PLLSAI1Q = RCC_PLLQ_DIV2;
228 rccPeriphClkInit.PLLSAI1.PLLSAI1R = RCC_PLLR_DIV2;
229 rccPeriphClkInit.PLLSAI1.PLLSAI1ClockOut = RCC_PLLSAI1_48M2CLK;
230 if (HAL_RCCEx_PeriphCLKConfig(&rccPeriphClkInit) != HAL_OK)
236 if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK)
This file contains the board-specific GPIO pin definitions, peripheral configurations,...
This file contains the error handling function prototypes.
void ErrorHandler(void)
This function is executed in case of error occurrence.
#define SDMMC_GPIO_D0_PORT
#define SDMMC_GPIO_D3_PORT
#define SDMMC_GPIO_D1_PIN
#define SDMMC_GPIO_D3_PIN
#define SDMMC_GPIO_D2_PORT
#define VCP_UART_GPIO_RX_PORT
#define LED_GREEN1_GPIO_PORT
#define VCP_UART_GPIO_RX_PIN
static void PinoutDeInit(void)
De-initialize all board GPIO pins and disable the GPIO port clocks.
static void SystemClockConfig(void)
Configure the system clock, PLL, and peripheral clocks.
#define SDMMC_GPIO_CLK_PORT
#define SDMMC_GPIO_CMD_PIN
#define VCP_UART_GPIO_TX_PORT
#define LED_GREEN2_GPIO_PIN
static void PinoutInit(void)
Initialize the board GPIO pinout including button, LEDs, UART, and SDMMC pins.
#define SDMMC_GPIO_CLK_PIN
#define SDMMC_GPIO_CMD_PORT
#define LED_GREEN1_GPIO_PIN
#define SDMMC_GPIO_D1_PORT
void SetVectorTableLocation(const uint32_t address)
Set the vector table location to the specified address.
void BoardDeInit(void)
De-initialize the board hardware and peripherals.
void BoardInit(void)
Initialize the board hardware and peripherals.
#define VCP_UART_GPIO_TX_PIN
#define SDMMC_GPIO_D0_PIN
#define SDMMC_GPIO_D2_PIN
#define LED_GREEN2_GPIO_PORT
void LedGreen1Off(void)
Turn off the 1st green LED (LD2).
void LedGreen2Off(void)
Turn off the 2nd green LED (LD3).
void LogDeInit(void)
De-initialize the UART peripheral used for logging.
void LogInit(void)
Initialize the UART peripheral used for logging.
void RccDisablePortD(void)
Disable the GPIO port D clock.
void RccEnablePortB(void)
Enable the GPIO port B clock.
void RccEnablePwr(void)
Enable the PWR clock.
void RccEnableSysCfg(void)
Enable the SYSCFG clock.
void RccDisablePortA(void)
Disable the GPIO port A clock.
void RccDisableSysCfg(void)
Disable the SYSCFG clock.
void RccDisablePortC(void)
Disable the GPIO port C clock.
void RccEnableFlash(void)
Enable the flash interface clock.
void RccDisableFlash(void)
Disable the flash interface clock.
void RccEnablePortA(void)
Enable the GPIO port A clock.
void RccEnablePortD(void)
Enable the GPIO port D clock.
void RccDisablePwr(void)
Disable the PWR clock.
void RccEnablePortC(void)
Enable the GPIO port C clock.
void RccDisablePortB(void)
Disable the GPIO port B clock.
void SystickDeInit(void)
De-initialize the SysTick timer.
void SystickInit(void)
Initialize the SysTick timer with a 1 ms tick period.
This file contains the LED driver function prototypes for controlling the green LEDs on the STM32L496...
This file contains the UART-based logging function prototypes for the debug output.
This file contains the RCC (Reset and Clock Control) driver function prototypes for enabling and disa...
This file contains the SysTick timer initialization and de-initialization function prototypes.