cancel
Showing results for 
Search instead for 
Did you mean: 

Lost UART First Byte on Reception

devendra
Associate II

Hello All ,

 

I am using UART6 of STM32H7 series MCU for reception of 9 Byte data . UART is  losing first byte when receiving data on UART using interrupt.

Setup:

1. I am using full duplex RS485 (Modbus)

2. I have 2 MAX485 IC one for reception & another one for Transmission.

3. Data I am sending : Take for second Reception Image: 02 00 35 01 00 01 00 03 3C

when I do hit RxCpltCallback function in debugger I have observed that I am losing first byte of frame. 

I have added two Snaps of Data reception. we can see the first byte is getting filled with 0 after that we are receiving data and at the end we are losing 9th byte.

do you think there is some issue with UART configuration ?

What could be the possible solution for this ?

Thanks & Regards, 

Devendra Mishra

devendra_0-1728379361480.pngdevendra_1-1728379396381.png

STM32Cube Mx Setting :

devendra_2-1728379630762.png

devendra_3-1728379674583.pngdevendra_4-1728379710204.png

devendra_5-1728379737564.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Resolved...I have been using live expression using ST debugger however it seems it doesn't update data on real time hence showing first byte 0. Also issue observed that In project I have been using multiple UART. In one of them I have used complete callback & in this Uart I have been using UART however I have register a callback with my function  to process data I don't know this is working but I'm losing frames is this scenario. Now I have put all process in single Complete callback of ST HAL & issue resolved.

View solution in original post

3 REPLIES 3
TDK
Guru

If you send 02 00 35 01 00 01 00 03 3C and you receive 00 02 00 35 01 00 01 00 03, the problem is not that the first byte is lost, but rather an additional byte is received before the first byte (0x02). Most likely explanation is the STM32 is receiving data on the line correctly.

A 0x00 character could be due to the pin toggling when it's being initialized. Do you have a logic analyzer to verify what's coming on in the RX line? If this data is being received in a circular fashion, the first byte could be from a previous transaction that was not fully read out.

If you feel a post has answered your question, please click "Accept as Solution".

Resolved...I have been using live expression using ST debugger however it seems it doesn't update data on real time hence showing first byte 0. Also issue observed that In project I have been using multiple UART. In one of them I have used complete callback & in this Uart I have been using UART however I have register a callback with my function  to process data I don't know this is working but I'm losing frames is this scenario. Now I have put all process in single Complete callback of ST HAL & issue resolved.