Clarification with four CAN channels

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

Clarification with four CAN channels

跳至解决方案
1,057 次查看
rahulkrishna
Contributor IV

Hi everyone,

There are four CAN channels in the S12xEQ512. Should a separate function be used for the CAN receive channels or a single function should be used. If a single function is provided then if the messages

are coming exactly at the same time from four different channels, then the same interrupt function will be called but with different parameters, how does the xgate or s12x handle this scenario. I mean to say does the code not become reentrant.

 

Example:

const xgate_vector XGATEVectorTable[] =

{

  {XGATE_CAN_Transmit, &XGCAN4},  // Channel 48 - CAN4 transmit           

  {XGATE_CAN_Receive, &XGCAN4},  // Channel 49 - CAN4 receive            

  {XGATE_CAN_Transmit, &XGCAN3},  // Channel 4C - CAN3 transmit           

  {XGATE_CAN_Receive, &XGCAN3},  // Channel 4D - CAN3 receive            

  {XGATE_CAN_Transmit, &XGCAN2},  // Channel 50 - CAN2 transmit

  {XGATE_CAN_Receive, &XGCAN2},  // Channel 51 - CAN2 receive

  {XGATE_CAN_Transmit, &XGCAN1},  // Channel 54 - CAN1 transmit

  {XGATE_CAN_Receive, &XGCAN1},  // Channel 55 - CAN1 receive

  {XGATE_CAN_Transmit, &XGCAN0},  // Channel 58 - CAN0 transmit

  {XGATE_CAN_Receive, &XGCAN0},  // Channel 59 - CAN0 receive

}

 

XGATE_CAN_Receive is the same function being used for all the channels. is it correct or do i need to use separate functions for each channel? Will there be any missing of messages if i use a single function.

 

Regards

标签 (1)
标记 (2)
1 解答
927 次查看
lama
NXP TechSupport
NXP TechSupport

Each channel has different vestor, however, common function can be called from the interrupts with information about CAN number or pointer to a CAN.

Something similar is solved in the attached example. You can see one of possible solutions when function's parameter is CAN number and the function then works with registers of given CAN. It is solved on CPU but there is no difference for XGATE.

Best Regards, Ladislav

在原帖中查看解决方案

1 回复
928 次查看
lama
NXP TechSupport
NXP TechSupport

Each channel has different vestor, however, common function can be called from the interrupts with information about CAN number or pointer to a CAN.

Something similar is solved in the attached example. You can see one of possible solutions when function's parameter is CAN number and the function then works with registers of given CAN. It is solved on CPU but there is no difference for XGATE.

Best Regards, Ladislav