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

cross mob
DevinHuang
Level 3
Level 3
Distributor - Weikeng(GC)
100 sign-ins 10 replies posted 5 replies posted

Does TC297 CANR support CANFD? I currently test CAN nodes that can reach 5Mbit/s. However, when testing the CANR nodes speed at 5Mbit/s, errors will be occured.

0 Likes
1 Solution
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored

The pinDriver is set per default from IfxMultican_Can_Node_initConfig to IfxPort_PadDriver_cmosAutomotiveSpeed2 which is weak in case of P34.1 (LP pin) and not usable for CAN FD. Change the configuration to IfxPort_PadDriver_cmosAutomotiveSpeed1 (medium):

canNodeConfig.pinDriver = IfxPort_PadDriver_cmosAutomotiveSpeed1;

If I remember correct then you must always use MP or MP+ pins with corresponding setting to match that the rise and fall time don't violate the CAN-FD spec.

View solution in original post

5 Replies
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored

Which pins you are using for the test?

0 Likes
DevinHuang
Level 3
Level 3
Distributor - Weikeng(GC)
100 sign-ins 10 replies posted 5 replies posted

This is my example:

IfxMultican_Can_initModuleConfig(&g_multican.canConfig, &MODULE_CAN);

g_multican.canConfig.nodePointer[0].priority = ISR_PRIORITY_CAN_RX;

IfxMultican_Can_initModule(&g_multican.can, &g_multican.canConfig);

//canr
IfxMultican_Can_initModuleConfig(&g_multicanr.canConfig, &MODULE_CANR);

g_multicanr.canConfig.nodePointer[0].priority = ISR_PRIORITY_CANR_RX;

IfxMultican_Can_initModule(&g_multicanr.can, &g_multicanr.canConfig);


IfxMultican_Can_Node_initConfig(&g_multican.canNodeConfig, &g_multican.can);

// g_multican.canNodeConfig.loopBackMode = TRUE;
g_multican.canNodeConfig.flexibleDataRate = TRUE;

g_multican.canNodeConfig.fdConfig.nominalBaudrate = 500000;
g_multican.canNodeConfig.fdConfig.nominalSamplePoint = 8000;
g_multican.canNodeConfig.fdConfig.nominalSynchJumpWidth = 2000;
g_multican.canNodeConfig.fdConfig.fastBaudrate = 2000000;
g_multican.canNodeConfig.fdConfig.fastSamplePoint = 7000;
g_multican.canNodeConfig.fdConfig.fastSynchJumpWidth = 2000;
g_multican.canNodeConfig.fdConfig.loopDelayOffset = 0;

IfxMultican_Can_Node_initConfig(&g_multicanr.canNodeConfig, &g_multicanr.can);

// g_multicanr.canNodeConfig.loopBackMode = TRUE;
g_multicanr.canNodeConfig.flexibleDataRate = TRUE;

g_multicanr.canNodeConfig.fdConfig.nominalBaudrate = 500000;
g_multicanr.canNodeConfig.fdConfig.nominalSamplePoint = 8000;
g_multicanr.canNodeConfig.fdConfig.nominalSynchJumpWidth = 2000;
g_multicanr.canNodeConfig.fdConfig.fastBaudrate = 2000000;
g_multicanr.canNodeConfig.fdConfig.fastSamplePoint = 7000;
g_multicanr.canNodeConfig.fdConfig.fastSynchJumpWidth = 2000;
g_multicanr.canNodeConfig.fdConfig.loopDelayOffset = 0;

/* ==========================================================================================
* CAN node 0 configuration and initialization:
* ==========================================================================================
* - assign the node to CAN node 0
* - initialize the CAN node 0 with the modified configuration
* ==========================================================================================
*/
g_multican.canNodeConfig.nodeId = IfxMultican_NodeId_0;

g_multican.canNodeConfig.rxPin = &IfxMultican_RXD0B_P20_7_IN;
g_multican.canNodeConfig.rxPinMode = IfxPort_InputMode_pullUp;
g_multican.canNodeConfig.txPin = &IfxMultican_TXD0_P20_8_OUT;
g_multican.canNodeConfig.txPinMode = IfxPort_OutputMode_pushPull;

IfxMultican_Can_Node_init(&g_multican.canNode0, &g_multican.canNodeConfig);

/* ==========================================================================================
* CAN node 1 configuration and initialization:
* ==========================================================================================
* - assign the node to CAN node 1
* - initialize the CAN node 1 with the modified configuration
* ==========================================================================================
*/
g_multicanr.canNodeConfig.nodeId = IfxMultican_NodeId_0;

g_multicanr.canNodeConfig.rxPin = &IfxCanr_RXD0B_P14_1_IN;
g_multicanr.canNodeConfig.rxPinMode = IfxPort_InputMode_pullUp;
g_multicanr.canNodeConfig.txPin = &IfxCanr_TXD0_P14_0_OUT;
g_multicanr.canNodeConfig.txPinMode = IfxPort_OutputMode_pushPull;

IfxMultican_Can_Node_init(&g_multicanr.canNode0, &g_multicanr.canNodeConfig);

/* ================================================================================================================
* Source standard message objects configuration and initialization:
* ================================================================================================================
* - load the default CAN message object configuration into the configuration structure
*
* - define the message object as a transmit message object (common setting for all source message objects)
* - define acceptance of the frame with only matching IDE (common setting for all source message objects)
*
* - define the message object ID (each message object ID value should be unique)
* - define the CAN message ID used during arbitration phase
* - define the standard or extended frame to be used
* - define the message object that holds data bytes 8 to 35 (top message)
* - define the message object that holds data bytes 36 to 63 (bottom message)
*
* - define the length of the transmitted data (related to MOFCRn.DLC, MOFCRn.FDF, MOFGPR.BOT, and MOFGPR.TOP bitfields)
* - define the usage of bit rate switching (related to MOFCRn.BRS bitfield)
*
* - initialize the source standard CAN message object with the modified configuration
* ----------------------------------------------------------------------------------------------------------------
* These CAN message objects are assigned to CAN Node 0
* ================================================================================================================
*/
IfxMultican_Can_MsgObj_initConfig(&g_multican.canMsgObjConfig, &g_multican.canNode0);

g_multican.canMsgObjConfig.frame = IfxMultican_Frame_transmit;
g_multican.canMsgObjConfig.control.matchingId = TRUE;

for(currentCanMessageObject = 0; currentCanMessageObject < NUMBER_OF_CAN_FD_CASES; currentCanMessageObject++)
{
g_multican.canMsgObjConfig.msgObjId = (IfxMultican_MsgObjId)currentCanMessageObject;
g_multican.canMsgObjConfig.messageId = g_messageObjectConf[currentCanMessageObject].messageId;
g_multican.canMsgObjConfig.control.extendedFrame = g_messageObjectConf[currentCanMessageObject].extendedFrame;
g_multican.canMsgObjConfig.control.topMsgObjId = (2 * currentCanMessageObject) + SRC_EXTENDED_MO_OFFSET;
g_multican.canMsgObjConfig.control.bottomMsgObjId = g_multican.canMsgObjConfig.control.topMsgObjId + 1;

g_multican.canMsgObjConfig.control.messageLen = g_messageObjectConf[currentCanMessageObject].messageLen;
g_multican.canMsgObjConfig.control.fastBitRate = g_messageObjectConf[currentCanMessageObject].fastBitRate;

IfxMultican_Can_MsgObj_init(&g_multican.canSrcMsgObj[currentCanMessageObject], &g_multican.canMsgObjConfig);
}

/* ================================================================================================================
* Destination standard message objects configuration and initialization:
* ================================================================================================================
* - load the default CAN message object configuration into the configuration structure
*
* - define the message object as a receive message object (common setting for all destination message objects)
* - define acceptance of the frame with only matching IDE (common setting for all destination message objects)
* - enable interrupt generation in case of CAN message reception (common setting for all destination message objects)
* - define interrupt node pointer to be used (all destination message objects share the SAME node)
*
* - define the message object ID (each message object ID value should be unique)
* - define the CAN message ID used during arbitration phase (should match the source message objects ID)
* - define the standard or extended frame to be used
* - define the message object that holds data bytes 8 to 35 (top message)
* - define the message object that holds data bytes 36 to 63 (bottom message)
*
* - define the length of the received data (related to MOFGPR.BOT and MOFGPR.TOP bitfields)
*
* - initialize the source standard CAN message object with the modified configuration
* ----------------------------------------------------------------------------------------------------------------
* These CAN message objects are assigned to CAN Node 1
* ================================================================================================================
*/
IfxMultican_Can_MsgObj_initConfig(&g_multicanr.canMsgObjConfig, &g_multicanr.canNode0);

g_multicanr.canMsgObjConfig.frame = IfxMultican_Frame_receive;
g_multicanr.canMsgObjConfig.control.matchingId = TRUE;
g_multicanr.canMsgObjConfig.rxInterrupt.enabled = TRUE;
g_multicanr.canMsgObjConfig.rxInterrupt.srcId = 0;

for(currentCanMessageObject = 0; currentCanMessageObject < NUMBER_OF_CAN_FD_CASES; currentCanMessageObject++)
{
g_multicanr.canMsgObjConfig.msgObjId = (IfxMultican_MsgObjId)(currentCanMessageObject + DST_MO_OFFSET);
g_multicanr.canMsgObjConfig.messageId = g_messageObjectConf[currentCanMessageObject].messageId;
g_multicanr.canMsgObjConfig.control.extendedFrame = g_messageObjectConf[currentCanMessageObject].extendedFrame;
g_multicanr.canMsgObjConfig.control.topMsgObjId = (2 * currentCanMessageObject) + DST_EXTENDED_MO_OFFSET;
g_multicanr.canMsgObjConfig.control.bottomMsgObjId = g_multicanr.canMsgObjConfig.control.topMsgObjId + 1;

g_multicanr.canMsgObjConfig.control.messageLen = g_messageObjectConf[currentCanMessageObject].messageLen;

IfxMultican_Can_MsgObj_init(&g_multicanr.canDstMsgObj[currentCanMessageObject], &g_multicanr.canMsgObjConfig);
}
}

0 Likes
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored

P14.0/P14.1 can be used for CAN node 1 but not for CANr.

You must use pins usable for CANr. Please note that the TXD pin should be MP or MP+ pin.

0 Likes
DevinHuang
Level 3
Level 3
Distributor - Weikeng(GC)
100 sign-ins 10 replies posted 5 replies posted

If I use CANr node0 PIN:

canNodeConfig.nodeId = IfxMultican_NodeId_0;
canNodeConfig.rxPin = &IfxMultican_RXD0G_P34_2_IN;
canNodeConfig.txPin = &IfxMultican_TXD0_P34_1_OUT;

(CAN 2.0 can output normally)

DevinHuang_0-1695365364343.png

 

 

(Using CAN FD will display ERROR From signal)

DevinHuang_1-1695365839088.png

The analysis tool I use supports CANFD

So I'm curious whether CANr supports CAN FD function?

 

 

0 Likes
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored

The pinDriver is set per default from IfxMultican_Can_Node_initConfig to IfxPort_PadDriver_cmosAutomotiveSpeed2 which is weak in case of P34.1 (LP pin) and not usable for CAN FD. Change the configuration to IfxPort_PadDriver_cmosAutomotiveSpeed1 (medium):

canNodeConfig.pinDriver = IfxPort_PadDriver_cmosAutomotiveSpeed1;

If I remember correct then you must always use MP or MP+ pins with corresponding setting to match that the rise and fall time don't violate the CAN-FD spec.