[lpc2000] CAN interrupt problem
2005-04-07 by artturi
Hi
I'm using LPC2194
I have problem getting interrupt in CAN bus. Here is the parts of my
code that has some problem don't know what.
The Bus should be configured to 1 Mb. If someone could give me a tip
whats wrong I would be glad.
/////////////////////////
// PLL setup values are computed within the LPC include file
// It relies upon the following defines
#define FOSC (10000000) // Master Oscillator Freq.
#define PLL_MUL (1) // PLL Multiplier
// Pheripheral Bus Speed Divider
#define PBSD 1 // MUST BE 1, 2, or 4
#define PCLK (CCLK / PBSD) // Pheripheal Bus Clock Freq.
///////////////////////
// Interrupt Service Routines
void CAN1IRQ (void) __attribute__ ((interrupt));
//////////////////////
void CAN1IRQ (void){
blink();
C1CMR = 0x00000004; // Release the receive buffer
VICVectAddr = 0xFFFFFFFFL; // Acknowledge interrupt
}
////////////////////
can1InitRx(){
PINSEL1 |= 0x00040000; // Enable Pin 0.25 as CAN1 RX
AFMR = 0x00000002L; // Switch off the acceptance filters
C1MOD = 0x00000001; // Set CAN controller into reset
C1GSR = 0x00000000; // Clear Status Register
C1BTR = 0x430005; // 1MHz CAN bus rate
VICVectAddr0 = (unsigned int)CAN1IRQ; // Set And Enable receive interrupt
VICVectCntl0 = 0x0000003A; // select a priority slot for a
given interrupt p92 3a=26
VICIntEnable = 0x04000000L; // CAN1 Rx enable interrupt
C1IER = 0x00000001; //Enable the Receive interrupt
C1MOD = 0x00000000; //Release CAN controller
}
//Artturi