Solved
STM32H7: FDCAN has lost the automatic Bus-off Recovery mechanism ?
Hi,everyone!
I want to know if FDCAN ( I'm using STM32H7) has lost the automatic Bus-off Recovery mechanism. Looking Forward to get your reply.
Thanks!
Hi,everyone!
I want to know if FDCAN ( I'm using STM32H7) has lost the automatic Bus-off Recovery mechanism. Looking Forward to get your reply.
Thanks!
void CAN_bus_off_check_reset(FDCAN_HandleTypeDef *hfdcan) {
FDCAN_ProtocolStatusTypeDef protocolStatus = {};
HAL_FDCAN_GetProtocolStatus(hfdcan, &protocolStatus);
if (protocolStatus.BusOff) {
CLEAR_BIT(hfdcan->Instance->CCCR, FDCAN_CCCR_INIT);
}
}
You can check when you send message to fifo or check it on bus-off call back:
when CAN init
HAL_FDCAN_ActivateNotification(&hfdcan2, FDCAN_IT_BUS_OFF, 0);add call back func
void HAL_FDCAN_ErrorStatusCallback(FDCAN_HandleTypeDef *hfdcan, uint32_t ErrorStatusITs) {
if (hfdcan == &hfdcan2) {
if ((ErrorStatusITs & FDCAN_IT_BUS_OFF) != RESET) {
CAN_bus_off_check_reset(hfdcan);
}
}
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.