Skip to main content
IDANI.1
Visitor II
October 24, 2020
Question

STM32f4 uart receive data shifting

  • October 24, 2020
  • 2 replies
  • 1082 views

Hello

I use the Nextion intelligent display with STM32f4 . Display communicate according to UART protochol. I can communicate but receive data is shifting .

uint8_t Rx_data[4]={0,0,0,0}; // receive data

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)

{   

}

HAL_UART_Receive_IT (&huart3, Rx_data, 4); //uart with interrupt mode

for example When display sent 00 00 00 EE. i check on the debug window but datas are as below

Rx_data[0]=0

Rx_data[1]=EE

Rx_data[2]=0

Rx_data[3]=0

Normally Rx_data[3] must be EE. Why this receive data is shifting ?

This topic has been closed for replies.

2 replies

TDK
Super User
October 24, 2020

Probably you are calling HAL_UART_Receive_IT after the message is already half sent. Can you attach a logic analyzer with GPIO pins hooked up to indicate when events are taking place? Or it's not sending what you think it's sending.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Tesla DeLorean
Guru
October 24, 2020

Read single characters so you can actually synchronize with the inbound data stream.​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..