Principal
February 24, 2021
Solved
This specific CAN2 config crashes during HAL_CAN_Init(), why
- February 24, 2021
- 1 reply
- 1131 views
Lets hope someone has a felicitously revelation, or a clue.
I am using a custom board with a nice stm32f105rbtx, fed with external XTAL.
Everything worked like a charm untill i configured the clock to be 72Mhz and readjusted the can parameters in CUBEMX to match 125.000bauds
when i run the generated code it crashes riight here in HAL_CAN_Init();
The init function timeouts right here and returns HAL_ERROR
/* Check Sleep mode leave acknowledge */
while ((hcan->Instance->MSR & CAN_MSR_SLAK) != 0U)
{
if ((HAL_GetTick() - tickstart) > CAN_TIMEOUT_VALUE)
{
/* Update error code */
hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT;
/* Change CAN state */
hcan->State = HAL_CAN_STATE_ERROR;
return HAL_ERROR;
}
}I have no idea why the canbus "stays in sleep mode" during initialization with this config.....
CubeMX file attached
Edit: now it happens with every canbus config, even old commits that were working previously.
