This specific CAN2 config crashes during HAL_CAN_Init(), why
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-02-24 9:01 AM
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.
Solved! Go to Solution.
- Labels:
-
CAN
-
STM32F1 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-02-25 12:26 AM
Not sure howbut i fixed it:
I removed the nodes from the canbus line and flashed them with the canbus not connected,
the nodes are back to normal behaviour, maybe something hardwarewise was happening in the canbus.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-02-25 12:26 AM
Not sure howbut i fixed it:
I removed the nodes from the canbus line and flashed them with the canbus not connected,
the nodes are back to normal behaviour, maybe something hardwarewise was happening in the canbus.
