2020-10-04 11:20 AM
Hello. I was working on example generated by cubeMX (new version) on STM32L562VET6Q processor and canbus.
Example code of networking worked just fine, but copying code to my LL based project made CANBUS inoperable.
I was able to track down what is different, and find one line of code that its not generated or set in LL RCC library.
in original example it was that was working
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_FDCAN;
PeriphClkInit.FdcanClockSelection = RCC_FDCANCLKSOURCE_PLL;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
}
While my code only had one line:
LL_RCC_SetFDCANClockSource(LL_RCC_FDCAN_CLKSOURCE_PLL);
But it never worked. Tracking what is different i was able to that in HALL version of code, it also does this:
SET_BIT(RCC->PLLCFGR, (RCC_PLL_48M1CLK));
So what do I am missing ? What is LL eqvivalent of this call ?
With this added to my LL project, can-bus started working as it should.
Thanks !
2020-10-04 02:02 PM
> So what do I am missing ? What is LL equivalent of this call ?
/**
* @brief Enable PLL output mapped on 48MHz domain clock
* @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_EnableDomain_48M
* @retval None
*/
__STATIC_INLINE void LL_RCC_PLL_EnableDomain_48M(void)
{
SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLLQEN);
}