CAN messages from Tegra through Aurix disappear if sent faster than 10ms.

I am using “easycan” sample code from Drive SDK (easycan_test) to open socket for CAN communication.
Easycan example uses semd_msg() to send CAN messages through Aurix:
rc = send_msg(MSG_NODE_SECU, CAN_MSG_TEGRA_A_TO_F, msg_id, 8, data);
Internally send_msg() calls sendto():
rc = sendto(sock, txMessage, msg.length+sizeof(pdu), 0, (struct sockaddr *) &remoteServAddr, sizeof (remoteServAddr));

I kept default setup/initialization code from easycan and modified the code to send 2 messages (id 0x10 and 0x20) in a loop with 20ms delay:

for (i=0; i<100; i++)
{
rc = send_msg(MSG_NODE_SECU, CAN_MSG_TEGRA_A_TO_F, 0x10, 8, data);
usleep(20000); // 20ms
rc = send_msg(MSG_NODE_SECU, CAN_MSG_TEGRA_A_TO_F, 0x20, 8, data);
usleep(20000); // 20ms
}

The code above works and I receive 100 of 0x10 and 100 of 0x20 messages using PCAN connected to CAN F bus.

However, if I reduce the first delay from 20ms to 5ms, then 0x20 messages disappear completely.

for (i=0; i<100; i++)
{
rc = send_msg(MSG_NODE_SECU, CAN_MSG_TEGRA_A_TO_F, 0x10, 8, data);
usleep(5000); // 5ms
rc = send_msg(MSG_NODE_SECU, CAN_MSG_TEGRA_A_TO_F, 0x20, 8, data);
usleep(20000); // 20ms
}

With this code (above), only 0x10 messages are received by PCAN and 0x20 messages do not show up on CAN F at all.
Is it expected behavior? Do you know where the messages disappear? i.e. during transfer over ethernet or discarded in Aurix firmware?

I also tried the same test with local Tegra CAN controller (using mttcan and SocketCAN drivers) and it works much better - it can handle all the messages even if they are sent back to back without delay.
I used original can-utils (sendcan.c) source code to open socket for SocketCAN and modified it to send messages in a loop.
The code below works fine and sends messages as fast as possible. All 0x10 and 0x20 messages are received by PCAN correctly.
for (i=0; i<100; i++)
{
frame.can_id = 0x10;
write(s, &frame, required_mtu);
// no delay.

frame.can_id = 0x20;
write(s, &frame, required_mtu);
// no delay.

}

Dear mikhailqydth,

Yes, this is an expected behaivor, EasyCAN TX performance is limited and there is a polling based implementation on Aurix.
Currently packets are processed every 10ms only, so anything faster than this will be dropped.

Hi SteveNV,

Thank you for the reply.

Are there any other ways to send CAN messages through Aurix besides EasyCAN? I thought that EasyCAN term refers mostly to a way of configuring CAN firmware/hardware in Aurix, but maybe it refers to the whole mechanism of sending CAN messages between Tegra and Aurix over Ethernet.
I have seen some other example code (probably in Electrobit package in Drive SDK) that sends CAN messages over Ethernet and does not mention “easycan”. I am guessing it is the same approach as in easycan example with the same TX performance.

Do you know why packet processing is done that way (10ms polling)? Are there any hardware or design limitations that make interrupt/event based approach impossible ? or it is simply considered sufficient for default firmware? Maybe it is a question for Electrobit…

We will later switch from Drive PX2 to Xavier board, but it uses a similar Aurix MCU and CAN-related stack is probably the same.

Mikhail

We also have problems with the easycan solution. When two 500 kbps can devices are attached to the Aurix and then forwarded to one of the Tegras, we start missing messages. We have configured the aurix using Easycan. Would it make a difference if we do static configuration? Where can we find the tooling to do so?

Also, where can I find the documentation regarding these limitations?

Dear JW2000,

As I said above, CAN messages through Aurix have a limit. That’s because of a feature called EasyCAN.
Will check how to handle this part. Thanks.

1 Like