| Code Module #3 - CAN Low Level Interface | |
EMICROS - Embedded Micro Software, Last Update: 11/08/08 |
|
| Introduction | |
| The CANTEC11 uses an Intel 82527 to interface to the Controller Area Network (CAN). The 82527 contains 256 internal registers for controlling network initialization and message management. The registers are addressed from 0x5000 to 0x50ff on the CANTEC11 board. | |
| Register Access | |
| The 68HC11 read access timing violates the
timing specified for the slow speed registers in the 82527. To eliminate this timing
problem, the 82527 has a High Speed Read Register to allow the 68HC11 to read the slow
speed registers. The Double Read Operation requires the register to be read first, where
the 82527 transfers the register contents into the high speed register, and secondly to
read the high speed register. The qcReadRegister subroutine is written in assemble language and is in the file readcan.s. The 82527 register to read is passed to qcReadRegister in the B register. The subroutine performs the double read and returns the contents of the register in the B register. Header file readcan.h contains the prototype for using with C. Writing to the 82527 does not require any special consideration like the double read used to read a register. The sCANreg structure is defined (typedef) as an array of 256 unsigned characters. A pointer, *pCANr, is defined to point to the array and initialized to point to address 0x5000 when main() executes. Examples of reading and writing to the 82527 CAN controller are in the cm3.c file. |
|
| Software | |
| The files needed are; To compile the files, use the following statements; set ICC11_LINKER_OPTS=-btext:0xe000 -bdata:0x6000
-dinit_sp:0x7fff -dheap_size:0 |
|
Last Update: 11/08/08