cancel
Showing results for 
Search instead for 
Did you mean: 

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.

NSirm.1
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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

View solution in original post

3 REPLIES 3
TDK
Guru

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
Associate III

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

TDK
Guru

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