Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] CAN interrupt problem

2005-04-11 by Richard Duits

Hello Artturi,

To use the CAN controller you need to connect both CAN-RX and CAN-TX 
pins to a CAN tranceiver, which is connected to the CAN bus. In your 
code I see only the CAN-RX in the PINSEL.

I never figured out which status bits are connected to what interrupt 
source, so I routed all interrupts for can status and the can controller 
to the same interrupt and it works fine.

Also make sure you have the latest documentation, the first version has 
many errors in the CAN documentation.

Richard.


artturi wrote:

> I still haven't managed to get this working. Could someone give me
> little advice please?
>
> //Artturi
>
> artturi wrote:
>
> > 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

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.