Page 1 of 1

pcan error logs/handling

Posted: Thu 24. Nov 2016, 14:10
by Meldryt
I'm using peak linux driver 8.1.0 with socketCAN on openleap 42.1 and initialized a can0 interface.
I have an app that writes to can mutlple times per second.
In irregular intervals i get errors that cause the bus to go off after some time.

With cat /proc/pcan i can see the current can status but it would be nice to know which message can-id caused a error.

i check for error flags after write and read but get no output.

Code: Select all

...
else if (frame.can_id & CAN_ERR_TRX)
{
	std::cout << frame.can_id << "CAN_EFF_FLAG" << std::endl;
}
else if (frame.can_id & CAN_ERR_BUSERROR)
{
	std::cout << frame.can_id << "CAN_RTR_FLAG" << std::endl;
}
else if (frame.can_id & CAN_ERR_FLAG)
...
cat /proc/pcan after bus switched off:
*------------- PEAK-System CAN interfaces (http://www.peak-system.com) -------------
*------------- Release_20160608_n (8.1.0) Sep 30 2016 10:23:07 --------------
*---------- [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] [net] -----------
*--------------------- 1 interfaces @ major 245 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
0 pci can0 d4000000 016 0x0014 000545a5 00015d22 0005f3d8 0000000f 0x001c

Re: pcan error logs/handling

Posted: Thu 24. Nov 2016, 16:39
by M.Maidhof
Hi,

a busoff error will occure, when a sender will not recognize his own sendsignal on the CAN. So this will happen when you have an EMI/baudrate/cable/termination problem or you send the same ID by different CAN nodes (arbitration will not work!).

There are no direct possibilities available on a CAN controller to get the ID, which causes the problem. But as a first check, please check if the written CAN IDs are aready available on the CAN. When you look on a trace of your CAN, you can see which IDs are from your sender, and which are from external nodes.

regards

Michael

Re: pcan error logs/handling

Posted: Mon 28. Nov 2016, 10:30
by Meldryt
Thanks for advice. So i neither get the id nor the type of problem that caused the error.

Re: pcan error logs/handling

Posted: Mon 28. Nov 2016, 17:26
by M.Maidhof
No, not possible. An errorframe is a broken frame, so it could even happen that the ID area is corrupt, that is why you won´t get any ID details with an errorframe from a CAN-Controller. When you know the timing of your system, and you trace the CAN bus, you could easily find out which messages caused the errorframe. Another solution will be to use a scope or the PCAN-Diag2 to analyze the CAN bus on signal level.

regards

Michael