Hi all.
I’m a new lpc developer, I’v bought an Olimex lpc2129 board (which has
embedded 2 x DB9 connectors for UART/COM ports and 2x CAN ports).
There are a PCA82C250 tranceivers for CAN protocol.
I’ve read couple topics here with similar problems but I havent found
an answere becouse people have
problems mostly with FullCan hardware acceptance filters but they
usually are able to get some messages with filter off.
I’m programming flash with H-JTAG (H-Flasher + macgraigor’s JTAG [sdk
- eclipse]) with corrected checksum in LPC2000 for addres 0x00000014.
I’m using a 12MHz cristal, running on Cclk = Pclk = 60MHz (vpbdiv = 0x1),
All other peripherials like uart, gpio for 1-wire works perfectly,
but I have problem with receiving a CAN message.
I tried to run FullCan_SW, without any succes, this same was with
CANAll_v110 demo program.
I’ve checked CANbus activity with SYS-TEC gw-002 profesional CANbus
monitor and I know that I can
send correct message at any baud rate (but I use 125kb/s).
This simple example doesn’t receive anything at all either:
void CANIRQ(void) __attribute__ ((interrupt)); //declaration of VI
..
..
..
main()
{
CANALL_MSG MsgBuf; // CANALL buffor declaration
PINSEL1 |= 0x00040000; // set pin 0.25 as RDx
C1MOD = 0x00000001; // set CAN in reset mode
C1BTR = CANBitrate125k_12MHz; // setting baud rate
C1IER = 0x00000001; // CAN RX interrupt enable
VICVectCntl0 = 0x0000003a; // set priority
VICVectAddr0 = (unsigned)CANIRQ;
VICIntEnable = 0x04000000;
AFMR = 0x00000001; // Acceptance filter off
C1MOD = 0x00000000; // activity CAN
/* code from CANALL */
// CAN interface 2, use IRQVec1, at 125kbit
CANAll_Init(2,1,CANBitrate125k_12MHz);
// Set CAN Err ISR to IRQVec2
CANAll_SetErrIRQ(2);
// Initialize MsgBuf
MsgBuf.Frame = 0x00080000L; // 29-bit, no RTR, DLC is 8 bytes
MsgBuf.MsgID = 0x00000345L; // CAN ID
MsgBuf.DatA = 0xffffffffL; // all zeros
MsgBuf.DatB = 0xffffffffL; // all zeros
// Transmit initial message on CAN 2
CANAll_PushMessage(2,&MsgBuf);
while(1){
CANAll_PushMessage(2,&MsgBuf);
delayms(100);
};
}
void CANIRQ(void){
unsigned int cos;
cos = C1RDA;
IOCLR0 = LED1; //LED ON
delayms(500);
IOSET0 = LED1;// LED OFF
delayms(500);
C1CMR = 0x00000004; // free receiving buffer
VICVectAddr = 0x00000000; // acknowledge finish interrupt
};
I’m starting think that there is something wrong with hardware, for
example receivers are broken.
I’ve no idea, I’ll be very gratefull for any ideas/help.
I’ve checked the voltage in this configuration an it’s 3.3[V] on each
LPC CAN pin(9,10,3,5).
Cheers