I'm using HAL library to transmit and receive characters:
uint8_t c;
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
if(HAL_UART_Receive(&huart5, &c, 1, 100) == HAL_OK)
{
HAL_UART_Transmit(&huart5, &c, 1, 100);
}
}
And after I install and load the code to my Discovery board, I use Hercules to start communicate and this hapen when I send a word or a letter: Occur weird characters when communicate using PL2303
I have tried to find the solution but it didn't appear. I hope someone can help me to resolve this problem.
Thanks for helping me, Ilya. I solved this problem by setting the input frequency = 8MHz (I had set it up to 16Mhz so the serial can't read and send the data with the true frequency).