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

Mechanism of Transport Layer in CAN

Transport Layer in CAN segments the messages that have a size greater than 8Bytes my questions are : -Is it possible to use one buffer for segmented data for all the type of messages in this case we consider the longest message and simply use…
Bou6
  • 84
  • 2
  • 10
0
votes
1 answer

CAN: How to simulate the sending and receiving the message

I am working on CAN where already the code is ready for send and receive, but now for our unit testing we use canalyzer to test the send/receive of the data. Is there a way wherein I can test the send/receive using 2 hosts or on a same PC.
anonymous
  • 151
  • 1
  • 16
0
votes
1 answer

Arduino & SeeedStudio CAN-BUS Shield

I have connected my CAN-BUS shield to my heating systems and I'm getting data from the bus. This is working (I think). However, I can not get the data that I want. Please see attached pictures. CAN-open data CAN-Bus Log It says that it's running…
0
votes
1 answer

KWP fast protocol via CAN bus for OBD2

I have a question about my CAR's ODB function. I have a USB dongle with AT90CAN128 uE , the uE has CAN driver and i can use this to read the data traffic on the bus. I have a BMW 116i but this car uses KWP-fast protocol for the obd2. I want to ask…
xmaze
  • 41
  • 1
  • 9
0
votes
0 answers

Are there performance issues with virtual can interfaces on linux?

On a Linux System we can create virtual CAN interfaces -> vcan0 ... normaly they are used for testing purposes. My question is the following: Can I use a virtual CAN interface for transmitting data from one application to another application on the…
unikat
  • 341
  • 2
  • 5
  • 14
0
votes
0 answers

CAN bus communication with System.Net.Sockets

I want to convert some C/C++ code to C# so that I can use it on Linux with MONO instead of using a DLLImport with a *.so. It seems that System.Net.Sockets doesn't support CAN-bus communication but I'm not sure if that means we cannot solve it…
Richard Bladh
  • 89
  • 2
  • 6
0
votes
3 answers

CANbus simulation for Automotive purpose

i explain a bit... I repair Electric powered steering systems for cars, especially Fiat/Alfa/Lancya (Delphi manufacturers) and i'm in need of making some tool to test these reparations, i mean just turning it on for example. I have researched…
0
votes
4 answers

Count items in dictionary

I need to count the the different IDENTIFIERS and print a number count for the them. The information comes from a data stream that looks like this: IDENTIFIER 7756753.940 receivetest: m s 0x0000069a 8 00 00 00 00 00 e4…
Jalcock501
  • 389
  • 2
  • 6
  • 18
0
votes
0 answers

CAN bus and SPI communication in Raspberry Pi

I am developing a prototype for adaptive cruise control using two raspberry pi's. I have tested SPI on pi and it works (checked it through loopback). Now i want to write this data to the cotroller. So, after referring to resources i found Socketcan…
0
votes
1 answer

Count Entries in hash and how frequent they change

I have a script that reads CAN bus signals and displays them to screen but I need to add a signal counter and frequency. So I need to count how many times has this $id appeared so far and how many milliseconds ago did was it added to the hash…
Jalcock501
  • 389
  • 2
  • 6
  • 18
0
votes
1 answer

Python threading with queue: how to avoid to use join?

I have a scenario with 2 threads: a thread waiting for messages from a socket (embedded in a C library - blocking call is "Barra.ricevi") then putting an element on a queue a thread waiting to get element from the queue and do something Sample…
Atessadri
  • 11
  • 3
0
votes
1 answer

J1939 CAN Bit Timing

I need some help setting up my J1939 definition for CAN bit timing. I am using a PIC18LF26K80 microcontroller with an 8 MHz clock. I'm having trouble trying to figure out how to calculate the different bits for the CAN registers. Right now in my…
Mikkel Bang
  • 574
  • 2
  • 13
  • 27
0
votes
1 answer

CAN Bus programming/control of car's control units?

I'm beginning to learn about programming cars. I read up on CAN programming and just need to know where i can find information about the control units of each car model. For example: I wanna start programming/controlling a 01 chevy blazer. How do…
Nathan Darker
  • 141
  • 1
  • 9
0
votes
1 answer

Retrieve hexadecimal argv[] in tab from struct can_frame

I'm working on socket CAN and I implement the following code : int main(int argc, char **argv) { char *sendSoc = NULL; char *receiveSoc = NULL; char specifiedType; struct can_frame sendFrame; struct can_frame receiveFrame; int sendSocket=-1,…
ogs
  • 1,139
  • 8
  • 19
  • 42
0
votes
3 answers

How a CAN Bus addressing works?

How a CAN Bus controller decides based on message identifier that this particular message belongs to it?Is it like the receiver already know that if identifier has suppose value 5 then its for me . And we program receiver to tell it that you should…
Waqas
  • 191
  • 3
  • 4
  • 13