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

How to develop timeout on reception?

I have developed a C program that receive can traffics from vcan0 interface. I would like to add timeout on reception, I mean when a timeout expired (10 seconds for example) with no data received during this time, I print "no data received during 10…
developer
  • 4,744
  • 7
  • 40
  • 55
0
votes
1 answer

IXXAT Can library use in QT

I'm trying to use the IXXAT Can library ( delivered as an MSVC library ) in a Windows QT 5.4.0 project. I've made a simple project , included the correct path and added the library in my .pro. My application compiles without errors ( which is nice…
0
votes
1 answer

CAN Protocol related query

As per the definition of the 'Bit error' by protocol developer organization - Bosch : A bit error is detected at the bit time when the bit value monitored by the trasmitter is not the same as the bit actually transmitted by it. For example, consider…
0
votes
1 answer

Generic CAN XCP API

I'm trying to design an application that involves communicating over a CAN bus with the XCP standard protocol. The API should expose methods mapping directly to supported XCP commands, e.g. xcpProgramStart() > PROGRAM_START (0xD2). Calling these…
Bondolin
  • 2,793
  • 7
  • 34
  • 62
0
votes
1 answer

Running a Blf file in constant Loop for Emulation using CAPL

I want to run a .blf file using the Replay Block in CANalyzer . I want to run this file in a constant loop for emulation purpose. Is it possible using CAPL or can some one instruct me how to do this even without CAPL.
rohit.ranjan
  • 19
  • 2
  • 7
0
votes
1 answer

Bit stuffing in CAN bus

How does the receiving node (CAN bus) know that a bit stuffing is not an actual bit part of the data? Check this example below. Both are valid streams, but they have different contents: Valid - Bit stuffed stream (my stuffed zero in…
user1688175
0
votes
1 answer

Example of CRC manual calculationfor CAN 2.0 B

I have seem the CRC calculation polynomial for CAN 2.0B, but I have no examples to actually make sure I understood how to calculate it. X15 + X14 + X10 + X8 + X7 + X4 + X3 + 1 I would really appreciate seeing a step by step calculation for such a…
user1688175
0
votes
2 answers

broadcast file transfer via CAN bus (CANopen?)

I'm building a system consisting of many (> 100) equal nodes all connected via CAN bus. The idea is that all nodes must have the same information, any node may generate an event and will broadcast it via CAN. For those events, the 8 byte payload…
user1273684
  • 1,559
  • 15
  • 24
0
votes
0 answers

stm32f4 bxCAN in identifier list mode

Can anyone give me an example of how to use CAN acceptance filter in Identifier list mode. I know the list mode works by directly comparing the ID received with the one in the filter. But I need a code snippet. I am using this and it is not…
dennis menace
  • 83
  • 2
  • 7
0
votes
1 answer

What's the easiest way to prevent null chars from terminating my string?

I'm currently working on some C code to forward CAN messages via bluetooth and vice versa (µC stuff). The problem is that my paired bluetooth device uses '00' as a command and my bluetooth library is using a char[] to buffer the string when…
0
votes
1 answer

CAN Controller DLL with Java Application. Unable to open CAN port

I am creating a Java application that controls a Controller Area Network (CAN) controller via a vendor-supplied can.dll file. can.dll contains a function bool openPort(DWORD memAddr) that allows the application to establish connection with the CAN…
0
votes
1 answer

STM32F4 Discovery and CAN programming

I am trying to start learning programming and I am trying to get this code to work: https://github.com/espruino/Espruino/blob/master/targetlibs/stm32f4/lib/stm32f4xx_can.c I am using Atollic TruStudio Lite. I did the basic LED blinking code with…
etz01
  • 1
  • 1
  • 1
  • 2
0
votes
1 answer

What do the CANopen STORE and RESTORE objects do?

The CiA 301 CANopen protocol specification defines two objects that a device may implement to save and restore parameters: Object 1010h - Store Parameters When a device implements this object, the CANopen master writes the value "save" to one of the…
Evil Dog Pie
  • 2,300
  • 2
  • 23
  • 46
0
votes
1 answer

CAN Bus - Engine Control

I have read a lot of postings and solutions here in stackoverflow. I am very new to CAN networks and protocols and currently working on a project that entails communicating with the Vehicle engine Control Unit to cause the vehicle to decelerate to a…
the_Stick
  • 11
  • 2
0
votes
2 answers

BBB [debian] - bring up can 0 at startup

I have a beaglebone black running lastet official debian. I've added a custom cape to /etc/default/capemgr: CAPE=BB-DCAN1 I also added these lines to /etc/network/interfaces: auto can0 iface can0 can static bitrate 1000000 and executing ifup…