英文:
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).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论