Ktam3874/pitx software guide – Kontron KTAM3874-pITX User Manual
Page 79

KTD-S0057-I
Page 75 Linux® Programming Examples (DebianTM)
KTAM3874/pITX Software Guide
memset (&data, 0, sizeof (data));
if (recv_can_frame (name, data, &data_len))
{
close_can_bus
();
printf ("CAN bus receive function fails !\n\n");
return
-1;
}
else
{
printf ("Some data are successfully received from: %s\n", name);
printf ("Data: 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n\n",
data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
}
close_can_bus
();
return
0;
}
If problems occur then you can try the following commands:
Reset network interfaces with
# sudo service networking restart
Get more information with
# sudo ifconfig can0
can0
Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 B)
TX bytes:32 (32.0 B)
Interrupt:52
# sudo ifconfig can1
can1
Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:32 (32.0 B)
TX bytes:0 (0.0 B)
Interrupt:55
or with (example with 'can0' for general interface information)
# ip -details link show can0
2: can0:
<NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT ...
link/can
can <TRIPLE-SAMPLING> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 125000 sample-point 0.875
tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
d_can: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1
clock 20000000