diff --git a/Core/Src/usart.c b/Core/Src/usart.c index cb86f56..578df0b 100644 --- a/Core/Src/usart.c +++ b/Core/Src/usart.c @@ -6,7 +6,7 @@ ****************************************************************************** * @attention * - *

© Copyright (c) 2020 STMicroelectronics. + *

© Copyright (c) 2021 STMicroelectronics. * All rights reserved.

* * This software component is licensed by ST under Ultimate Liberty license @@ -32,7 +32,7 @@ void MX_UART4_Init(void) { huart4.Instance = UART4; - huart4.Init.BaudRate = 115200; + huart4.Init.BaudRate = 56000; huart4.Init.WordLength = UART_WORDLENGTH_8B; huart4.Init.StopBits = UART_STOPBITS_1; huart4.Init.Parity = UART_PARITY_NONE; @@ -51,7 +51,7 @@ void MX_USART1_UART_Init(void) { huart1.Instance = USART1; - huart1.Init.BaudRate = 115200; + huart1.Init.BaudRate = 56000; huart1.Init.WordLength = UART_WORDLENGTH_8B; huart1.Init.StopBits = UART_STOPBITS_1; huart1.Init.Parity = UART_PARITY_NONE; @@ -172,7 +172,23 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle) /* USER CODE BEGIN 1 */ +//printf redirect +#ifdef __GNUC__ +//#define PUTCHAR_PROTOTYPE int __io_putchar(int ch) +#define PUTCHAR_PROTOTYPE int putchar(int ch) +#else +#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f) +#endif +PUTCHAR_PROTOTYPE +{ +// uint8_t time_out=3; +// while(!__HAL_UART_GET_FLAG(&huart1,UART_FLAG_TXE) && time_out--){ +// HAL_Delay(1); +// } + HAL_UART_Transmit(&huart1,(uint8_t *)&ch,1,100); + return ch; +} /* USER CODE END 1 */ diff --git a/README.md b/README.md index 4eab4ef..1dde20d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ * @Author: CK.Zh * @Date: 2020-02-20 11:39:38 * @LastEditors: CK.Zh - * @LastEditTime: 2020-04-30 10:15:25 + * @LastEditTime: 2021-01-05 16:21:59 --> # NaviKit_stm32 PM1导航套件中电源控制板源码,STM32F107VCT6,开发环境STM32CubeIDE @@ -32,3 +32,4 @@ `void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)`函数内 `HAL_PCD_SuspendCallback(hpcd); `代码段 务必屏蔽,否则导致枚举失败,提示获取设备描述符失败。 + > EC日志输出口波特率为56000bps \ No newline at end of file