Hi,
As I told you at the beginning, you HAVE TO check the return value when writing a CAN frame on a socket!
I have attached a modified and fixed version of your canTest.c as well as a Makefile to build both binaries "txcan" and "rxcan". Both use argv[1] as name of the CAN interface:
I have connected two PCAN-USB on my Linux PC (running 3.16):
SSH#1:
Code: Select all
$ ./rxcan can0
...
RX: ff ff ff ff 00 00 00 d4
RX: ff ff ff ff 00 00 00 d5
RX: ff ff ff ff 00 00 00 d6
RX: ff ff ff ff 00 00 00 d9
Expected sequence number: 215, received sequence number: 217, delta: 2
$
SSH#2:
Code: Select all
$ ./txcan can1
...
TX: ff ff ff ff 00 00 00 d5
TX: ff ff ff ff 00 00 00 d6
TX: ff ff ff ff 00 00 00 d7
error 105: the above frame won't be transmitted
TX: ff ff ff ff 00 00 00 d8
error 105: the above frame won't be transmitted
TX: ff ff ff ff 00 00 00 d9
TX: ff ff ff ff 00 00 00 da
^C
Code: Select all
$ grep 105 /usr/include/asm-generic/errno.h
#define ENOBUFS 105 /* No buffer space available */
$
Moreover, as you can see below, Rx/Tx counters are matching! Since these counters are handled by the peak-usb driver, this proves that it has forwarded everything it has received 1/ from the PCAN-USB (rx side) 2/ from the linux-can stack (tx side).
If counters are equal and no overrun errors nor dropped frames, the leakage comes obvioulsy from elsewhere. Since the PCAN-USB has proven for years that it is able to handle 250 kb CAN transfer, only the linux-can and/or the application is responsible of the leakage.
In this case, it came from your application.
SSH#1:
Code: Select all
$ ip -s -d link show can0
11: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can state ERROR-ACTIVE restart-ms 0
bitrate 250000 sample-point 0.875
tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
pcan_usb: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
: dtseg1 0..0 dtseg2 0..0 dsjw 1..0 dbrp 0..0 dbrp-inc 0
clock 8000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 0 0 0
RX: bytes packets errors dropped overrun mcast
13960 1745 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0
SSH#2:
Code: Select all
$ /ip -s -d link show can1
12: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can state ERROR-ACTIVE restart-ms 0
bitrate 250000 sample-point 0.875
tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
pcan_usb: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
: dtseg1 0..0 dtseg2 0..0 dsjw 1..0 dbrp 0..0 dbrp-inc 0
clock 8000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 0 0 0
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
13960 1745 0 0 0 0
Regards,
Stéphane