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
6
votes
1 answer

VAG TP 2.0 complete list of AT commands

I am trying to find DTCs from various ECUs in a Skoda Rapid 2009 model. I am using OBDLink SX (elm 327 chip) and Putty (similar to HyperTerminal) https://jazdw.net/tp20 This link gives the list of commands that I should request the ECUs of any VAG…
Soumya Sen
  • 121
  • 6
6
votes
1 answer

CAN BUS - ACK field

When a receiving node would like to ACK acknowledge the receipt of a frame, what exactly is it supposed to transmit? The same frame just with a dominant bit for ACK?
user1688175
6
votes
6 answers

Start and run CANoe from Command Prompt

Is it possible to start and run Vector CANoe from the Command Prompt and/or by using any other external script?
6
votes
3 answers

What is PDO mapping?

After reading several CiA specifications, I am still having difficulty understanding PDO mapping, Process Image, and Process Data Exchange in CANopen. I know SDO is used for configuration settings in the pre-operational state and has protocol…
Vishwanath Kamath
  • 340
  • 2
  • 3
  • 14
6
votes
4 answers

CAN Bus Protocol Implementation

I want to learn and implement CAN BUS protocol. I have implemented UART,SPI,I2C and One Wire Bus protocol using MSP430 Launchpad in software. Now I want to learn about CAN Bus protocol. I have mBed LPC 1768 Cortex M3 Development board. mBed has Can…
Gaurav K
  • 2,864
  • 9
  • 39
  • 68
5
votes
3 answers

Getting CAN interface packet statistics using getifaddrs

I'm using the getifaddrs Linux function to get information about network interfaces on a Linux machine running Debian Jessie kernel 3.16.0. Among the info I want to know is network statistics (packets dropped, sent, etc.) which, as the manpage for…
hoz
  • 176
  • 1
  • 7
5
votes
2 answers

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 can I do that without a physical device? For…
viduwoy
  • 113
  • 12
5
votes
1 answer

How check bus state in socketcan

I am using flexcan driver on an embedded linux and I have C program controling can messages. In my C program I need to check the state of the can bus e.g. buss-off or error-active. I can use linux command like ip -details -statistics link show can0…
PHA
  • 1,588
  • 5
  • 18
  • 37
5
votes
2 answers

Get CAN bitrate

I want to read the currently configured CAN bitrate of my socketcan socket in C++. I can see the bitrate with ip -det link show can0: 9: can0: mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10 link/can …
Laurenz
  • 1,810
  • 12
  • 25
5
votes
2 answers

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: cansend vcan0 123##122 However, I got the response…
MAW
  • 121
  • 1
  • 5
5
votes
3 answers

How to send custom CAN messages using ELM327?

I'm working with a ELM327 and I'd like to be able to set the header and data portions of CAN messages to be sent. I see that there is a code for setting the header for messages SH xxyyzz But I'm having trouble finding out how to set the data…
Mary Grover
  • 51
  • 1
  • 1
  • 3
5
votes
2 answers

CAN bus and Android communication advice

I would like to get advice about CAN bus communication with an Android tablet. I am working into an electrical vehicle project with a colleague. We have CAN bus communication between BMS, inverter, and control logics. And I need to get data, like…
Martynas
  • 627
  • 2
  • 8
  • 28
5
votes
2 answers

elm327 CAN command to switch headlights pernament ON

I want to send AT command to switch my headlights pernament ON in Nissan Leaf. It is located in ID 625 0x00 - OFF 0x60 - ON 0x40 - Parking lights ON 0x68 - Headlights & fog lights ON how to change this by sending commands through Terminal Can…
user3534775
  • 51
  • 1
  • 2
5
votes
1 answer

Ford CAN Data and ELM327

I am trying to use a Bluetooth ELM327 wireless OBD-II receiver to obtain data from a vehicles OBD-II port. I am not trying to gather information about the engine, but rather some of the electronics in the vehicle. I have been given certain commands…
Adam Jakiela
  • 2,188
  • 7
  • 30
  • 48
5
votes
1 answer

Does there exist an open source tool for simulating a CAN bus with programmable CAN nodes?

I am looking for a tool to make it easier to experiment with tweaks to the Controller Area network (CAN) protocol, as well as experiment with building protocols on top of it. In particular, I am looking for a simulation of the CAN bus with…
merlin2011
  • 71,677
  • 44
  • 195
  • 329
1
2
3
77 78