2024-01-08 03:45 AM
Hello
I have a code use CAN2 on a stm32F105 he work fine if the CAN bus have not disturbance
But if i have to many disturbance for exemple if i make a short circuit bethen CANH and CANL when i remove the short circuit the CAN no restart to send data. I need stop and restart CAN
HAL_CAN_Stop(&hcan2);
HAL_CAN_Start(&hcan2);
Then he work but i lose data during this time
during bug
HAL_CAN_GetTxMailboxesFreeLevel(&hcan2) return 0
hcan2.ErrorCode are equal to 0
hcan2.Instance->TSR -> have the bit CAN_TSR_TERR0 set to 1 but if i call HAL_CAN_AbortTxRequest(&hcan2,CAN_TX_MAILBOX0);
CAN_TSR_TERR0 return to 0 but CAN no restart
Can you help me for have a CAN work every time?
Solved! Go to Solution.
2024-01-09 01:33 AM
Hello,
You need to enable the automatic bus off management by Hardware: .Init.AutoBusOff= ENABLE
2024-01-09 01:33 AM
Hello,
You need to enable the automatic bus off management by Hardware: .Init.AutoBusOff= ENABLE