This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC2129 CAN Register initialization

I am sending data one byte at a time on CAN2 Tx and receiving it on CAN1 Rx. Is the following initialization correct for CAN1 for receiving data ?

#define StandardFilter (*((volatile unsigned long *) 0xE0038000));this is where the acceptance filter RAM starts

void init_can1_Rx(void)
        {PINSEL1 |= 0x00050000;//Enable Pin 0.25 as CAN1 RX and 0.24 as CAN2 TX
        C1MOD    =      0x00000001;//Set CAN controller into reset
        C1BTR    =  0x001C001D;//Set bit timing to 125k
        C1IER    =      0x00000001;//Enable the Receive interrupt
        VICVectCntl0 =  0x0000003A;//select the priority channel=26 for a given interrupt.Bit5=1 means interrupt is enabled
         VICVectAddr0=(unsigned long)CAN1IRQ;// Pass address of IRQ in to VIC slot                                                                                                              //Bits 4:0 =11010 means s/w interrupt #26 is assigned to VicVectCntl0
        VICIntEnable        =   0x04000000;//enable interrupt no 26 of the 0 to 31 interrputs
        AFMR                    =       0x00000001;//Disable the Acceptance filters to allow setup of the table
        StandardFilter      =   0x20012002;//std individual identifier nos 1 and 2 of controller#1 (node number)
        SFF_sa                      =   0xE0038000;//Set start address of Standard table
        SFF_GRP_sa                      =       0x00000008;//Set start address of Standard group table
        EFF_sa                          =       0x00000008;//Set start address of Extended table
        EFF_GRP_sa                      =       0x00000008;//Set start address of Extended group table
        ENDofTable                      =       0x00000008;//Set end of table address
        AFMR                            =       0x00000000;//Enable Acceptance filters.If this is set to 0x00000002,then ALL messages are reeived ==> no filtering
        C1MOD                           =       0x00000000;//Release CAN controller

        }


Since i am only sending one byte to node 2, i use only one standard identifier and have set the SFF_sa to the acceptance filter address.

But my doubt is as i am not using the extended and group identifiers, what address should i set them to? The user manual says that if unused, SFF_GRP_sa should be identical to EFF_sa which should be identical to EFF_GRP_sa which again should be identical to ENDofTable. So i set all the unused filters to an arbitraty value of 0x00000008.

In my program, the TX happens properly but the CAN1 Rx interrupt is not happening, which means it is not sensing the data being transmitted, which makes me think something is wrong the way i have set up the acceptance filers.