2024-10-08 02:30 AM - last edited on 2024-10-08 04:52 AM by SofLit
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
STM32Cube Mx Setting :
Solved! Go to Solution.
2024-11-07 08:43 AM
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.
2024-10-08 04:45 AM
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.
2024-11-07 08:43 AM
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.
2024-11-07 09:13 AM
@devendra wrote:Resolved...
That's good - please mark that as the solution:
https://community.st.com/t5/community-guidelines/help-others-to-solve-their-issues/ta-p/575256