Skip to content

Conversation

@erwango
Copy link
Member

@erwango erwango commented Jan 8, 2021

When setting baudrate register, baudrate value is computed according
to the oversampling given value, which is default boot time
value (16).
In case oversampling value has been changed by bootloader (as in case
of TFM bootloader), a desynchronsation happens between OVR and BRR
values and the ouptut baudarate is incorrect.
For oversampling register before setting the baudrate to avoid this
situation.

Signed-off-by: Erwan Gouriou [email protected]

@erwango erwango requested review from ABOSTM and FRASTM as code owners January 8, 2021 09:56
@github-actions github-actions bot added the platform: STM32 ST Micro STM32 label Jan 8, 2021
When setting baudrate register, baudrate value is computed according
to the oversampling given value, which is default boot time
value (16).
In case oversampling value has been changed by bootloader (as in case
of TFM bootloader), a desynchronsation happens between OVR and BRR
values and the ouptut baudarate is incorrect.
For oversampling register before setting the baudrate to avoid this
situation.

Signed-off-by: Erwan Gouriou <[email protected]>
@erwango erwango force-pushed the fix_ovr_brr_desync branch from 2e90851 to 5f0ed2d Compare January 8, 2021 09:59
@erwango
Copy link
Member Author

erwango commented Jan 8, 2021

@yestin should fix issue seen in #31118 (review)

@FRASTM
Copy link
Contributor

FRASTM commented Jan 8, 2021

"In case oversampling value has been changed by bootloader" --> could this value be set to LL_USART_OVERSAMPLING_8 (and no more the reset default value LL_USART_OVERSAMPLING_16) ?

@erwango
Copy link
Member Author

erwango commented Jan 8, 2021

"In case oversampling value has been changed by bootloader" --> could this value be set to LL_USART_OVERSAMPLING_8 (and no more the reset default value LL_USART_OVERSAMPLING_16) ?

@FRASTM Default reset value is 16, so I guess this is a usual value. Besides, this value is in use since ages in multiple applications and no one complains, I would not dare to change this w/o heavy testing.
In that case, the "strange" choice was in TFM bootloader to use 8 instead of default reset value.

@zephyrbot zephyrbot added the area: UART Universal Asynchronous Receiver-Transmitter label Jan 8, 2021
@zephyrbot zephyrbot requested a review from dcpleung January 8, 2021 14:31
@erwango erwango added the bug The issue is a bug, or the PR is fixing a bug label Jan 8, 2021
@erwango erwango requested a review from galak January 8, 2021 20:39
@erwango erwango added this to the v2.5.0 milestone Jan 12, 2021
@nashif nashif merged commit 37c7b89 into zephyrproject-rtos:master Jan 12, 2021
@erwango erwango deleted the fix_ovr_brr_desync branch January 27, 2022 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: UART Universal Asynchronous Receiver-Transmitter bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants