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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,748 次查看
hhhosi
Contributor I

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.

标签 (1)
1 解答
1,564 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi hh hosi,

Thank you for your interest in NXP Semiconductor products and 
the opportunity to serve you.
To provide the fastest possible support, Please refer to CAN_Bypass demo in the following library to view the details.
Have a great day,

TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

2 回复数
1,565 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi hh hosi,

Thank you for your interest in NXP Semiconductor products and 
the opportunity to serve you.
To provide the fastest possible support, Please refer to CAN_Bypass demo in the following library to view the details.
Have a great day,

TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,564 次查看
hhhosi
Contributor I

Thank you that made it work.

0 项奖励
回复