2024-09-03 05:47 AM
Hello,
I'm using a STM32L476 and the HAL from ST tag: v1.12.0 and it appears in some cases that when I'm configuring the PLL for the SAI2 peripheral that the RCC_CR_PLLSAI2RDY flag from the RCC->CR register is not ready.
Did anyone had the same issue? What could cause this?
Thanks and advance and best regards,
Jonathan
2024-09-03 06:04 AM
> in some cases
Elaborate.
What's the primary clock source? Is it stable at that point? How is the SAI2 PLL set up? Read out and check/post content of relevant RCC registers when the timeout occurs.
JW
2024-09-03 07:13 AM - edited 2024-09-03 07:19 AM
Thanks for your answer, the primary clock source is HSE (16MHz), here's my configuration:
2024-09-03 09:06 AM - edited 2024-09-03 09:08 AM
> PeriphClkInit.PLLSAI2.PLLSAI2M = 1;
In the 'L476, there is only one single M prescaler shared by all the PLLs. I don't know how is this handled by Cube/HAL - I don't use it - but IMO you have to make sure it's set to the same value for all PLL setup functions.
16MHz input frequency is at the upper end of the PLL's input range, maybe you want to use a divider to make sure the input clock duty is withing the specified 45-55%.
Also make sure that the VCO output frequency is adequate for the selected VSO, see PLL, PLLSAI1, PLLSAI2 characteristics table in datasheet.
JW