Help us improve the Power & Sensing Selection Guide. Share feedback

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

cross mob
Level 1
Level 1
First question asked
Dear Sir,
I have tried your example code for the Loopback mode for CAN transmit and Receive part for standard CAN. But For receiving Part in extended ID. Receiving Message is not coming.
I have modify CANinit message API. .messageIdLength = IfxCan_MessageIdLength_extended, This I made a change. Also I filter application I have modify code whch is as follow:

IfxCan_Filter filter;

/* Set a range filter to accept the CAN message with Ids 0x00- 0x7ff*/

/* set filter0 for rxBuffer 0 */
filter.number = 0;
filter.elementConfiguration = IfxCan_FilterElementConfiguration_storeInRxBuffer;
// filter.type = IfxCan_FilterType_range;
filter.id1 = 0x1866FF05;
filter.rxBufferOffset = IfxCan_RxBufferId_0;

// IfxCan_Can_setStandardFilter(&g_CanBasic.drivers.canNode[0], &filter);
IfxCan_Can_setExtendedFilter(&g_CanBasic.drivers.canNode[0], &filter);

But Output is not coming. Can you please suggest me which setting I need to configure for extended ID? Please give me reply asap.

Thanks and regards,
Krunal Desai
3 Replies
Level 1
Level 1
First solution authored 5 replies posted First reply posted
Same finding here (@TC3x7).
I doubt, ExtendedFilter is related to extended ID (CAN 2.0.B) but a more sophisticated filter to define ID ranges or masks...
Anyway, extended IDs could not be received. Nor via ExtendedFilter nor after configuring extended Id for rxMsg (rxMsg.messageIdLength = IfxCan_MessageIdLength_extended) as well as for NodeConfig (canNodeConfig.filterConfig.messageIdLength = IfxCan_MessageIdLength_extended, various tries like canNodeConfig.filterConfig.rejectRemoteFramesWithExtendedId = FALSE...)
Could you please feedback, if there (and where) is any hint for extended ID receiving?

Unfortunately dirty hack to configure messageIdLength = IfxCan_MessageIdLength_both was not successful, too.

Thanks a lot & BR
Level 1
Level 1
First solution authored 5 replies posted First reply posted
I have to correct myself: result isn't changed - no extended IDs to receive..
But my assumption was wrong: IfxCan_Can_setExtendedFilter cannot support ext. CAN-IDs due to Ifx_CAN_STDMSG -> Ifx_CAN_STDMSG_S0_Bits limitation to 11 bit SFID1/2.
Only IfxCan_Can_setExtendedFilter _could_ support ext. CAN-IDs with respect to Ifx_CAN_EXTMSG -> Ifx_CAN_EXTMSG_F0_Bits / Ifx_CAN_EXTMSG_F1_Bits 29 bit EFID1/EFID2.
Sorry for that.
Anyway I wasn't able to receive. I will continue to try alternatives to IfxCan_FilterElementConfiguration_storeInRxBuffer, seems to be handled differently.

Level 1
Level 1
First solution authored 5 replies posted First reply posted
Finally I received CAN 2.0 B extended CAN IDs. Please note, in IFX example there are two nodes (src, dst) configured by overwriting g_mcmcan.canNodeConfig (twice!) for sending and for the receiving node.
Especially the receiving node needs e.g. filterConfig.extendedListSize = 255 (this was missing on my side)

DstNode config: (SrcNode mostly identical except the interrupts and for sure, txConfig is set instead of rxConfig)

IfxCan_Can_initNodeConfig(&g_mcmcan.canNodeConfig, &g_mcmcan.canModule);

g_mcmcan.canNodeConfig.baudRate.baudrate = 125000;

g_mcmcan.canNodeConfig.busLoopbackEnabled = TRUE;
g_mcmcan.canNodeConfig.busLoopbackEnabled = FALSE;
g_mcmcan.canNodeConfig.pins = &pins;

g_mcmcan.canNodeConfig.nodeId = IfxCan_NodeId_1;
g_mcmcan.canNodeConfig.clockSource = IfxCan_ClockSource_both;
g_mcmcan.canNodeConfig.frame.type = IfxCan_FrameType_receive;
g_mcmcan.canNodeConfig.frame.mode = IfxCan_FrameMode_standard;

g_mcmcan.canNodeConfig.rxConfig.rxMode = IfxCan_RxMode_dedicatedBuffers;
g_mcmcan.canNodeConfig.rxConfig.rxBufferDataFieldSize = IfxCan_DataFieldSize_8;

/* !!! */
g_mcmcan.canNodeConfig.filterConfig.extendedListSize = 255;
g_mcmcan.canNodeConfig.filterConfig.messageIdLength = IfxCan_MessageIdLength_extended;
g_mcmcan.canNodeConfig.filterConfig.rejectRemoteFramesWithExtendedId = FALSE;

g_mcmcan.canNodeConfig.interruptConfig.messageStoredToDedicatedRxBufferEnabled = TRUE;
g_mcmcan.canNodeConfig.interruptConfig.reint.priority = ISR_PRIORITY_CAN_RX;
g_mcmcan.canNodeConfig.interruptConfig.reint.interruptLine = IfxCan_InterruptLine_1;
g_mcmcan.canNodeConfig.interruptConfig.reint.typeOfService = IfxSrc_Tos_cpu0;

IfxCan_Can_initNode(&g_mcmcan.canDstNode, &g_mcmcan.canNodeConfig);

filter config:

IfxCan_Can_setExtendedFilter(&g_mcmcan.canDstNode, &g_mcmcan.canFilter);
IfxCan_Can_setStandardFilter(&g_mcmcan.canDstNode, &g_mcmcan.canFilter);


PS: It's not so easy to guess, what the iLLD routines could be designed for. Would be great to add a minimum architectural prosa or a users manual to the existing "users reference" *chm. I was employee at Ifx for some years ("ConverGate"). In this time there were Users (SW/HW) (Reference) Manuals elementary for each release. Additionally(!) generated doxygen files I never called "Manual" but "Code Documentation".
Anyway the examples are extremely helpful - if you have to focus on one part - forget the documentation, focus on more examples/scenarios 😉