STM32F103C8 UART cannot receive correct data by another same MCU
Thank you in advance.
I am trying use two stm32f103c8t6 to do communication stuff. One is used to be transmitter and another is receiver. The code is simple but it doesn't work.
Source code as follows:
Transmitter:
while (1)
{
uint8_t tran[4] = {0x21, 0x48, 0x59, 0x00};
HAL_UART_Transmit(&huart1, tran, 4, 10);
HAL_Delay(100);
}
Receiver:
while (1)
{
HAL_UART_Receive(&huart1, tran, 4, 10);
HAL_Delay(100);
}
The baud rate is set to 115200 bits/s. I use usb-to-ttl to check the situation. The transmitter is working normally, but the receiver cannot receive the normal data as expected.
Please help!!!