cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 UART Receive Problem

Kuttay
Associate III

Hi, I am using STM 32 STLINK-V3. Thereis a problem with following UART receiver function. 

 

	__HAL_UART_CLEAR_FLAG(&huart5, UART_CLEAR_NEF|UART_CLEAR_OREF);
	HAL_UART_Receive(&huart5, rx_buffer, ROVER_MSG_LEN, 1000);




	 __HAL_UART_DISABLE_IT(&huart5,UART_IT_RXNE);

 

. Without clearing the flag rx_buffer remains empty even though there is a data observed from hardware with oscilloscope. I stept into the function and see flag remains up constantly but now only varying few initial bits of the buffer gets the data still rest remians empty. Is this a bug does any one knows ? 

12 REPLIES 12

" You're doing a lot of unnecessary byte comparison when you're working with strings. Just do a string comparison using strncmp " thanks a lot such a great advice to increase efficiency. Also about a while loop you are right I am trying to write it with a polling.

I connected seems like it is working through converter but still could not solve the problem.


@Kuttay wrote:

 These two gnss are connected to each other with uart2 


Again, how do you connect two GNSS units to one UART ?

 

See this post for why you can't just short two outputs together:

https://community.st.com/t5/stm32-mcus-boards-and-hardware/uart-not-receiving-data-when-sent-through-putty/m-p/687634/highlight/true#M19662

How do you avoid that when connecting the two GNSS units to one UART?