How to tackle UnicodeError

Hi, when I use STM32 to send data to OpenMV, OpenMV will report UnicodeError.
Each time OpenMV is reconnected, it will work normally for a while, but this error will appear after a while.

Yeah, it’s because there’s a bit error on the byte you are decoding.

You should use something different than decode. This expects a valid unicode sequence. If you get a bit error it can’t handle it.

Alternatively, wrap that statement in a try/except for the UnicodeError to handle an error gracefully.