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
0
votes
3 answers

CAN bus arbitration backoff time

I am aware of the way CAN bus does its arbitration. In a nutshell the CAN node ID having more '0' 's in its indentifier wins the rite to transmit on the bus and the rest of contending nodes back off. But i dont find any details of how long the…
rockstar
  • 3,512
  • 6
  • 40
  • 63
0
votes
2 answers

Event handling between objects of different classes

I have a C++ class A that captures frames from CAN interface on a microcontroller. I am trying to implement another class B (and C and D..) that uses the frames captured by class A, one by one. In essence, class A redirects the captured frames to…
Paindoo
  • 173
  • 3
  • 8
0
votes
0 answers

I2c to CAN conversion in STM32f4 via waijung Blockset Matlab Simulink

I want to convert (OMRON ELECTRONIC COMPONENTS D6T-8L-06) Heat Sensor's output which is in I2C format via STM32f4 to CAN. And i want to do this conversion in Matlab Simulink using Waijung Blockset. i am able to read the sensor but there is no…
0
votes
1 answer

OBD2/CAN BUS problems with send commands

I'm developing application (Android). This aplication is connected to OBD2 compliant vehicle /CAN BUS and read data from it. I've done succesfully connection using OBDKey and read data using OBD message format. This message format is mode + pin…
Nick Sanders
  • 1
  • 1
  • 2
0
votes
1 answer

I/O Handling with sigaction()

I need to write a driver which is capable of reading and writing on the serial and the can bus port. The serial port is realized with a sigaction() and an event handler. When I try to realize the same thing for the can bus, just the last event…
unikat
  • 341
  • 2
  • 5
  • 14
0
votes
1 answer

Receive can packets with a specific id

is there method to receive packets from can only with specific id or match mask? Example: if packet has id 0x123 it has to ignore. I want to do it by driver level.
Mike
  • 860
  • 14
  • 24
0
votes
2 answers

Start and run CANape from command prompt

Is it possible to start and run vector canape from the command prompt and/or by using any other external script?
nancy
  • 51
  • 3
  • 11
0
votes
1 answer

BeagleBone Black CAN

Is there some libs to work with CAN interface on BeagleBone Black? Commands cansend and candump are working successful. Now I need to write program in C/C++ for CAN interface.
Mike
  • 860
  • 14
  • 24
0
votes
1 answer

How i can calculate stuffbits in standard CAN 2.0A data frame

I have one CAN standard 2.0A frame which contain 8 Bytes of DATA. e.g CAN Frame Data "00 CA 22 FF 55 66 AA DF" (8 Bytes) Now I want to check how many stuff bits would be add in this CAN frame(bit stuffing). standers formula to calculate the Worst…
Dingo
  • 1
  • 1
0
votes
2 answers

Dealing with extremely small increments of time

OK, that title was perhaps vague, but allow me to explain. I'm dealing with a large list, of hundreds of messages to be sent to a CAN bus as byte arrays. Each of these messages has an Interval property detailing how often the message must be sent,…
0
votes
0 answers

Delay between request and response from Canbus device in my iPhone application

I am working with CANbus device configuration from my iPad application. The Process is when i press one button command send to CANbus device with NMSSH channel to CANbus device. There are 3 commands that I am passing to CANbus device from our iPad…
Hrushikesh Betai
  • 2,227
  • 5
  • 33
  • 63
0
votes
1 answer

Beaglebone tracing a device driver using a device tree file

I'm trying to modify the device driver of the CBB-Serial beaglebone cape. I want to change a part of how it handles the CAN protocol's CRC check for a school project. My overall goal is to modify the CRC computation of one node and observe the…
Shabbir Hussain
  • 2,600
  • 2
  • 17
  • 25
0
votes
1 answer

Codesys Wago CAN communication

I have connected a Wago PFC200 750-8204 between two Components which communicates via CAN bus in order to receive the messages and for further processing. My approach was to implement it in codesys 2.3 with the WagoCanLayer2_02.lib library but i…
Sadik Hasan
  • 173
  • 3
  • 18
0
votes
2 answers

How can I read the BCM/UCH data from the car via OBD?

I am trying to read the data related to Body of the car, like if doors are unlocked/locked, if the seat belts are on, odometer reading etc. I am successfully able to read the ECU data via VGATE (ELM327) bluetooth OBD2 adapter. But I can only read…
Sandy
  • 79
  • 2
  • 8
0
votes
1 answer

CAN shields raspberry pi to arduino

I have a project involving communication between a raspberry pi 2 and arduino uno, does it matter of the shields are different ? Second when communicating do they both need to be coded in the same language? Does anyone know of any tutorials on this…
Jonny Smyth
  • 29
  • 1
  • 7