wb_ledblink
1) 建立空项目以后System Core:
RCC->High Speed Clock(HSE):Crystal
SYS->SerialWire
2) Pinout View
PC13->GPIO_Output
3)Clock Configuration
PLL Source Mux->HSE; PLLMul->9
System Clock Mux->PLLCLK; APB1 Prescaler->2
4) SAVE,generate Code
5) main.c
while (1)
{
/* USER CODE END WHILE */
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);
HAL_Delay(500);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET);
HAL_Delay(500);
/* USER CODE BEGIN 3 */
}
6)编译运行产生的错误

菜单-> run->run configuration->wb_ledblink_Debug->Debugger
勾选ST-LINK S/N
SCAN得到S/N号,(如果找不到,需要重新安装ST-LINK的驱动)
如果更换ST-LINK V2,要删掉wb_ledblink_Debug,再双击STM32_Cortex-M C/C++ Aplication,以产生新的配置
->Apply->run
7)另一个问题,这时主程序while里面的东西没有了
重新输入一次
编译运行,此时板载LED闪烁
网友评论