Hello ,
I am testing the UART Channel , on STM32f401RC and found the following problems .
1, Setting Custom Baud @ 600 will receive data at 9600
2, Setting the Baud 1200 ( Not Custom ) will receive data at 19200
Clock settings are set ok because @ 2400 and 38400 works fine
Using flowcode V9
STM32F401 UART
-
- Posts: 137
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 03, 2020 7:23 pm
- Has thanked: 41 times
- Been thanked: 19 times
-
- Valued Contributor
- Posts: 1163
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 287 times
- Been thanked: 415 times
Re: STM32F401 UART
Hi
If you look at this post you will see the calculation Benj shared for baud
viewtopic.php?f=3&t=602&p=3278&hilit=os ... mode#p3278
Although for a PIC I assume the principle is the same for your chip.
Regards
If you look at this post you will see the calculation Benj shared for baud
viewtopic.php?f=3&t=602&p=3278&hilit=os ... mode#p3278
Although for a PIC I assume the principle is the same for your chip.
Regards
Re: STM32F401 UART
HI good morning and thanks for your reply,
I don't understand what do I have to do, and how this
fixes the Bug in Flowcode.
Also are bugs still being fixed in V9 or just V10 now ?
Regards
I don't understand what do I have to do, and how this
fixes the Bug in Flowcode.
Also are bugs still being fixed in V9 or just V10 now ?
Regards
Re: STM32F401 UART
Hi,
Yes ! that was the problem works perfectly now
Thank you so much for your help.
By any chance do you know what C code I have to use to change baud rate
need to switch between 600 and 1200 .
Also need to change Parity to even found the following code on the forum
will it work ?
HAL_UART_DeInit(&MX_UART_NUMBER_1);
MX_UART_NUMBER_1.Init.Parity = UART_PARITY_EVEN;
HAL_UART_Init(&MX_UART_NUMBER_1);
Regards
Yes ! that was the problem works perfectly now
Thank you so much for your help.
By any chance do you know what C code I have to use to change baud rate
need to switch between 600 and 1200 .
Also need to change Parity to even found the following code on the forum
will it work ?
HAL_UART_DeInit(&MX_UART_NUMBER_1);
MX_UART_NUMBER_1.Init.Parity = UART_PARITY_EVEN;
HAL_UART_Init(&MX_UART_NUMBER_1);
Regards
-
- Valued Contributor
- Posts: 401
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 73 times
- Been thanked: 218 times
Re: STM32F401 UART
Yes, it should.
And to change the baud rate add this before HAL_UART_Init()
And to change the baud rate add this before HAL_UART_Init()
Code: Select all
MX_UART_NUMBER_1.Init.BaudRate = 600;
Re: STM32F401 UART
Hello , have the last question
Regarding setting UART Parity
For the Even Parity to work UART properties -> Data bits has to be set to 9
so if I want to set the parity back to NO Parity , the data bits has to be set back to
8 , how can I do that within a C code block ?
Thanks
Regarding setting UART Parity
For the Even Parity to work UART properties -> Data bits has to be set to 9
so if I want to set the parity back to NO Parity , the data bits has to be set back to
8 , how can I do that within a C code block ?
Thanks
-
- Valued Contributor
- Posts: 401
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 73 times
- Been thanked: 218 times
Re: STM32F401 UART
Code: Select all
MX_UART_NUMBER_1.Init.WordLength = UART_WORDLENGTH_9B;
// OR
MX_UART_NUMBER_1.Init.WordLength = UART_WORDLENGTH_8B;