Hello Kerry,
Thanks for your kind reply.
Sorry for the late response.
I got my code working. The issue was with the acceptance filtering in CAN2.
The acceptance filter and the Mask were not set properly. Even though the messages were received in the receive buffers, the received ID's were not matched with filter ID's. So the Receive Status(Bit 0 in GSR) bit in Status register was not set further Interrupt(Bit 0 in ICR) was not set. Hence the control was not entering into CAN IRQ Handler.
I used this piece of code for setting Acceptance filter and mask
void init_AF( void )
int32_t address = 4;
/*off mode*/
LPC_CANAF->AFMR = 0x00000001;
/* Set explicit standard Frame*/
LPC_CANAF->SFF_sa = address;/* word 1*/
/* CAN2 IDENT FORCE1*/
LPC_CANAF_RAM->mask[1]=(0X001 << 29) | (0X400 << 16)| (1<<27)|
(0X001 << 13)| (0X500 ) | (1<<11) ;
/* Only Frame ID 0x400 and 0x500 are received in MBED.*/
address+=4;/*add 4 bytes (1 long word) to point to none used word.*/
/* Set group standard Frame*/
LPC_CANAF->SFF_GRP_sa = address;
/* Set explicit extended Frame*/
LPC_CANAF->EFF_sa = address;
/* Set group extended Frame*/
LPC_CANAF->EFF_GRP_sa = address;
/* Set End of Table */
LPC_CANAF->ENDofTable = address;
/* All have ENDofTable address means are not used.*/
/*normal mode*/
LPC_CANAF->AFMR = 0x00000000;
return;
/* end Program */
I will also try the LPC open code available in link provided by you.
Thanks for your support.
Have a great day.