Occur weird characters when I use serial to communicate between my STM32F4 Discovery with my pc using PL2303

huangapple go评论131阅读模式
英文:

Occur weird characters when I use serial to communicate between my STM32F4 Discovery with my pc using PL2303

问题

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 communicating, and this happens when I send a word or a letter:
Occur weird characters when communicating using PL2303

I have tried to find the solution, but it didn't appear. I hope someone can help me resolve this problem.

英文:

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.

答案1

得分: 0

感谢你帮助我,Ilya。我通过将输入频率设置为8MHz来解决了这个问题(我之前将它设置为了16MHz,所以串口无法以真实频率读取和发送数据)。

问题中输入频率的位置

英文:

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).

Location of the input frequency in my problem

huangapple
  • 本文由 发表于 2023年3月7日 18:34:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/75660835.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定