Questions tagged [socketcan]

SocketCAN is a Linux socket based implementation for Controller Area Network (CAN) protocol.

155 questions
3
votes
2 answers

Virtual CAN Bus Simulator

I apologize ahead of time if this seems to similar to another question or if it seems like it has already been answered. I felt it was uniquely detailed enough to warrant its own question. I am trying to find a virtual CAN bus simulator (or some…
Moeman69
  • 157
  • 1
  • 1
  • 6
3
votes
1 answer

Start / stop CAN boards from userspace using libsocketcan

I am trying to start / stop CAN boards or to update their baudrate using SocketCAN from userspace. My tests are performed on PeakSystem and IXXAT USB-to-CAN V1/V2 boards. My first attempt was to use visudo and to enable NOPASSWD to "ip link set…
Fylhan
  • 677
  • 6
  • 10
3
votes
4 answers

SocketCAN continuous reading and writing

I'm writing a program that continuously sends "Hello" to a CAN-bus and reads data from the bus via SocketCAN. I want those two steps to be independent. That means even if there is no data on the bus, the program will still send "Hello". But with…
PaulPonomarev
  • 355
  • 1
  • 4
  • 20
3
votes
1 answer

how to resolve this error -- while compiling socketcan utilities

I have downloaded from SVN can utilities. Because by default can utitlities are not in kernel. svn checkout svn://svn.berlios.de/socketcan/trunk/can-utils Kernel i am using is :-- ignite@ignite:~/socketcan/can-utils$ uname -a Linux ignite…
Allan
  • 2,971
  • 4
  • 24
  • 28
2
votes
1 answer

How can the value of an argument in a function called from a signal handler be different from the value passed in?

Updated question - first version below I have set up a custom signal handler to buffer frames being removed from a CAN interface. In the handler, I block the signal first, and unblock it last, using pthread_sigmask(). In bufferMessageDirect(), the…
Walkingbeard
  • 590
  • 5
  • 15
2
votes
0 answers

What is the python-can equivalent of sending socket CAN message?

I have code that communicates with a motor over CAN, originally written to work on a Linux machine. I want to run it on Windows, and I believe the socket-can libraries are not supported for Windows, and so I am trying to use python-can instead. The…
ITregear
  • 21
  • 3
2
votes
1 answer

can0 listen can-bus but no data appears

I'm trying to read a CAN-BUS on a vehicle with a raspberry (CAN is connected to DB9 connector on the raspberry). The vehicle provides energy to the raspberry also. Here's my stack: Protocol CAN "ISO 15765 CAN" by Bosch CAN-Bus Board PiCAN3 machine :…
wajisan
  • 94
  • 6
2
votes
0 answers

Allow user to create can bus without sudo

I am using socketcan and virtual can buses in my application. In order to create a virtual can bus I use the command: sudo ip link add dev vcan0 type vcan However, is it possible to do this on a specific user account without sudo? I have tried…
Frank
  • 2,446
  • 7
  • 33
  • 67
2
votes
0 answers

How can we detect dropped frame from linux socketCAN?

I would like to detect the number of frame dropped on a CAN socket implemented using linux socketCAN. When the command ip -details -statistics link show can0 is given on terminal I can get the number of dropped frame in the dropped column for both…
curosity
  • 19
  • 5
2
votes
2 answers

Delay in receiving Socket can messages

I implement linux application which receives CAN messages and calculates period(using socketcan on raspberry pi4). The problem is that sometimes (about 0.5%) socketcan receives messages with delay. When I send 10ms messages with baudrate 500Kbps…
2
votes
1 answer

SocketCAN: How to query buffer usage

I am trying to determine the buffer usage for my CAN interface on linux. At the level of the interface, I know of two ways to get statistics: From /proc/net/can/stats ip -details -statistics link show can0 The first one gives me the number of…
Naju
  • 145
  • 2
  • 12
2
votes
2 answers

Linux SocketCAN behaviour of recvmsg

I'm writing a CAN logger program. The way I log the data is similar to the way the candump-tool is doing it when invoking candump like candump any: https://github.com/linux-can/can-utils/blob/master/candump.c candump any makes candump bind to any…
JulianW
  • 897
  • 9
  • 23
2
votes
1 answer

What's the difference between RAW CAN sockets and Broadcast Manager CAN sockets and how to use them?

I am new to the CAN protocol and I am trying to utilise it through the Linux's SocketCAN. However, I am confused by the 2 different CAN sockets available, RAW and Broadcast Manager (BCM). Documentation states that BCM sockets is not intended for…
2
votes
1 answer

Is it possible to imitate arbitration on CAN bus?

Setup I have two nodes connected to one CAN bus. The first node is a black-box, controlled by some real-time hardware. The second node is a Linux machine with attached PEAK-USB CAN controller: +--------+ +----------+ | HW CAN |--- CAN…
Alexander Solovets
  • 2,447
  • 15
  • 22
2
votes
1 answer

RAW sockets required for CAN not working under MacOS - socket: Address family not supported by protocol

I'm trying to develop a docker image to test SocketCAN (with vcan) that would work on MacOS and Windows and everything is fine until I run candump vcan0 which returns: "socket: Address family not supported by protocol" After some time I've managed…
1
2
3
10 11