Why is MX_xxxx_Init()(HAL drivers) getting stuck in infinity loop if LL_RCC driver is used, instead of its HAL counterpart?
Mcu: STM32F446RET6
STM32CubeMX 5.0.0 (STM32Cube V1.0)
So, yeah i figured out that if i use LL_RCC_DRIVER and then any periephal which only does have HAL_driver implemented by ST, it will get stuck in infinity loop in the corresponding init function.
ie.
if (HAL_CAN_Init(&hcan1) != HAL_OK) // <<- permanently stuck
{
Error_Handler();
}and the actual infinity loop is below.
while ((hcan->Instance->MSR & CAN_MSR_SLAK) != RESET) // <-- Always true
{
if ((HAL_GetTick() - tickstart) > CAN_TIMEOUT_VALUE) // <-- never true
{
/* Update error code */
hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT;
/* Change CAN state */
hcan->State = HAL_CAN_STATE_ERROR;
return HAL_ERROR;
}
}Now i ask, why i'm able to select LL and HAL driver mixture from cubeMX if it does not work anyway, using HAL_RCC driver and this proplem is gone, but that is not a fix.
Second, MX_CAN2_Init() always results into HAL_ERROR?