Hardware manual
RX600 Series CAN Application Programming Interface
R01AN0339EU0203 Rev. 2.03 Page 23 of 29
Mar 23, 2013
Figure 5. Handling recovery from Bus Off for the application.
(The MCU detects recovery of the bus on its own.)
A node will automatically resume the normal Error Active state again after seeing 11 consecutive recessive bits on
the bus 128 times. Note that the time a node spends in Bus Off could be very short, e.g. less than a millisecond.
Poll with the Check Error function once every cycle in the main routine what state the node is in (or use the CAN
error interrupt). If the node has reached Bus Off a certain number of times within a certain time period, you
may want to send a warning message, light an LED etc.
The minimum action required of a node if Bus Off is reached is shown above. Stop trying to communicate and poll
the peripheral with the Check Error function to see when the peripheral has returned to the normal Error Active
state. When the node has recovered, it is important to reinitialize the CAN peripheral and the application to
make sure the slots are in a known state.
Example
uint8_t error_bus_status;
/*****************************************************************************
Name: HandleCanBusState
Parameters: Bus number, 0 or 1.
Returns: -
Description: Check CAN peripheral bus state.
*****************************************************************************/
static void HandleCanBusState(uint8_t ch_nr)
{
can_std_frame_t err_tx_dataframe;
/* Has the status register reached error passive or more? */
if (ch_nr == 0)
error_bus_status[ch_nr] = R_CAN_CheckErr(0);
/*else
error_bus_status[ch_nr] = R_CAN1_CheckErr(1);*/