最近收到一块STM32H7A3 NUCLEO
安装MDK 的支持库,下载stm32cubeh7工程实例
1. MDK 支持包下载
keil 支持包
https://keilpack.azureedge.net/pack/Keil.STM32H7xx_DFP.2.6.0.pack
这个下载好费劲,网络特慢,下了第6次才下载完成,下次有空放在百度云上
stm32cubeh7 库以及demo
https://www.st.com/zh/embedded-software/stm32cubeh7.html
环境安装完成
简单的修改工程,LED1 亮状态,LED2 1s钟闪烁一次
[code]int main(void)
{
/* This sample code shows how to use GPIO HAL API to toggle LED1 and LED2 IOs
in an infinite loop. */
/* STM32H7xx HAL library initialization:
- Systick timer is configured by default as source of time base, but user
can eventually implement his proper time base source (a general purpose
timer for example or other time source), keeping in mind that Time base
duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
handled in milliseconds basis.
- Set NVIC Group Priority to 4
- Low Level Initialization
*/
HAL_Init();
/* Configure the system clock to 280 MHz */
SystemClock_Config();
/* -1- Enable GPIO Clock (to be able to program the configuration registers) */
LED1_GPIO_CLK_ENABLE();
LED2_GPIO_CLK_ENABLE();
/* -2- Configure IO in output push-pull mode to drive external LEDs */
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Pin = LED1_PIN;
HAL_GPIO_Init(LED1_GPIO_PORT, &GPIO_InitStruct);
GPIO_InitStruct.Pin = LED2_PIN;
HAL_GPIO_Init(LED2_GPIO_PORT, &GPIO_InitStruct);
//HAL_GPIO_TogglePin(LED1_GPIO_PORT, LED1_PIN);
HAL_GPIO_WritePin(LED1_GPIO_PORT, LED1_PIN,GPIO_PIN_SET);
/* -3- Toggle IO in an infinite loop */
while (1)
{
HAL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN);
/* Insert delay 100 ms */
HAL_Delay(1000);
}
}
|