Hi,
I have checked your code, I suppose it is okay.
But for the api function, it has issue. I modified it as following.
// Function to send data to ESP-01 via UART
void send_data_to_esp(const char data) {
while (!(UART_GetStatusFlags(UART) & 1<<7)) //check the TDRE bit
{
UART_WriteByte(UART, data); // Send each byte to UART
}
}
Each calling, you can only transfer ONE byte.
Hope it can help you
BR
XiangJun Rong
