SocketCAN is a Linux socket based implementation for Controller Area Network (CAN) protocol.
Questions tagged [socketcan]
155 questions
1
vote
0 answers
SocketCAN recovery from buffer overflow CAN_ERR_CRTL_RX_OVERFLOW
I write an application in C/C++ which uses SocketCAN. Under some conditions I can generate an buffer overflow error CAN_ERR_CRTL_RX_OVERFLOW on my system.
An ip command shows growing number of overflow errors.
ip -details -statistics link show…

dr.chleb
- 11
- 2
1
vote
1 answer
CAN Communication in QT
I have a specific problem with the CAN communication in QT. It is not a problem to send/write CAN messages, but the readFrame() function in QT doesn't load my received frames. If you are implementing a CAN communication in C++ you can use the read()…

Sinan Kiris
- 13
- 4
1
vote
0 answers
SocketCan Error: Sending frame to hardware that is not powered up
I'm sending a message on a CAN bus with no powered on nodes. The CAN message returned has a message ID of 0x2000 0088, which indicates a CAN_ERR_FLAG.
CAN_ERR_PROT and CAN_ERR_BUSERROR are set.
Data[0..7]: 0x00 0x00 0x80 0x19 0x00 0x00 0x00…

Dylan Bennett
- 11
- 2
1
vote
1 answer
SocketCAN CAN bus Arbit-lost error increments once program started
I'm doing a project that will connect multiple subsystems (sensors, controller, etc) via CAN bus. I'm using SocketCAN and have settings as below:
root@ngtianxun-desktop:~# ip -details -statistic link show can0
5: can0: mtu…

T08
- 73
- 1
- 8
1
vote
1 answer
Socket reading error on CAN BUS Linux Socketcan?
I implemented a CAN bus communication for writing and read operations with linux. I am using socketCan library.
Write function works correctly. I have problems with my reading function:
int can_receive(void)
{
struct can_frame frameRead;
…

kevin94
- 37
- 5
1
vote
1 answer
SocketCan: read() data after write()
I am implementing a small subset of a UDS client with SocketCAN on embedded linux. The communication between the client and server works on a request / response pattern. I would like to read() the response of the server after having used write() to…

nico1000
- 71
- 3
1
vote
0 answers
Sending CAN-bus J1939 messages with no Data in linux
I need to send a CAN-bus J1939 message with no data using socketcan. The reason why the message needs to be sent with no data is to follow the spec J1939-73 DM11 (PGN=0x00FED3).
The C code below works fine when sending data that is at least 1 byte…

rickthehope
- 71
- 4
1
vote
0 answers
Python socketcan interface for J1939 transport protocol
Using python with socketcan in the J1939 protocol, it seems that recvfrom() does not return the interface when the data is more than 8 bytes. In the J1939 protocl, when there is more than 8 data bytes, multiple CAN messages are sent since a CAN…

rickthehope
- 71
- 4
1
vote
2 answers
Sending a CAN J1939 message
I would like to get a code example to send a simple CAN message with the J1939 stack using Python.
The following web site has a simple example to receive a J1939 message: https://justkding.me/thoughts/python-sae-j1939-socket-support
The code on this…

rickthehope
- 71
- 4
1
vote
1 answer
Why does SocketCAN bind() call always return 0 when called from JNI?
I'm attempting to create a Java wrapped C implementation of a CAN bus that is to be used in an Android environment. I've used SocketCAN including in the Linux kernel to create a socket and bind it to the CAN interface.
The development environment…

J. Sugarbum
- 13
- 4
1
vote
0 answers
socketcan alternative / add can0 to /dev/
I am currently working with CAN-BUS Systems.
I make the CAN Interface available using
sudo modprobe can
sudo modprobe can-raw
sudo modprobe mttcan
sudo ip link set can0 type can bitrate 250000
sudo ip link set up can0
It now shows up in ifconfig…

Markus
- 125
- 1
- 6
1
vote
2 answers
SocketCAN - device state "STOPPED"
I use a Raspberry Pi with the PiCAN board which uses a MCP2515 CAN controller.
I use SocketCAN to read and write CAN messages via an application I wrote.
After running a few weeks without a problem the controller is now in the state "STOPPED".
What…

Timonysos
- 21
- 2
1
vote
1 answer
SocketCAN read from socket only returns 11cobid
I am trying to read from a socketCAN and the msg is always filtered for the 11bit identifier.
This should be a problem fixable with setting the rpoper flags for the 29bit identifier but I can`t find where if anyone can help...
struct can_frame…

homer69
- 53
- 1
- 8
1
vote
1 answer
Using Nettys epoll implementation for Linux SocketCAN communication
I am considering the usage of Netty as basis for the JavaCAN library, as it also uses NIO/epoll to access the Linux SocketCAN.
What bothers me it the fact that the Netty epoll classes are written for network (IP) communication, not for the usage of…

Maik Scheibler
- 51
- 5
1
vote
1 answer
Switching between can and vcan
I have read the documentation and I know that:
To enable a real can you do
$ sudo ip link set can0 type can bitrate 125000
$ sudo ip link set up can0
and to enable a vcan you do
$ modprobe vcan
$ sudo ip link add dev vcan0 type vcan
$ sudo ip…

KansaiRobot
- 7,564
- 11
- 71
- 150