
AP29002
Standalone TwinCAN Controller
Using special features of the 82C900
Application Note 15 V 1.0, 2004-02
As a next step, the CAN message object for receiving must be set up. This is also
done by configuring a number of registers in the 82C900, the ‘CAN Message Object
Registers’:
//set up CAN message object 0 (RX), node A, interrupt node 1
// /OUT1 (associated with interupt node 1) is connected to P2.11 calling
the ISR when message object is received
SSC_SendByte(MSG_OBJ_BASE(0)+MSGCTRn,0x7F);
// set MSGVAL to '01' => reset
SSC_SendByte(MSG_OBJ_BASE(0)+MSGCTRn,0xFD);
// set INTPND to '01' => reset
SSC_SendByte(MSG_OBJ_BASE(0)+MSGCTRn+1,0x7F);
// set RMTPND to '01' => reset
SSC_SendByte(MSG_OBJ_BASE(0)+MSGCTRn+1,0xDF);
// set TRXQ to '01' => reset
SSC_SendByte(MSG_OBJ_BASE(0)+MSGCTRn+1,0xFD);
// set NEWDAT to '01' => reset
SSC_SendByte(MSG_OBJ_BASE(0)+MSGCFGn,0x10);
// select Node A, set DIR=0 (receive), 1 data byte (DLC=1)
SSC_SendByte(MSG_OBJ_BASE(0)+MSGCFGn+2,0x01);
// trigger interrupt node 1 when receiving message
SSC_SendByte(MSG_OBJ_BASE(0)+MSGCTRn+1,0xF7);
// set MSGLST to '01' => reset
SSC_SendByte(MSG_OBJ_BASE(0)+MSGCTRn,0xFB);
// set RXIE, receive interrupt is enabled
SSC_SendByte(MSG_OBJ_BASE(0)+MSGARn+2,0x04);
// identifier of receive object (0) is 0x0001
SSC_SendByte(MSG_OBJ_BASE(0)+MSGCTRn,0xBF);
// set MSGVAL, message object is valid
To be able to configure the message object, it must first be made invalid by resetting
MSGVAL in register MSGCTRn. Then you can configure the message object, set the data
direction, data length and associated interrupt node.
In the 82C900 there are two interrupt pins available, that can be associated with up to
4 interrupt nodes each by configuring the GLOBCTR register. Then you can associate
the single message objects with one interrupt node each. The corresponding interrupt
pin will be triggered, when the associated event occurs.
In this application the receive interrupt is enabled and the identifier of the receive
message object is set to 0x0001. After that the message is set valid.