LPC2294 CAN-LED

Hi , i’m new here and i hope someone could help me. I have two lpc2294 (Olimex Boards) Im developing a CAN interface in order to send and receive data between CAN controllers 2 and 1.

I downloaded user manual and the “Philip s ARM7 insider guide”.

CAN controllers 2 “ transmit data” is intialized as the following pieces of code show :

#include “LPC22xx.H”

int main(void)

{

VPBDIV = 0x00000001; //Set PClk to 60Mhz

PINSEL1 |= 0x00010000; //Enable P0.24 TD2

C2MOD = 0x00000001; //Set CAN controller into reset

C2BTR = 0x001C001D; //Set bit timing to 125k

C2MOD = 0x00000000; //Release CAN controller

while (1)

{

C2TFI1 = 0x00040000; //Set DLC to 4 bytes

C2TID1 = 0x00000022; //Set address to 2 Standard Frame

C2TDA1 = 0x40000000; //Copy some data into first four bytes

C2CMR = 0x00000001; //Transmit the message

}

}

The programm is working and i can send the data .

So now i’m trying to turn the LED on, while CAN controller 1 is receiving the data from the controller 2.This is my recieve programm for CAN controller 1:

#include “LPC22xx.H”

int main(void)

{

while (1){

VPBDIV = 0x00000001; //Set PClk to 60MHz

IODIR1 = 0x00FF0000; // set all ports to output

PINSEL1|= 0x00040000; //Enable Pin 0.25 as RD1 CAN1

C1BTR = 0x001C001D; //Set bit timing to 125k

//C1IER =0x00000011; //Enable the Receive interrupt

//C1CMR = 0x00000000; //release the receive buffer

//AFMR = 0x00000001; //Disable the Acceptance filters

C1MOD = 0x00000000; //Release CAN controller

do {

IODIR0 |= 0x40000000; // P0.30 output

IOCLR0 = 0x40000000;// turn LED on

}

}while (C1RDA);

}

The LED goes on when i connect the transmit TD2 and the receive pin RD1, But it dont goes off wehn i disconnet the two pin, i try to lose the problem without using an interrupt. Has anybody some idea or any CAN driver code examples specially for the olimex lpc2294 board. ”I’m sorry for my bad english”

Thank you.