Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
0 answers
151 views

Unable to send a message CAN from a PC with Linux (Ubuntu) to a module CANable (usb to can) with C++ code

I am using a C++ library with the following code: #include <linux/can.h> #include <linux/can/raw.h> #include <sys/socket.h> #include <unistd.h> #include <cstring> #...
Miguel Oliveira da Rocha's user avatar
1 vote
0 answers
184 views

Multiple cycle times for can frames on a bcm SocketCan possible?

I would like to send and reveive CAN frames via a BCM SocketCAN in Linux with C/C++. Some frames may be 11bit others are 29bit. Each frame can have an individual cycle time and the data will change ...
Andy Höfler's user avatar
1 vote
0 answers
564 views

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 ...
dr.chleb's user avatar
0 votes
2 answers
525 views

Can you attach a custom CAN interrupt handler to SocketCAN?

I have an application running baremetal which controls a peripheral via CAN. In its original form, my application hands messages to the CAN "driver", which is actually a buffering layer. ...
Walkingbeard's user avatar
0 votes
1 answer
529 views

Debian: Module can-dev loaded with load-modules.conf does not work until I reload it manually [closed]

I have a slight problem with using can bus on a raspberry pi with Debian 64 bit running on it. My /etc/modules-load.d/modules.conf looks like this: # /etc/modules: kernel modules to load at boot time. ...
Fux's user avatar
  • 1
1 vote
1 answer
834 views

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 ...
T08's user avatar
  • 163
1 vote
1 answer
1k views

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 ...
kevin94's user avatar
  • 37
0 votes
0 answers
1k views

Send CAN Messages to Multiple Specified Device IDs in Socketcan / Python-can similar to MCP_CAN Arduino library?

Is there an equivalent in Python Socketcan / python-can that allows CAN messages to be sent to a specific destination device ID like how it's done on Arduino devices? The Arduino CAN bus boards use a ...
Stigma's user avatar
  • 361
0 votes
0 answers
309 views

Missing PDO in a CAN bus of SocketCAN on a linux CPU board

It is being observed that multiple PDO go missing when a CPU has high usage and also when there is a high traffic via SSH connection. The arrangement is such that SocketCAN api of the linux system is ...
curosity's user avatar
2 votes
0 answers
800 views

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 ...
rickthehope's user avatar
0 votes
0 answers
196 views

SocketCAN: No telegrams received

I want to receive messages periodically using socketCAN. But the program didnt receive any telegrams. I think one problem may be the telegram ID inside the BCM. Can somebody help me with a hint? Thank ...
Or25's user avatar
  • 1
0 votes
1 answer
840 views

linux CAN protocol maximum rate

I am writing a program that has to handle 20000 CAN messages per second. When writing the code with python under linux using socketcan, it seems that I start to lose messages when msg_per_second is ...
rickthehope's user avatar
1 vote
0 answers
1k views

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 ...
Markus's user avatar
  • 175
0 votes
1 answer
500 views

Why isn't j1939.h include in the Ubuntu 18.04 Linux Kernel?

I am trying to use CAN J1939 standard on an embedded Linux system running Ubuntu 18.04, kernel 5.4.0-52-generic. This elinux page indicates that j1939.h "got in the mainline kernel since v5.4&...
Cameron's user avatar
1 vote
1 answer
666 views

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 ...
homer69's user avatar
  • 73
4 votes
1 answer
6k views

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 ...
Naju's user avatar
  • 315
0 votes
1 answer
1k views

linux c socketcan wait for transmit buffer empty

Is there a way to check for an empty transmit buffer with raw socketcan? EDIT: Or is there a way to make socketcan blocking until the current frame is sent which would serve the same purpose ... (...
Scheintod's user avatar
  • 8,105
2 votes
1 answer
2k views

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). ...
Alex Anderson's user avatar
4 votes
0 answers
1k views

How to remove a CAN message filter from a CAN_RAW socket?

SocketCAN's description says about adding some filters to a socket: struct can_filter rfilter[2]; rfilter[0].can_id = 0x123; rfilter[0].can_mask = CAN_SFF_MASK; rfilter[1].can_id = 0x200; ...
Greenberet's user avatar
0 votes
1 answer
618 views

How to create a stop-filter (instead of a pass-filter) when reading CAN messages? [C++, Linux]

I am using a SocketCAN to access the CAN bus. I have successfully created pass-filters like this: struct can_filter m_Filter; // ... setting up m_Filters setsockopt(m_CanSockId, SOL_CAN_RAW, ...
robitop's user avatar
  • 13
5 votes
2 answers
4k views

How to connect two VCAN ports in Linux?

I have set up two vcan devices and I want to treat them as if they were connected together. I want to be able to use can-utils candump to listen on one line, and send can messages from the other. How ...
viduwoy's user avatar
  • 123
0 votes
0 answers
408 views

SocketCAN and Incoming Packet Control

I have an application for linux. I am using SocketCAN to talk to the CAN bus. We are doing this on a Beaglebone Black based device we made ourselves. We have another device we need to listen to ...
user856232's user avatar
  • 1,113
0 votes
1 answer
2k views

How can I configure SocketCAN to a specific interface?

I'm using a Beaglebone Black with two CAN interfaces as SocketCAN. How can I link i.e the interface can0 to my hardware DCAN0? I need to use both sockets parallel but didn't find to configure the ...
Alex Rabenstein's user avatar
1 vote
2 answers
8k views

cangen vcan0 command returns write: Network is Down

Fairly new to this, any help/guidance would be greatly appreciated. Trying to run a virtual CAN network using can-utils, but I keep getting Network down message when I try to do a candump or cangen. ...
Ryan Anderson's user avatar
4 votes
2 answers
12k views

Send one-shot message using SocketCAN

Is it possible to send a "one-shot" CAN message using SocketCAN? This is basically a message that does not expect an acknowledgement back from the receiver. The protocol allows this ACK bit not to be ...
ilya1725's user avatar
  • 4,938
3 votes
1 answer
6k views

What is the `flags` field for in canfd_frame in SocketCAN?

A non-FD ("legacy") CAN frame has the following format in SocketCAN: struct can_frame { canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ __u8 can_dlc; /* frame payload ...
Adam Selker's user avatar
0 votes
1 answer
564 views

Tiny-CAN I-XL socketCAN extended format

My Problem is the following. I am using the Tiny-CAN I-XL CAN-USB adapter and socketCAN on Linux. I configure the CAN adapter by doing: sudo slcan_attach /dev/ttyUSB0 -w sudo ip link set can0 type ...
Bant's user avatar
  • 73
0 votes
2 answers
2k views

Linux 2.6 on imx: Can't log sent CAN frames using candump

I have a custom build linux 2.6 running on a imx CPU. CAN communication with external nodes works like a charm, but the frames that I send to the nodes from my app is not printed when using "candump ...
Eric G's user avatar
  • 1
2 votes
1 answer
3k views

CAN j1939 support in Linux Kernel 4.x

Any one have ported CAN J1939 stack on the kernel 4.x series? We had ported it into 3.10 kernel based on the link "http://elinux.org/J1939". Now I want to port it into the kernel version 4.1.15. I ...
shabeerb's user avatar
1 vote
1 answer
7k views

vcan0 interface linux communication

Linux is supporting virtual can interface. it was enabled by: modprobe vcan sudo ip link add dev vcan0 type vcan sudo ifconfig vcan0 up While using cam-utils such as camsniffer and cansend cansend ...
Gopi's user avatar
  • 350
5 votes
2 answers
10k views

CAN FD support for Virtual CAN (vcan) on SocketCAN

I have been using SocketCAN and especially the Virtual CAN vcan for quite a while now. However, I never used CAN FD (Flexible Datarate) so far. Well, I tried it this morning using the can-utils: ...
MAW's user avatar
  • 131
3 votes
1 answer
1k views

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 ...
Fylhan's user avatar
  • 677
11 votes
2 answers
27k views

Heavily confused by candump (SocketCAN) ID filtering feature

In a nutshell, I want candump to show me ONLY frames with IDs 0x00200200 or 0x255. So I do this: candump can0,00200200:0,255:0 But this gives ALL frames, and each frame is shown twice. i.e. the ...
Erik Nyquist's user avatar
  • 1,317
4 votes
1 answer
2k views

Writing custom CAN protocol with SocketCAN

I'm trying to write a slightly modified CAN protocol for SocketCAN. The SocketCAN documentation has a short section about this: 5.3 writing own CAN protocol modules To implement a new protocol in ...
RuthSB's user avatar
  • 49
1 vote
0 answers
1k views

Enumerate CAN adapters

Is there a way to enumerate all CAN devices on Linux? It's easy to get a list of the available adapter names plus their indices using if_nameindex but I can't see an obvious way to use that to then ...
Gary Metalle's user avatar
3 votes
1 answer
2k views

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:~/...
Allan's user avatar
  • 3,251
1 vote
1 answer
2k views

Faster alternatives to Popen for CAN bus access?

I'm currently using Popen to send instructions to a utility (canutils... the cansend function in particular) via the command line. The entire function looks like this. def _CANSend(self, register, ...
Chris's user avatar
  • 10k