AnsweredAssumed Answered

LPC1788: Is there any way to read all packets on CAN bus without filtering them?

Question asked by hh hosi on May 30, 2017
Latest reply on May 30, 2017 by hh hosi

I have been working on LPC1788's CAN bus. I have no problem, using it in normal mode where I provide an ID and can read the received packets.

I wanted to read all packets on the CAN bus and it seems I have to use "bypass mode" to achieve this. Unfortunately, when I enter bypass mode, I cannot read any data from the CAN bus. I've tried both interrupt and polling modes.

 

This is the relevant section of the code:

 

PINSEL_ConfigPin (0, 0, 1);
 
  PINSEL_ConfigPin (0, 1, 1);
 
  //Initialize CAN1
  CAN_Init(CAN_1, 500000);  
 
  if(normal_mode) //filter mode
  {
   //Enable Receive Interrupt
   CAN_SetAFMode(CAN_NORMAL); //normal filtering mode
   CAN_IRQCmd(CAN_1, CANINT_RIE, ENABLE); //receive enable
   CAN_IRQCmd(CAN_1, CANINT_FCE, ENABLE); //full interrupt enable
   CAN_IRQCmd(CAN_1, CANINT_IDIE, DISABLE); //ID ready interrupt disable (only used for bypassmode)
  }
  else //bypass mode
  {
   CAN_SetAFMode(CAN_ACC_BP); //bypass mode get everything
   CAN_IRQCmd(CAN_1, CANINT_RIE, ENABLE); //receive enable
   CAN_IRQCmd(CAN_1, CANINT_FCE, ENABLE); //full interrupt enable
   CAN_IRQCmd(CAN_1, CANINT_IDIE, ENABLE); //ID ready interrupt enable
  }

 

 

Any help will be much appreciated.

Outcomes