Closed cryptic-quasar closed 7 months ago
Hello @cryptic-quasar,
Thank you for this report. As indicated in the RM0433 (section 8.7.11 page 398) see screenshot below the prescaler for PLLM can take values from 0 to 63 this is correct but the value 0 indicates that the prescaler is disabled. I don't see any need to add the +1 in the PLLM calculation. For the moment I didn't see the problem, may be I forgot some details. Could you please share with me more details about your issue.
With regards, Tasnim
Setup
Issue I encountered a problem setting the UART baud rate using
LL_RCC_GetUSARTClockFreq(LL_RCC_USART16_CLKSOURCE)
as the second argument ofLL_USART_SetBaudRate
. The data received on my PC using the USB-to-Serial adapter were bogus.After spending hours, I finally spotted the issue and it turns out that the
SystemCoreClock
calculations in HAL and LL are wrong. ThePLLM
coefficient can only take values from 0 to 63 with 0 meaning division by 1, 1 meaning division by 2, 2 meaning division by 3, etc. The problem is that the methods I mentioned before do not take the increment ofPLLM
into account for the dynamic calculation of SystemCoreClock.The following is taken from
stm32h7xx_hal_rcc.c
:where it must be: