串口驱动
串口版本1驱动(putc)
串口版本2驱动(putc)
手册说明
HAL库串口发送
前篇博客
RT-Thread之ota组件和serial_v2组件结合使用出现的问题记录
通过修改串口驱动(经测试)
static int stm32_putc(struct rt_serial_device *serial, char c)
{
struct stm32_uart *uart;
RT_ASSERT(serial != RT_NULL);
uart = rt_container_of(serial, struct stm32_uart, serial);
while (__HAL_UART_GET_FLAG(&(uart->handle), UART_FLAG_TXE) == RESET);
UART_SET_TDR(&uart->handle, c);
// while (__HAL_UART_GET_FLAG(&(uart->handle), UART_FLAG_TC) == RESET);
// UART_INSTANCE_CLEAR_FUNCTION(&(uart->handle), UART_FLAG_TC);
// UART_SET_TDR(&uart->handle, c);
return 1;
}