Re: Setting #uart parity to 'even' with #stm32 using device tree #stm32 #uart


Pauli
 

Dear all,

if somebody tumbles here with google about the parity, i found no way to do it from device tree, but 8-databits, even parity, 1 stopbit seems to work in my case with patch pasted below. There are devicetree bindings on the same file, but nothing regarding the parity (i could make pull for this single case, but i guess the modifications should go to serial-device tree bindings, and that sounds like larger pull that i am afraid i do not have time).

Also, ror the record: with this setup one can use HC-05 with stm32_min_dev board, and with burned in st-system bootloader one can achive "update over bluetooth" using stm32loader.py: shell command to enter bootloader (writes to backup registers that next reset jump to bootloader, followed by system reset) -- and then closes command terminal and runs stm32loader.py over bluetooth.

Br,
Pauli


diff --git a/drivers/serial/uart_stm32.c b/drivers/serial/uart_stm32.c
index 3d0dd1ca84..03948225a0 100644
--- a/drivers/serial/uart_stm32.c
+++ b/drivers/serial/uart_stm32.c
@@ -671,8 +671,8 @@ static int uart_stm32_init(struct device *dev)
 
        /* 8 data bit, 1 start bit, 1 stop bit, no parity */
        LL_USART_ConfigCharacter(UartInstance,
-                                LL_USART_DATAWIDTH_8B,
-                                LL_USART_PARITY_NONE,
+                                LL_USART_DATAWIDTH_9B,
+                                LL_USART_PARITY_EVEN,
                                 LL_USART_STOPBITS_1);
 
        if (config->hw_flow_control) {

Join users@lists.zephyrproject.org to automatically receive all group messages.