cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f4 uart receive data shifting

IDANI.1
Associate

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 ?

2 REPLIES 2
TDK
Guru

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

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

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