← index #15649PR #18075
Likely Duplicate · medium · value 0.452
QUERY · ISSUE

NUCLEO-L476RG (STM32L476RG), NUCLEO_G0B1RE (STM32G0B1RE) - LPUART1 initialization not working

openby AndriiHordieievopened 2024-08-13updated 2026-03-24
bugport-stm32

Port, board and/or hardware

port-stm32 - NUCLEO-L476RG with STM32L476RG

MicroPython version

MicroPython v1.23.0 on 2024-06-02; NUCLEO-L476RG with STM32L476RG

Reproduction

from machine import UART
uart = UART('LP1', baudrate=9600, bits=8, parity=None, stop=1)

or

from machine import UART
uart = UART(6, baudrate=9600, bits=8, parity=None, stop=1)

Expected behaviour

LPUART should initialize without errors

Observed behaviour

ValueError: set baudrate 0 is not within 5% of desired value

Additional Information

Similar issue https://github.com/micropython/micropython/issues/7466

Code of Conduct

Yes, I agree

CANDIDATE · PULL REQUEST

stm32: Fix LPUART init failure with low baudrate.

mergedby yn386opened 2025-09-15updated 2025-09-18
port-stm32

Summary

UART prescaler value should set up collectly to initialize LPUART with low baudrate for STM32G0/G4/H5.
This can be implemented similarly to STM32H7/N6/WB.

The following code does not work:

from machine import UART
uart = UART('LP1', baudrate=9600, bits=8, parity=None, stop=1)

An error occured with following message:

ValueError: set baudrate 0 is not within 5% of desired value

LPUART should be initialized without errors.

Testing

Tested with:

  • NUCLEO-G01RB
  • NUCLEO-G474RE
  • NUCLEO-H563ZI

Remarks

STM32WL may have same issue but I couldn't check because I don't have it.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied