Questions tagged [can-bus]

Controller Area Network (CAN) bus is a networking technology typically used in cars and other vehicles. It supports deterministic priority arbitration with multiple transmitting nodes.

The CAN bus is a serial bus that allows multiple masters and uses a broadcast model. A message start with an ID, can contain up to eight data bytes (64 data bytes for CAN FD) and uses non-return-to-zero encoding. Each node can receive, but only one can send at each point in time. It uses CSMA/CA algorithm for bus access. The lower the (numerical) ID, the higher the priority. Short networks (below 40 m) can achieve bit rates up to 1 Mbit/s.

A distinguishing feature of CAN is that when two nodes with different message identifiers attempt to transmit at the same time, there are no collisions (CSMA/CA). The higher priority message will go through without any need for the sender to re-transmit it. This ensures that a CAN system can never get into a live lock state in which two nodes would continually re-send the same two messages, and continually collide with each other.

A newer version/generation called CAN FD was recently developed. It supports higher clocking of the data portion of the message, allowing up to 64 bytes of payload.

Tag usage:

  • Use this tag for all questions related to CAN or CAN FD software/firmware: drivers, controllers, communication, frames etc. Please note that hardware questions are off-topic and should be asked at https://electronics.stackexchange.com instead.
  • It is recommended to combine the tag with , to draw more attention to the question from the right kind of people.
  • If you are using a particular programming language (say, ), you should add that tag as well.
  • If the question is about higher layer protocols such as CANopen, J1939 or DeviceNet, the tag should be combined with the applicable higher layer protocol tag.

Links:

1162 questions
3
votes
2 answers

Detecting CAN bus errors under socketCAN linux driver

Our products are using a well known CANopen stack, which uses socketCAN, on an embedded Beaglebone Black based system running under Ubuntu 14.04 LTS. But for some reason, even though the stack we're using will detect when the CAN bus goes into a…
Chris Galas
  • 43
  • 1
  • 6
3
votes
1 answer

How to configure my CAN filter in list mode?

I have written some code to transmit/receive CAN messages and I am having some issues with my filter. Firstly I'm going to say that I understand mask mode and have managed to get it working with the following configuration: uint16_t id = 0x12; //…
FeraTaTa
  • 31
  • 1
  • 5
3
votes
1 answer

Python CAN bus notifier

I am trying to connect to the CAN-bus of my car. The connection is working and the data is printing to the terminal without any problems. bus = can.interface.Bus("can0", bustype="socketcan") notifier = can.Notifier(bus, [can.Printer()]) I am using…
Mindfuucker
  • 31
  • 2
  • 6
3
votes
2 answers

Automotive: For what purpose ISO-TP Extended Addressing is used?

I've read through all ISO documents and can't figure out in which cases we need extended addressing in ISO-TP, though I've seen packets from BMW CAN traffic where UDS uses extended addressing. Why does ISO-TP protocol need to specify target address…
Semant1ka
  • 647
  • 10
  • 26
3
votes
2 answers

CAN identifier and COB-ID

Hello I am a student studying canopen. What is the relationship between COB-ID and CAN identifier in Canopen? I read on the CIA homepage that COB-ID is not a CAN ID, but I do not understand it. For example, if a PDO is transmitted over a CAN bus, it…
Kevin Ryu
  • 41
  • 1
  • 1
  • 2
3
votes
3 answers

How to write a CanOpen stack?

I have a similar problem with this. How to program a simple CANopen layer . I read the answers but I have to program a CANopen layer on my own I cannot get a commercial one. So are there any basics of writing a CANopen stack (or layer I'm not…
İpek
  • 162
  • 1
  • 11
3
votes
3 answers

CAPL Script for Diagnostic Services

I am writing the CAPL script to Automise the Diagnostic services. I have read some DIDs which are bigger than 8 bytes in size. Till 8 bytes I can capture correctly the data in my CAPL script but when the data size exceeds the 8 bytes, then I get…
Hamid Gul
  • 31
  • 1
  • 1
  • 4
3
votes
2 answers

No active virtual can messages when using candump (SocketCAN)

I am playing with can-utils package, trying to run a virtual can device. Everything seems to work fine except there is no active messages. Candump and cansniffer works, because I send a message manually and it shows up. Am I doing something…
stardust
  • 343
  • 3
  • 17
3
votes
2 answers

CANopen PDOs using the serial port

I am trying to understand the CANopen protocol. For now, I do not have any CAN hardware nor the CANopen stack to experiment with. I would like to know how to write a Java program to simply interpret CANopen messages that are received at the RS-232…
Frustratedone
3
votes
2 answers

Difference between SRR and RTR bit in can bus

I got confused in CAN 11 bit and 29 bit protocol(RTR in 11 bit and SRR in 29 bit frame). can anyone please explain why we use SRR bit in 29 bit can protocol instead of RTR bit...
Ashokkumar
  • 115
  • 1
  • 3
  • 8
3
votes
1 answer

Opening a socket using Wifi connection in android

I have a PCan wireless device that can play the role as which they called "Micro Access Point". The concept is to make it router and other devices connect to it. With this connection I can send/receive CAN frames using TCP or UDP. The main Goal is…
mohsen_og
  • 774
  • 1
  • 9
  • 31
3
votes
1 answer

Transmitting data over ISO-TP (transport protocol) in CANoe using CAPL

Using CAPL with CANoe to transmit big amount of data via ISO-TP on CAN. Is there a routine, that provides the handling of data segmentation embedded in CAPL or do I need to write my own interpretation?
Georgiev
  • 71
  • 1
  • 1
  • 7
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
1 answer

Linux Kernel device driver needs access to shared object in userspace

I am trying to write a network device driver for Linux. The device that I have has an API available that allows me to access all of the features I need through a shared object that exists in userspace. I want to write a network driver such that I…