AP29000
Connecting C166 and C500 Microcontroller to CAN
Ways of handling the SAE 81C90/91 and the CAN Module on the C167CR / C515C
Application Note
47
V 1.0, 2004-02
•
In the Bit Timing Register, the baudrate then can be configured (e.g. to 125 kbit/s)
(see also section 5.3).
/* load Bit Timing Register */
C167CR:
BTR
= 0x4944;
/* = 125 kbit/s (@ fCPU = 20 Mhz)
*/
/* 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 0 */
/* - TSEG2 TSEG1 SJW|<-- BRP -->| */
C515C:
BTR0
=
0x41;
BTR1
=
0x6B;
/* = 125 kbit/s (@ fCPU = 5 MHz)*/
/* 0 1 1 0 1 0 1 1 <BTR1 BTR0> 0 1 0 0 0 0 0 1 */
/* - TSEG2 TSEG1 SJW|<-- BRP -->| */
•
If Standard CAN is used then the "Global Mask Short" has to be initialized according
to the identifier bits to be used for acceptance filtering (application specific). Shall all
bits of the 11-bit identifier be evaluated, then all respective bits of the "Global Mask
Short" are set to "1":
C167CR:
GMS
= 0xE0FF;
/* Global Mask Short (Adr. EF06h) */
/* 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 */
/* 2 1 1 2 2 2 2 2 2 2 2 (Ident.-Bits */
/* 0 9 8 - - - - - 8 7 6 5 4 3 2 1 18 - 28) */
C515C:
GMS0
=
0xFF;
/* Global Mask Short Low (Adr. F706h) */
GMS1
=
0xE0;
/* Global Mask Short High (Adr. F707h) */
/* 1 1 1 0 0 0 0 0 <GMS1 GMS0> 1 1 1 1 1 1 1 1 */
/* 2 1 1 (Id.-Bits 2 2 2 2 2 2 2 2 */
/* 0 9 8 - - - - - 18-28) 8 7 6 5 4 3 2 1 */