Serial Interfaces Every Embedded Engineer Should Know | RS-232, RS-422 & RS-485 Explained
Why does the last byte disappear on an RS-485 link?
On an STM32, TXE goes high when the final byte enters the shift register, while bits are still leaving the pin. Dropping driver enable then can cut the byte short. Wait for the TC flag before releasing the bus so the last stop bit gets through.