UART baudrate 115163 and not 115200 on OpenMV Cam H7

Hi,

I tried to read data from a sensor over uart, but I only receive correct data for the first 6 to 8 frames, afterwards I receive garbage. I noticed the baudrate on the uart object differ from the initialization value. How do I get the UART to run with the correct boudrate (115200 baud)?

MicroPython: v1.18-omv-r6 OpenMV: v4.3.1 HAL: v1.9.0 BOARD: OPENMV4-STM32H743
Type "help()" for more information.
>>> from pyb import UART
>>> uart = UART(3, baudrate=115200)
>>> uart.init(115200, bits=8, parity=None, stop=1, timeout_char=1000)
>>> uart
UART(3, baudrate=115163, bits=8, parity=None, stop=1, flow=0, timeout=0, timeout_char=1000, rxbuf=64)
>>>

I tried the same code on a Pi PICO and it works as expected.

Best regards,
Mikkel

Uh… that number it’s showing is just what it actually achieve.

UARTs can handle the slight difference in speed from 115200 to 115163. The protocol is designed to handle slight timing differences.

As for garbage characters. The issue is likely higher up in your code. You can check this by making a loop printing characters and it should be fine.