Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/uart: stm32: Report 9bits transactions as not supported #32204

Merged

Conversation

erwango
Copy link
Member

@erwango erwango commented Feb 11, 2021

STM32 uart driver doesn't support 9bits transactions in any case,
so remove case were it was declared as supported.

Fixes #31799

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

@erwango erwango added platform: STM32 ST Micro STM32 bug The issue is a bug, or the PR is fixing a bug labels Feb 11, 2021
@erwango
Copy link
Member Author

erwango commented Feb 11, 2021

Reported error is the following:

-:13: WARNING:CONSTANT_COMPARISON: Comparisons should place the constant on the right side of the test
#13: FILE: drivers/serial/uart_stm32.c:342:
+	    || (UART_CFG_DATA_BITS_9 == cfg->data_bits)) {

Need to fix the whole file...

STM32 uart driver doesn't support 9bits transactions in any case,
so remove case were it was declared as supported.

Fixes zephyrproject-rtos#31799

Signed-off-by: Erwan Gouriou <[email protected]>
Fixes: "WARNING:CONSTANT_COMPARISON: Comparisons should place the
constant on the right side of the test"

Signed-off-by: Erwan Gouriou <[email protected]>
@zephyrbot zephyrbot added the area: UART Universal Asynchronous Receiver-Transmitter label Feb 11, 2021
Copy link
Collaborator

@ABOSTM ABOSTM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hwilmers
Copy link
Contributor

hwilmers commented Mar 3, 2021

This removes support for following configuration:
UART_CFG_PARITY_EVEN,
UART_CFG_DATA_BITS_9
I found this configuration to result in the uart performing "8 bits, even parity" (on stm32l475) with good success.
Would there be any other way to achieve this configuration after above PR?

@erwango
Copy link
Member Author

erwango commented Mar 3, 2021

I found this configuration to result in the uart performing "8 bits, even parity" (on stm32l475) with good success.

@hwilmers, do you mean "9 bits, even parity"? Or maybe I'm not understanding correctly your point.

@hwilmers
Copy link
Contributor

hwilmers commented Mar 3, 2021

I mean "8 bits, even parity", like in "19200 8E1".
It may be the result of an unintended side effect that this works.

@erwango
Copy link
Member Author

erwango commented Mar 3, 2021

It may be the result of an unintended side effect that this works.

Probably

@dcpleung, do you have any hint for this question: #32204 (comment) ? Should we find a way to let it work "unintentionally" ?

@hwilmers
Copy link
Contributor

hwilmers commented Mar 3, 2021

Apparently, the word length as it is used in the stm32 usart includes the optional parity bit. This is what I found in this official reference manual, on page 1345:
https://www.st.com/content/ccc/resource/technical/document/reference_manual/02/35/09/0c/4f/f7/40/03/DM00083560.pdf/files/DM00083560.pdf/jcr:content/translations/en.DM00083560.pdf

A straight forward translation between usual notation and the implementation on stm32 would be to add one to the word length if a parity bit is appended.

@erwango erwango deleted the fix_stm32_9bits_uart_support branch January 27, 2022 13:41
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.

uart_configure does not return -ENOTSUP for stm32 uart with 9 bit data length.
6 participants