Readme file for EW CAN Library for NXP LPC2129 V1.00A

Updated: 5/Dec/2005 [JEVJ]
Archived: $Revision: 7689 $

This is the readme file for the EW CAN library package. The library makes it easy to create an application using the LPC2129 CAN module. The library has been developed and tested using IAR LPC2129 KickStart Kit. 

The date format used throughout this file is: dd/Mmm/YYYY.

Contents

Highlights

CAN Library, <ew_can.c> and <ew_can.h>

This module contains the CAN library functions for NXP LPC2129. The following functions are included:

Initialization functions:

Run-time functions:

Interrupt functions:

CAN Definitions, <user_can_def.h>

This file is intended to be updated by users and contains the application specific CAN definitions used by the CAN library. Update this file according to application requirements. 

CAN module setting: 

  1. CAN pin usage - RD2, TD2, and RD1 are enabled.. (TD1 is by default enabled in LPC2129)
  2. CAN Mode is set as Priority depends on Tx priority field.
  3. CAN Interrupt - CAN1 interrupt disabled (polled by application), CAN2 RX interrupt enabled.
  4. CAN Bit timing - Clock = 100 usec/bit, SAM =0 Bus is sampled once, TSEG1 = 0xC=12, TSEG2 = 1, SJW = 0, BRP = 0x16 =22
  5. Acceptance filter mode - AcceptanceFilter Full CAN message is used.
  6. User code macros for CAN2 RX interrupts are defined

Application usercode, <usercode.c>

Contains application source code. This file can be used as a basic platform for CAN application development. CAN module settings made in <user_def.h> are used.

Software overview : 

  1. GPIO, and interrupt are initialized. CAN1 interrupt disabled (polled by application), CAN2 RX interrupt enabled.
  2. CAN module is initialized using EW_Init_CAN() 
  3. Used CAN IDs are initialized using EW_AddFilter_CAN().  The CAN filter uses the 5 different filter types
    A. Full standard ID messages 
    B. Standard ID messages
    C. Standard Group ID messages
    D. Extended ID messages
    E. Extended Group ID messages
  4. CAN messages are sent between CAN1 and CAN2
    CAN1 is polled to detect received CAN message
    CAN2 uses receive interrupt to detect rx message
  5. The LEDs will toggle if CAN messages are running
  6. Button B1 can be used to stop CAN messages
    Button B2 can be used to start CAN messages

Please read the information in <usercode.c> to get a more detailed view of the operation and how the CAN library is intended to be used.

Hardware

Hardware requirements:    

The application runs on an IAR LPC2129 KickStart kit but the following additional connections are needed:

  1. An external power supply connected to PWR-JACK. (7.5 Volt has been used during test).
  2. A CAN bus connected between D-sub connector CAN1 and CAN2 in the following way:
            CAN1                        CAN2
            pin2 ---- CANL ----  pin2
            pin7 ---- CANH ----  pin7

Product contents

Trademarks


http://www.iar.com/

Copyright 2005 IAR Systems. All rights reserved.