Question
We try to send a CAN frame when the CAN cable is not connected to the CAN bus.
We close down the CAN controller. We reconnect the CAN cable and restart the CAN
controller. The CAN frame that we failed to send now appear on the CAN bus.
Question:
How do we remove the CAN frame from the CAN controller if the frame couldn't be
send because the CAN cable was not connected?
e.i. we initialize a send by setting the TRSn bit when the CAN cable is not
connected.
ps. We have tried to remove the frame by setting the TRRn bit but the frame is
still sent when we reconnect. We have also tried to do a software reset of the
CAN controller setting the SRS bit. The CAN registers appears to be reset but
the frame still appear on the CAN bus after setting up the CAN controller again.
ds.
Answer
Don't try to handle the unplugged cable state, just set ABO bit in CAN_CONTROL.
Then any pending (receive and transmit) message would run crazy until the error
counters overflow and the state machine walks through the bus-off and bus-off
recovery cyle by itself without software intervention. Afterward, the entire
controller should be in virgin state, only that all configuartion and mailbox
registers are already programmed the right way.