Questions tagged [socketcan]

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

155 questions
0
votes
1 answer

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 over 200. What could be the limiting factor and how…
0
votes
1 answer

SocketCAN asks for CRC and ACK

Can I receive, read and modify CRC and ACK using the socket library in C lenguage? Are there any ways I can use? I use Raspberry Pi and PiCan2.
Domi Nik
  • 1
  • 2
0
votes
1 answer

How to correctly receive MSG_FLAGS?

After sending the message, I am waiting for MSG_CONFIRM. How to correctly receive MSG_FLAGS? I don't understand why temp is always equal -1. struct msghdr msg; struct sockaddr_can addr; struct can_frame frame; struct ifreq ifr setsockopt(s,…
Domi Nik
  • 1
  • 2
0
votes
1 answer

Can I Read CRC and ACK bits using SocketCAN?

I'm looking for a way to send messages from one Raspberry Pi via PiCan2 to another and receive back to read CRC and ACK bits. I searched the documentation but couldn't find such an option, could I have missed something?
Domi Nik
  • 1
  • 2
0
votes
0 answers

SocketCAN how to send messages as soon as possible without data loss

I want to measure the maximum speed at which I can send messages via SocketCan from one Raspberry Pi (sender) using PiCan2 to another Raspberry Pi (recipient). The sender reads a 20KiB file, then each byte is sent separately via CAN. The recipient…
Domi Nik
  • 1
  • 2
0
votes
1 answer

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". And kernel.org's documentation for j1939 implies that…
Cameron
  • 3
  • 1
0
votes
1 answer

CAN socket - handle not ACK

I'm trying to test getting the ACK bit from a CAN network. My system has an RPI 4, PICAN DUO and transceivers to other CAN nodes. When the RPI and the other node are both connected, all is well and I'm getting 2 way communication. When the RPI is by…
0
votes
2 answers

RPI/Raspbian SocketCAN configuration issues

Python and RPi n00b here. Trying to get CANopen working on my RPI, and think I'm 8/10s of the way to communicating. Target device is an RPi 3+ with fairly pedestrian install of Raspbian Buster and 5.4.51-v7+ linux kernel, attached to Kvaser Leaf…
mumeh
  • 1
0
votes
1 answer

How to write a command to produce canbus data in the perticular format?

I am writing a python program to produce canbus data in the following format. <0x18eeff01> [8] 05 a0 be 1c 00 a0 a0 c0 I am using python-can library for this and trying to read message format as above. I couldn't figure out what is the first…
Fourier
  • 3
  • 3
0
votes
0 answers

Virtual CAN Bus silmulator does not work on Ubuntu

I am trying to replay a log file using the following code. It's a very simple code to read each signal from the file and create the command. It is creating the command correctly. I print it to check and it works fine, but when I use …
Sarah
  • 133
  • 11
0
votes
2 answers

SocketCAN: read() function never returns

I am working on a custom embedded Linux system that needs to read and write messages on a CAN bus. SocketCAN is being used to accomplish this. The CAN interface can0 is brought up on boot with a baudrate set to 500 kbps. I am using CANoe, cangen,…
Dschumanji
  • 125
  • 7
0
votes
1 answer

How socketcan get send failure status?

As we all know, in the CAN bus communication protocol, sender know whether the data was successfully sent. I send socketcan data as follows. ret = write (socket, frame, sizeof (struct can_frame)); However, even if the CAN communication cable is…
0
votes
0 answers

SocketCAN long delay receiving packages

I'm trying to implement a CAN interface on embedded linux platform (yocto based) using SocketCAN. After reading the documentation I wrote a quick testing application code in order to receive/read a few packages from a CAN bus on non blocking…
joe
  • 309
  • 4
  • 16
0
votes
1 answer

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 ... (motivation: I'm writing a mcu flash tool over can.…
Scheintod
  • 7,953
  • 9
  • 42
  • 61
0
votes
1 answer

Possible to access SocketCan using dotnet core Socket in Linux?

I'm using dotnet core on a Linux platform and would like to set up communication with a CAN device. SocketCan is available on the Linux platform, but is there a way to use the UnixDomainSocketEndPoint and Socket classes in dotnet core to access…
MagnusK
  • 101
  • 3