CAN RX frame lost

Moderator: nferre

sama5d3_eval
Posts: 8
Joined: Tue Mar 29, 2016 3:52 pm

CAN RX frame lost

Wed Apr 20, 2016 2:41 pm

Hello,

I wrote simple program which sent the frames from can0 to can1 with 20Hz
I use RAW_CAN protocol

Code: Select all

socket(PF_CAN, SOCK_RAW, CAN_RAW);
I noticed that many frames are lost.

If I look at the statistics (ip -s -d link show canX) for both can, I can see that number of sent bytes from can0 is equal to number of received bytes on can1. The number of TX and RX packages is also equal.
There is not errors, warnings, dropped frames or overuns.

It seems that the CAN controller works fine and the problem is with the kernel signal not beeing sent to the read cmd or the problem is with the code.

This is how I read data:

Code: Select all

int rx = read(canSocket, &sCan1Frame.RxFrame, sizeof(sCan1Frame.RxFrame));
if(sCan1Frame.RxFrame.can_id & CAN_ERR_FLAG)
{
	ParseCanError(&sCan1Frame);
}
else if(rx > 0)
{
// process data
}
What do you thing?
I have already tried to increased the proccess priority, however nothing changes.

I also tried to increas the RX and TX buffers, however still RX data are losing.

Regards
sama5d3_eval
Posts: 8
Joined: Tue Mar 29, 2016 3:52 pm

Re: CAN RX frame lost

Thu Apr 21, 2016 3:34 pm

Hello,

I found the reason why the RC CAN frames were lost.
The problem is the ethernet connection I used to connect with the board (I use WIFI USB adapter).
Every time time the sshd process starts do something and it goes on the top of the "top" command report, the RX frames are lost.

When I connected to the board via the USAR0 and display the output from the program (no ethernet connection), even no one bit was lost.

CAN0 Tx: 243840 CAN1 Rx: 243840
......

Who knows why is that?

Regards
sama5d3_eval
Posts: 8
Joined: Tue Mar 29, 2016 3:52 pm

Re: CAN RX frame lost

Fri Apr 22, 2016 4:50 pm

Hello,

Today I did more tests.

Unfortunatelly the problem still exist.
I have noticed that only if there is not ethernet traffic the frame sant from can0 to can1 were received without any frames dropped.

If I even ping <IP board> the board from my laptop the frames on RX can1 are lost. When the ping is finished there is no frames dropped.

Anyone of you use the CAN?

Regards,

Return to “SAMA5-based”

Who is online

Users browsing this forum: No registered users and 3 guests