Clarification with four CAN channels

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Clarification with four CAN channels

Jump to solution
433 Views
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

Labels (1)
Tags (2)
1 Solution
303 Views
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

View solution in original post

1 Reply
304 Views
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