10 can autobaud and listening mode, 11 routines examples – Rainbow Electronics T89C51CC01 User Manual
Page 82
82
T89C51CC01
Rev. D – 17-Dec-01
15.10 CAN Autobaud and
Listening mode
To activate the Autobaud feature, the AUTOBAUD bit in the CANGCON register must
be set. In this mode, the CAN controller is only listening to the line without acknowledg-
ing the received messages. It cannot send any message. The error flags are updated.
The bit timing can be adjusted until no error occurs (good configuration find).
In this mode, the error counters are frozen.
To go back to the standard mode, the AUTOBAUD bit must be cleared.
Figure 39. Autobaud Mode
15.11 Routines Examples
1.
Init of CAN macro
// Reset the CAN macro
CANGCON = 01h;
// Disable CAN interrupts
ECAN
= 0;
ETIM
= 0;
// Init the Mailbox
for num_page =0; num_page <15; num_page++
{
CANPAGE = num_channel << 4;
CANCONCH = 00h
CANSTCH = 00h;
CANIDT1 = 00h;
CANIDT2 = 00h;
CANIDT3 = 00h;
CANIDT4 = 00h;
CANIDM1 = 00h;
CANIDM2 = 00h;
CANIDM3 = 00h;
CANIDM4 = 00h;
for num_data =0; num_data <8; num_data++)
{
CANMSG = 00h;
}
}
// Configure the bit timing
CANBT1 = xxh
CANBT2 = xxh
CANBT3 = xxh
0
1
TxDC
RxDC’
AUTOBAUD
CANGCON.3
RxDC
TxDC’