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 can I construct a CAN bus command in C++ according to a spec sheet?

I have a spec sheet for a device which consists of commands that I need to write to the device via CAN bus in order to interact with it. I will be implementing these commands in C++ and write them from a PC into the device via USB -> CAN…
Jcan1995
  • 39
  • 8
0
votes
0 answers

Sending CAN Messages from a RaspberryPi to an Android Smartphone

I am currently sending CAN Messages from my RaspberryPi to my Android Smartphone per Bluetooth. I should get between 200-1300 messages per second. Unfortunately I only average around 80 messages per second. I hope you can help me to achieve a…
0
votes
1 answer

Canbus 2.0b identifier

I Don't understand why this example code from mcp_can library &&'s the received can Id with 0x1FFFFFFF. What kind of bits can be lost? because the 3 MSB bits can be lost with this instruction. if((rxId & 0x80000000) == 0x80000000) // Determine…
Piet Jan
  • 11
  • 2
0
votes
1 answer

CAN low speed to CAN high speed adaption

I wonder if is possible to adapt a low speed fault tolerant CAN network (100kbps) to a high speed CAN network. I need this to connect a newer infotainment board (CIC) to my K-CAN inside my BMW e60 car. I already managed to wake up and control (on a…
SXN
  • 83
  • 12
0
votes
0 answers

CAN bus turns to ERROR PASSIVE state when loopback is turned off

I have connected a PiCAN2 board with raspberry pi running latest Jessie. When I try to send some CAN messages to my PC ( PC is connected via a USB to DB9 CAN interface to the PiCAN2 board) through this PiCAN2 using the can-utils, it runs into…
nj_bubbles
  • 78
  • 12
0
votes
1 answer

Converting Hex CANbus message to GPS long/lat

I´m looking for some help converting CAN packets from a PCAN-GPS unit to long/lat GPS coordinates. For example i receive Data=90F98E400A0045 for longitude and the package is in the following format: imgur link So I get the Degree and Indicator part…
Max
  • 3
  • 3
0
votes
1 answer

STM32F4xx CAN Filter Configuration

I am writing in reference to the information in the reference manual (bxCAN). I am trying to understand how CAN filter configuration works and need your help to check whether I understand it correctly or not. Especially the configuration of the…
TangoOne
  • 41
  • 1
  • 2
  • 7
0
votes
3 answers

CAPL block node from sending messages

I have a CAPL file attached to a CAN node that periodically sends a message using the 'output' function. How can I use a second CAPL file to block the node sending the message (while doing everything that the node does) ?
Jaws
  • 497
  • 8
  • 22
0
votes
1 answer

Clock source Selection for CAN bus Controller

Currently I am using a 32bit micrcontroller with embedded CAN controller. I am confused to select the clock source for CAN controller (based on 2.0 version Part A & B), as I have 3 options for clock source, Cascaded FMPLL clock, External Crystal…
0
votes
2 answers

Linux 2.6 on imx: Can't log sent CAN frames using candump

I have a custom build linux 2.6 running on a imx CPU. CAN communication with external nodes works like a charm, but the frames that I send to the nodes from my app is not printed when using "candump can0" in the terminal (when I run the same app on…
Eric G
  • 1
  • 4
0
votes
1 answer

Working with PiCAN + raspberry pi 3 running windows IoT Core

I want to connect the PiCAN with my raspberry pi3 running windows IoT Core. I think I need a universal driver for the mcp2515 to work with the windows in Pi. I already tried using the instructions given in …
0
votes
4 answers

How to send the Diagnostic IDs (DIDs) through CAPL script?

Currently, I am automating the test cases for testing the Gauges in the Instrument Cluster. I have come across changing the units from metric to US through DIDs. Can anybody help me how to send the diagnostic related stuff using CAPL script.
Adarsh Kale
  • 1
  • 1
  • 1
  • 4
0
votes
1 answer

J1939 RTR Issue

I have and issue with rtr frames using candump and cansend. Dumping the broadcasted data is no issue. Architecture - Raspberry pi with a pican shield reading data from a J1939 simulator. I run candump to receive all messages on the bus. Then get an…
Emerson
  • 270
  • 2
  • 4
  • 11
0
votes
1 answer

Is there a way to force tcpdump to print only hex format when reading CAN packets?

Although the can-utils package is available in Linux to interact with CAN network devices, I am trying to confirm if tcpdump can print just hex format when reading CAN packets without including ASCII characters? tcpdump version 4.2.1 libpcap…
InfinitelyManic
  • 760
  • 1
  • 6
  • 13
0
votes
0 answers

Beaglebone Black CAN bus communication using Simulink

Does anybody know if it is possible to use CAN communication with beaglebone black when programming with Simulink?? We need Simulink for prototyping so, it is paramount to be able to program with this software. Thanks.
Andrés
  • 21
  • 2