2019-04-06 09:22 PM
Dear Members,
I changed my clock from MSI to HSI but my SPI and UART baudrate becoming wrong,
What do I miss here ?
thanks
2019-04-06 10:05 PM
Only you can answer a question with so little details, except Sherlock maybe?
2019-04-06 10:58 PM
2019-04-06 11:23 PM
Not good for me, it's not supported for STM32LX series :(
2019-04-06 11:28 PM
If you change clocks on the fly, you'll have to change dividers dependent on them also.
2019-04-06 11:35 PM
yes what value for divider ?
the setting for UART3
:
void MX_USART3_UART_Init(void)
{
huart3.Instance = USART3;
huart3.Init.BaudRate = 115200;
huart3.Init.WordLength = UART_WORDLENGTH_8B;
huart3.Init.StopBits = UART_STOPBITS_1;
huart3.Init.Parity = UART_PARITY_NONE;
huart3.Init.Mode = UART_MODE_TX_RX;
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart3.Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_UART_Init(&huart3) != HAL_OK)
{
Error_Handler();
}
}
2019-04-06 11:36 PM
clock
2019-04-07 12:30 AM
What do you want to do? Use HSI through PLL and generate the same SYSCLK 2.097 MHz default MSI frequency?
2019-04-07 12:33 AM
I want to use 16MHz HSI, but SPI2 and UART3 are misconfigured , working on 2.097MHz but not on HSI 16MHz, by the time I have 16MHz
any clues or same experiences ? thanks
2019-04-07 02:08 AM
I put on 32MHz, only USART3 can not work properly
I make :
USART3->BRR = 32000000/115200;
Correct me ?
///
void MX_USART3_UART_Init(void)
{
// Configure BRR by deviding the bus clock with the baud rate
huart3.Instance = USART3;
huart3.Init.BaudRate = 115200;
huart3.Init.WordLength = UART_WORDLENGTH_8B;
huart3.Init.StopBits = UART_STOPBITS_1;
huart3.Init.Parity = UART_PARITY_NONE;
huart3.Init.Mode = UART_MODE_TX_RX;
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart3.Init.OverSampling = UART_OVERSAMPLING_16;
USART3->BRR = 32000000/115200;
if (HAL_UART_Init(&huart3) != HAL_OK)
{
Error_Handler();
}
}