2023-09-14 09:11 AM
Hello everyone,
I'm working on a project with a STM32L072CBT6.
I'm using LPUART (PB10 / PB11) at 9600 bauds to communicate with an other board. For low power consumption, i'm using LSE for my LPUART.
When i check my bauds rate on my oscilloscope, i get the value of 93.3 that represent ~10718 bauds.
I have try to modifiy load capacitor of my resonnator (12pF and 6pF) but no change.
Do you have advice about this error in baud rate ?
Resonnator configuration (ABS07-32.768KHZ-6-4-T):
My clock configuration in STM32CubeMX:
My LPUART configuration :
My RCC configuration:
Best regards,
MLam
Solved! Go to Solution.
2023-09-14 11:49 PM
If you measure individual bits, you can only measure integer periods of the 32768Hz LSE clock, i.e. the calculated "baudrate" from individual bits can be for 9600 setting only 32768/3=10922 or 32768/4=8192. LPUART achieves a relatively good 9600 Bauds by dithering, i.e. alternating appropriately between these two bit lengths.
JW
2023-09-14 09:27 AM - edited 2023-09-14 09:28 AM
1. check LSE frequ. -> activate MCO and set to LSE ; check mco output ...
2. maybe try crystal drive high , not low.
3. try lower baud, for test 1200 or so.
2023-09-14 11:49 PM
If you measure individual bits, you can only measure integer periods of the 32768Hz LSE clock, i.e. the calculated "baudrate" from individual bits can be for 9600 setting only 32768/3=10922 or 32768/4=8192. LPUART achieves a relatively good 9600 Bauds by dithering, i.e. alternating appropriately between these two bit lengths.
JW
2023-09-15 01:59 AM
Hello AScha.3,
This my return after your reply:
1) Frequency is correct, Picture below get from MCO output
2) I have try in High LSE drive capability but nothing change.
3) Resultat for various bauds :
9600 bauds configured | 10718 bauds mesured |
4800 bauds configured | 5480 bauds mesured |
1200 bauds configured | 1210 bauds mesured |
2023-09-15 02:54 AM
btw set drive -> high , just if crystal not starting or shows problems (depends on specs of crystal, flux remains on board etc.)
+
did you read, what Jan wrote?
2023-09-15 03:10 AM
OK but when i get frequency on my MCO GPIO that seems that my crystal start correctly no ?
Yes i have read what Jan wrote, i'm currently trying to modify UCESM bit.
2023-09-15 03:40 AM
yes, seem working fine.
2023-09-19 09:03 AM
To conclude,
I have reduce my baud rate to 1200 to get a better match.
In a same time i see that my DMA+LPUART often crash when i try to get my data at initialization.
So i have added a delay for my LPUART Interrupt when i power on my system.