2018-04-08 11:15 AM
Hello,
I try to send data via UART with a baudrate 8Mb/s using
Nucleo-L476RG and UM232H,
the programs I use are
STM32CubeMx and Putty (for RX)
As shown on the picture below we can send data
via
USART1
with a baudrate between 2.443Kbits/s and 10Mb/sbut in reality when I exceed 1Mb/s ,I don't recieve any information in RX,
Probably, it is a speed interval problem generated in code as shown on the pictures below, I think, there is a bad coordination between the configuration and the code,
This is the declaration part :
Can any one help me please!
Thanks in advance
2018-04-08 11:25 AM
So does it throw a HAL_ERROR?
If you take the USART BRR value what does that translate back to in terms of achieved baud rate?
Does the USART indicate Rx errors?
Please try not to create multiple threads for the USART topic
https://community.st.com/0D50X00009XkWUGSA3
2018-04-08 11:33 AM
Hi, No there is no error in both of code and RX, but there is nothing in RX when I exceed 1Mb/s,
for the USART BRR it is between 0x10 (16 in hex) and 0xFFFF, and I use clk = 80MHz, so normaly the maximum of baudrate in this case in 80000000/16 = 5Mb/s !
2018-04-08 01:42 PM
Ok, but what value is programmed into the BRR in the failure cases, and what rate does that compute back too?
Have you looked at the signal with a scope or logic analyzer?
Make sure not to view the peripheral registers in the debugger, read and decode the USART->ISR and output via SWV.
Check for Noise and Framing Errors.
Try doing a loop-back test for Tx / Rx at the selected rate, check that also with a scope.
2018-04-09 11:30 AM
Easy.
1. Go through the math as laid out in the data sheet and see what value the baud rate registers should have. And
2. Step through your code and see what value the baud rate registers actually have.
The fact that your code works at lower speeds tells you all you need to know about the problem.
2018-04-09 11:31 AM
Hi, in fact, I solved a part of the problem, I used HSI instead of MSI, and with this solution I can reach 4Mb/s,
The problem now is that BRR is fixed all of the time at 16, Is there any solution for that, to obtain a maximum of baudrate!!
According to the expression below between BRR and Baudrate, we can obtain baudrate = 8000000/16 = 5Mb/s (Frequency fixed at 80MHz), but in reality we can reach only 4Mb/s and in this case I
looked at the signal with a scope and the baudrate was 4Mb/s, so is there a solution for these 2 problems :
1/ Why we can't exceed 4Mb/s! to reach logically 5Mb/s
2/ How we can explain the confusion, We have BRR = 16, and baudrate = 4Mb/s so that give frequency = 64MHz which is different to 80MHz we entred in configuration
Thanks in Advance,
2018-04-09 12:00 PM
I tend to print out the value of SystemCoreClock along with the AHB, APB1 and APB2 clock speeds when my systems start, it helps when testing code across a wide range of STM32 part families.
You could look at the library code computing the setting.
If would avoid keeping such a Watch/View open as it will break the USART functionality
2018-04-10 07:03 AM
Turvey.Clive.002
,henry.****
Hi, the problem is not solved, below is the clock configuration,
Based on the figure above,
I tried to use the different divisions /1, /8.. and the different clk (PPLCK, SYCLK, HSE...) to obtain the correct frequency, but everytime, I have the some frequeny output that I showed on the scope,HSI --> 16MHZ (correct value)
SYSCLK --> 32MHZ (wrong value != 10 MHZ)
PLLCLK -->
32MHZ (wrong value != 10 MHZ)
.....
I added some instructions on the code to show the frequency value, and that gives 32MHZ as shown on the pictures below
Anyone have a solution please!
Thanks in advance!