iLLD MCMCAN Bug

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

cross mob
lock attach
Attachments are accessible only for community members.
AgentLost
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hi there!

I almost went crazy putting the CAN into operation and found a serious bug in the iLLD implementation (Version 1.0.1.14.0).

I want to use all CAN nodes of the CAN modules (identical configuration for each node):

#define CAN_MODULE0_NODE0_RAM_OFFSET 0x0000 //0000...1FFF
#define CAN_MODULE0_NODE1_RAM_OFFSET 0x2000 //2000...3FFF
#define CAN_MODULE0_NODE2_RAM_OFFSET 0x4000 //4000...5FFF
#define CAN_MODULE0_NODE3_RAM_OFFSET 0x6000 //6000...7FFF

CAN Module 0 Node 0:
//0x0000...0x00FF 64 11-Bit Filter
//0x0100...0x02FF 64 29-Bit Filter
//0x0300...0004F7 7 RX Fifo0 (72 Byte)
//0x04F8...0x16F7 64 Rx Buffers (72 Byte)
//0x16F8...0x1FF7 32 Tx Fifo (72 Byte)

CAN Module 0 Node 1:
//0x0000...0x00FF 64 11-Bit Filter
//0x0100...0x02FF 64 29-Bit Filter
//0x0300...0004F7 7 RX Fifo0 (72 Byte)
//0x04F8...0x16F7 64 Rx Buffers (72 Byte)
//0x16F8...0x1FF7 32 Tx Fifo (72 Byte)
...and so on


But this only worked for Node 0 of each CAN module. Nodes 1...3 showed a completely undefined behavior.

Unfortunately, all of the application notes and examples I've found are so simple that it doesn't matter.


I was wondering how a node's shared memory is distributed across the individual nodes. There is STARTADRi, but this is not an address offset.

This configuration of the node's message RAM did not work, even if the baseAddress is defined correctly:

canNodeConfig[0][0].messageRAM.baseAddress = (uint32)CAN0_RAM + CAN_MODULE0_NODE0_RAM_OFFSET;
canNodeConfig[0][0].messageRAM.standardFilterListStartAddress = 0x0000; //64
canNodeConfig[0][0].messageRAM.extendedFilterListStartAddress = 0x0100; //64
canNodeConfig[0][0].messageRAM.rxFifo0StartAddress = 0x0300; //7
canNodeConfig[0][0].messageRAM.rxFifo1StartAddress = 0x0000; //not used
canNodeConfig[0][0].messageRAM.rxBuffersStartAddress = 0x04F8; //64
canNodeConfig[0][0].messageRAM.txEventFifoStartAddress = 0x0000; //not used
canNodeConfig[0][0].messageRAM.txBuffersStartAddress = 0x16F8; //32

canNodeConfig[0][1].messageRAM.baseAddress = (uint32)CAN0_RAM + CAN_MODULE0_NODE1_RAM_OFFSET;
canNodeConfig[0][1].messageRAM.standardFilterListStartAddress = 0x0000; //64
canNodeConfig[0][1].messageRAM.extendedFilterListStartAddress = 0x0100; //64
canNodeConfig[0][1].messageRAM.rxFifo0StartAddress = 0x0300; //7
canNodeConfig[0][1].messageRAM.rxFifo1StartAddress = 0x0000; //not used
canNodeConfig[0][1].messageRAM.rxBuffersStartAddress = 0x04F8; //64
canNodeConfig[0][1].messageRAM.txEventFifoStartAddress = 0x0000; //not used
canNodeConfig[0][1].messageRAM.txBuffersStartAddress = 0x16F8; //32
...

To add the module's address offset to the StartAddress values also didn't work, e.g.:

canNodeConfig[0][1].messageRAM.standardFilterListStartAddress = 0x0000 + CAN_MODULE0_NODE1_RAM_OFFSET; //64


So I took a deeper look into the init function IfxCan_Can_initNode():

The start adress registers are set in this way:

e.g.:
IfxCan_Node_setStandardFilterListStartAddress(nodeSfr, config->messageRAM.standardFilterListStartAddress);

The baseAdress is not taken into account! In all other functions it is added. So if I add the offset to all start adress entries of the initialization structure, the start adress registers are set correctly but all other functions are not working because they add the baseAddress again.

After adding the baseAdress to the start adress register initialization (for all 7 entries), it worked:

e.g.:
IfxCan_Node_setStandardFilterListStartAddress(nodeSfr, (config->messageRAM.standardFilterListStartAddress) + (config->messageRAM.baseAddress));

Maybe this change can be included in the next version of the iLLD...

Regards
AgentLost

0 Likes
7 Replies
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

dw_0-1652948668753.png

 

Hi Agent,

Sorry for the inconvinence , I have check above IfxCan_Node_setStandardFilterListStartAddress(), and found uint16_t type of address, so if you add baseAddress, it will ignore the upper 16bit, and the most important, FLSSA is a 15:2 (14bit) bit field.

dw_1-1652949970932.png

 

 

dw

0 Likes
AgentLost
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hi dw,

yes, you're right. But the upper 16bit are not important. Only CAN_MODULEx_NODEy_RAM_OFFSET.

The only available entry I can use at the moment is baseAddress. OK, it's not an elegant solution. 😉

But do you agree that the initialization of the start address registers are not working with the current implementation of iLLD?

AgentLost

0 Likes
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

 

 

//node0: IfxCan_NodeId_0;
nodeConfig.messageRAM.standardFilterListStartAddress = 0x100;
nodeConfig.messageRAM.txBuffersStartAddress = 0x200;
nodeConfig.messageRAM.rxBuffersStartAddress = 0x400;
nodeConfig.messageRAM.baseAddress = (uint32_t) 0xF0200000;
//node1: IfxCan_NodeId_1;

nodeConfig.messageRAM.standardFilterListStartAddress = 0x100+NODE1_RAM_OFFSET;
nodeConfig.messageRAM.txBuffersStartAddress = 0x200+NODE1_RAM_OFFSET;
nodeConfig.messageRAM.rxBuffersStartAddress = 0x400+NODE1_RAM_OFFSET;

 

 

 

Hi Agent, 

If we don't touch baseAddress, then just need to be careful to define an offset in the node 1/2 beside node 0 as above showed.

Do you think it's fine?

dw

0 Likes
AgentLost
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hi dw,

yes, this would also work. But isn't nodeConfig.messageRAM.baseAdress intended to be the nodes start address and not that of the module?

In all examples it's initialized with MODULE_CANx_RAM + NODEy_RAM_OFFSET;

 

Regards

AgentLost

0 Likes
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

Hi Agent,

Base Address is different for modules and nodes, below two illustrated the relations. 

dw_0-1652954109768.png

I am not sure if below definition is correct, and I will reply you after verification.

 

nodeConfig.messageRAM.baseAddress = (uint32_t) 0xF0200000+NODE1_RAM_OFFSET;

 

 

 nodeConfig.messageRAM.baseAddress = MODULE_CAN0_RAM + NODE0_RAM_OFFSET;

 

dw

0 Likes
AgentLost
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hi dw,

it works if messageRAM.baseAddress is initialized for all nodes with the start address of the module as you described:

nodeConfig.messageRAM.baseAddress = MODULE_CANx_RAM

The remaining address entries are then initialized with the address offset of the respective node:

nodeConfig.messageRAM.txBuffersStartAddress = 0x200+NODEy_RAM_OFFSET;
nodeConfig.messageRAM.rxBuffersStartAddress = 0x400+NODEy_RAM_OFFSET;
...

In this way, no change to the iLLD code is necessary.


However, in all available application notes, messageRAM.baseAddress is initialized with the respective offset of the node:

nodeConfig.messageRAM.baseAddress = MODULE_CANx_RAM + NODEy_RAM_OFFSET

and are therefore not working without changing the iLLD code!

I have now found a post from a user with the same problem:
https://community.infineon.com/t5/AURIX/CAN-Message-RAM/m-p/339509#M6778 

Regards
AgentLost

0 Likes
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored
nodeConfig.messageRAM.baseAddress = MODULE_CANx_RAM + NODEy_RAM_OFFSET 

Hi Agent,

Above define is not verified. So please do not use it so far.

I have notified already the dev team to this, if this really needs to be fixed, I will reply you.

Thank you a lot for this infomation.

 

dw

0 Likes