Hello Alvaro Lopes,
Thank you for your updated information.
If the frame is not complete, just as you have said, collision happen, if the stop bit should high, but the received bit still low, you will detect a frame error.

But, if your stop bit still the same, just the bit not what you want, you may need to check the received UART data, whether it is what you need, and operation it with the code function.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------