2020-10-24 12:05 PM
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 ?
2020-10-24 01:41 PM
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.
2020-10-24 02:15 PM
Read single characters so you can actually synchronize with the inbound data stream.