|
先来试试Seeed矽递科技——Wio Lite AI 开发板的串口打印功能。这里直接使用STM32 cubemx来创建串口工程。
1.打开cubemx
选择STM32H725AEI6芯片
外部时钟
选择25MHZ晶振,最大550MHZ
使能Icache Dcache
配置串口,查看原理图,是USART3 ,PD8,PD9
生成代码
打开KEIL工程
添加头文件#include "stdio.h"
串口重映射
int fputc(int ch, FILE *f)
{
HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 0xFFFF);
return ch;
}
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MPU Configuration--------------------------------------------------------*/
MPU_Config();
/* Enable the CPU Cache */
/* Enable I-Cache---------------------------------------------------------*/
SCB_EnableICache();
/* Enable D-Cache---------------------------------------------------------*/
SCB_EnableDCache();
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART3_UART_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
printf("测试串口打印功能--WioLiteAI\r\n");
}
/* USER CODE END 3 */
}
添加测试代码
烧录,打开串口助手,观察
串口测试成功