Skip to main content
NSirm.1
Associate II
December 3, 2020
Solved

Hello all. I am implementing a simple application that reads data using USART. I want to read 10 bytes of data and if carriage return or new line is detected it must print "String Received" otherwise it must print "Error". I am using STM32F205.

  • December 3, 2020
  • 3 replies
  • 1196 views

The problem that I am facing is that I implemented HAL_UART_Receive_IT function in a while(1) loop and then I check for the elements of buffer for \n or \r. After I type the first message it prints "String Received". But after that it continuously prints "Error". I read a few articles and i enabled the IRQ for the interrupt but i am confused about its implementation. I wish to know how exactly is it done.

This topic has been closed for replies.
Best answer by TDK

There are 1700+ different STM32 chips. Which one are you using?

There are plenty of examples in CubeMX for you to follow.

3 replies

TDK
TDKBest answer
December 3, 2020

There are 1700+ different STM32 chips. Which one are you using?

There are plenty of examples in CubeMX for you to follow.

"If you feel a post has answered your question, please click ""Accept as Solution""."
NSirm.1
NSirm.1Author
Associate II
December 3, 2020

I apologize for not mentioning the chip name STM32F205 is the chip that i am using

TDK
December 3, 2020

Here is one example from the repository that does about what you're looking for. You'll probably need to adapt it to your exact case:

https://github.com/STMicroelectronics/STM32CubeF2/blob/bd8d1f0427aa155e3a11621590fef59087e78af8/Projects/STM322xG_EVAL/Examples/UART/UART_Hyperterminal_IT/Src/main.c

"If you feel a post has answered your question, please click ""Accept as Solution""."