基本的stm32cubemx使用就不细说了,要想配置freertos,用这个工具配置那是相当方便和简单
1、系统晶振配置
使用外部时钟晶振,配置如图
2、系统定时器设置
serial wire 保证下次可以程序下载
SysTick 是 Cortex-M 内核中的一个系统定时器,经常被用作系统中断控制器的基础,或者作为操作系统的时间片轮转机制的基准。SysTick可以取系统时钟(72M),还可以把系统时钟8分频后(9M)获取。
3、时钟树设置
配置如下进行选择
4、配置freertos 嵌入式操作系统配置
5、接下来可以配置串口
接下来直接生成代码,生成后直接打开工程,咱们再来修改几个地方
1、修改输出需要的一个配置,在2处打钩即可
2、修改代码,在main.c处
main.c文件如下
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.c
* @brief : Main program body
******************************************************************************
* @attention
*
* Copyright (c) 2024 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.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes --------------------