MultiCAN FIFO implementation

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User16280
Level 1
Level 1
Hi,

I am raising an issue related to MultiCAN module on TC23x.

I have configured two message object to list two. But i always see the messages are received only by 1 message object. I have configured FIFO base message object as well but i see a similar behavior.

Can anyone suggest me where am i going wrong? Below mentioned are the screenshots of message objects and i am attaching initialization code for reference.

Code:

/* CAN Initialization Bits NCRx.INIT and NCRx.CCE
Are Set For CAN node 2 */
Can_Reg_4->Node_1_Control_Reg = 0x00000041;
/* Configure The Port Pin P14.0 & P14.1 For CAN Node1 */
Can_Reg_4->Node_1_Port_Control_Reg = 0x00000001;
/* Load the TSEG1=11, Tseg2=2, BRP=09 values */
Can_Reg_4->Node_1_Bit_Timing_Reg = 0x00002B09;
Can_Reg_4->Node_1_Frame_Counter_Reg = 0x00000000;
/* Configuration Of The CAN Message Object List Structure
Allocate MOs 0,1,2 To List 2: */
while(Can_Reg_3->Panel_Control_Reg & (0x00000100 | 0x00000200)); // busy?
Can_Reg_3->Panel_Control_Reg = (2 << 24)|(0 << 16)| 2; // MO 0 to list 2
while(Can_Reg_3->Panel_Control_Reg & (0x00000100 | 0x00000200)); // busy?
Can_Reg_3->Panel_Control_Reg = (2 << 24)|(4 << 16)| 2; // MO 1 to list 2
while(Can_Reg_3->Panel_Control_Reg & (0x00000100 | 0x00000200)); // busy?
Can_Reg_3->Panel_Control_Reg = (2 << 24)|(2 << 16)| 2; // MO 2 to list 2
while(Can_Reg_3->Panel_Control_Reg & (0x00000100 | 0x00000200)); // busy?
Can_Reg_3->Panel_Control_Reg = (2 << 24)|(3 << 16)| 2; // MO 3 to list 2
while(Can_Reg_3->Panel_Control_Reg & (0x00000100 | 0x00000200)); // busy?
Can_Reg_3->Panel_Control_Reg = (2 << 24)|(1 << 16)| 2; // MO 4 to list 2
/* Configuration Of Message Object 0:
- Message Object 0 is set for Physical ID Reception
- Message Object 0 is Valid
- Message Object 0 Is Used As Receive Object
- Message Object 0 Is Assigned To List 2 (Node 1) */
Can_Reg_5->Message_Object_0_Control_Reg = 0x00800000;
/* Set Message Object0 As Standard Message Object
And To Receive Upto 8 Valid Data Bytes */
Can_Reg_5->Message_Object_0_Function_Control_Reg = 0x08000001 ;
/* Set Message Object0 To Receive Frames Only With Matching Ide Bit */
Can_Reg_5->Message_Object_0_Acceptance_Mask_Reg = 0x3FFFFFFF;
/* Set Message Object0 To Handle Standard Frames With
11-Bit Identifier 0x73C */
Can_Reg_5->Message_Object_0_Arbitration_Reg = 0x5CF00000;
/* Set MSGVAL bit to finish configuration */
Can_Reg_5->Message_Object_0_Control_Reg = 0x00200000;

/* Configuration Of Message Object 0:
- Message Object 4 is set for Physical ID Reception
- Message Object 4 is Valid
- Message Object 4 Is Used As Receive Object
- Message Object 4 Is Assigned To List 2 (Node 1) */
Can_Reg_5->Message_Object_4_Control_Reg = 0x00800000;
/* Set Message Object4 As Standard Message Object
And To Receive Upto 8 Valid Data Bytes */
Can_Reg_5->Message_Object_4_Function_Control_Reg = 0x08000000;
/* Set Message Object4 To Receive Frames Only With Matching Ide Bit */
Can_Reg_5->Message_Object_4_Acceptance_Mask_Reg = 0x7FFFFFFF;
/* Set Message Object4 To Handle Standard Frames With
11-Bit Identifier 0x73C */
Can_Reg_5->Message_Object_4_Arbitration_Reg = 0x5CF00000;
/* Set MSGVAL bit to finish configuration */
Can_Reg_5->Message_Object_4_Control_Reg = 0x00200000;

Please ask if any further clarification is required.
0 Likes
1 Reply
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
Hi vvssg. Instead of inventing a whole new API, have you tried using the sample code from the iLLD? In the help file (under Modules -> MULTICAN -> How to use the CAN Interface driver), there's a FIFO based Transfer example:

//add the following defines to your code globally
#define FIFO_SIZE 16
#define FIFO_SIZE 8


// IfxMultican_Can_MsgObj canSrcMsgObj; // defined globally
{
// create message object config
IfxMultican_Can_MsgObjConfig canMsgObjConfig;
IfxMultican_Can_MsgObj_initConfig(&canMsgObjConfig, &canSrcNode);

// FIFO MsgObj allocation:
canMsgObjConfig.msgObjId = 0; // will allocate MsgObj 0
canMsgObjConfig.msgObjCount = FIFO_SIZE/2;
canMsgObjConfig.firstSlaveObjId = 1;

canMsgObjConfig.messageId = id; // 'id' defined gloabally
canMsgObjConfig.acceptanceMask = 0x7FFFFFFFUL;
canMsgObjConfig.frame = IfxMultican_Frame_transmit;
canMsgObjConfig.control.messageLen = IfxMultican_DataLengthCode_8;
canMsgObjConfig.control.extendedFrame = FALSE;
canMsgObjConfig.control.matchingId = TRUE;

// initialize message object
IfxMultican_Can_MsgObj_init(&canSrcMsgObj, &canMsgObjConfig);
}

// IfxMultican_Can_MsgObj canDstMsgObj; // defined globally
{
// create message object config
IfxMultican_Can_MsgObjConfig canMsgObjConfig;
IfxMultican_Can_MsgObj_initConfig(&canMsgObjConfig, &canDstNode);

// FIFO MsgObj allocation:
canMsgObjConfig.msgObjId = FIFO_SIZE + 1; // avoid clashing with transmit FIFO message objects
canMsgObjConfig.msgObjCount = FIFO_SIZE;

canMsgObjConfig.firstSlaveObjId = FIFO_SIZE + 2;

canMsgObjConfig.messageId = id; // 'id' defined gloabally
canMsgObjConfig.acceptanceMask = 0x7FFFFFFFUL;
canMsgObjConfig.frame = IfxMultican_Frame_receive;
canMsgObjConfig.control.messageLen = IfxMultican_DataLengthCode_8;
canMsgObjConfig.control.extendedFrame = FALSE;
canMsgObjConfig.control.matchingId = TRUE;

// initialize message object
IfxMultican_Can_MsgObj_init(&canDstMsgObj, &canMsgObjConfig);
}
0 Likes