Hi, in the documentation of the CAN driver's state machine are transitions from CAN_STARTING and READY to itselfs by calling canStart(). In code it is an illegal call/transition due to osalDbgAssert
Hi, thanks for your help. How i can restart the CAN when it is gone into BUS OFF without using the automatic bus off management (ABOM)? I know that i can stop and start it again. But in the context where i want to restart it the CANConfig structure is not available due to my software structure. May it is a good feature to have a function which just restarts the driver or writes the RESET bit in MCR? So the configuration is unaffected but the CAN gets reset.
All drivers keep a pointer to the configuration structure internally, do not assume that the structure is no more required after starting the driver, some drivers could incidentally work but the structure is supposed to be persistent.
// clear all transmit mailboxes canp->can->TSR |= CAN_TSR_ABRQ0 | CAN_TSR_ABRQ1 | CAN_TSR_ABRQ2; // reset CAN controller by setting the RESET BIT which is cleared again by hardware canp->can->MCR |= CAN_MCR_RESET;
In this procedure the CANConfig structure is not needed because of the canStart call. So the user can reset the CAN controller in case of CAN High-Low short without the availability of the CANConfig structure which is required by canStart.
void can_lld_reset_controller(CANDriver *canp) { // clear all transmit mailboxes canp->can->TSR |= CAN_TSR_ABRQ0 | CAN_TSR_ABRQ1 | CAN_TSR_ABRQ2; // reset CAN controller by setting the RESET BIT which is cleared again by hardware canp->can->MCR |= CAN_MCR_RESET; }