Bug fixed, should use DMA for the UART, otherwise data will be lost when sending data.