An error occurs when writing to UART

You can refer to this application: