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

CAPL Programming usage of Timer as a delay

I have been writing a CAPL script that would send message on each channel (2 no's) after a certain delay. The following delay i want to generate using SetTimer() and mstimer::isRunning function. I can use setTimer function but I dont know how to use…
Yash Vardhan
  • 67
  • 1
  • 1
  • 5
3
votes
1 answer

Get the bxCan working on STM32f3 Discovery

I'm working on getting the bxcan on stm32f3 discovery working. I created a simple program what is sending message over the bxcan and checking the pins PA11 and PA12 in the lab with an osci and at home with a multimeter. So far the osci and…
judoka_acl
  • 375
  • 2
  • 22
3
votes
2 answers

How can calculate the software acceptance Mask value

I would like to know how can we calculate the software acceptance filter mask for some set of standard CAN id.It would be great if some one can explain this with example. And also please suggest some links/materials to learn the CAN stack software…
user2516265
  • 61
  • 1
  • 1
  • 3
3
votes
2 answers

Flow control message while receiving CAN message with ELM327

I am trying to make a software, which runs under Windows and communicates with an ELM327 device. I created the first version and I went in my SMART ForTwo (SMART 451) vehicle and I managed to connect with the Instrument Cluster (Transmit CAN ID is…
user3650225
  • 31
  • 1
  • 3
3
votes
4 answers

STM32F429 is not receiving the CAN Message

I am using STM32F429 Microcontroller and need to implement CAN Bus Communication between CAN2 and PCAN View.I am able to transmit the message from CAN2 but I am not able to receive any message.I am using TJA1041A CAN transreceiver in the…
user2870154
  • 77
  • 2
  • 3
  • 9
3
votes
1 answer

How to setup PDO mapping?

I basically understand the concept of PDO mapping in CANopen networks. It allows to to broadcast real-time data with small header. how it is made? How do I setup my devices to know how to send/receive PDO's? Do I need some kind of software for…
user2449761
  • 1,169
  • 13
  • 25
3
votes
1 answer

SocketCAN over Ethernet

I am going to try to explain our scenario briefly. We want to setup a simulation environment for our system running on Ubuntu so that we can use it together with our Windows based simulation tool suite. Currently we are running Ubuntu in a virtual…
dbostream
  • 781
  • 2
  • 11
  • 27
3
votes
3 answers

Is it possible to have CAN on Arduino without extra hardware?

I would like to have Arduino operating in a CAN network. Does the software that provides OSI model network layer exist for Arduino? I would imagine detecting the HI/LOW levels with GPIO/ADC and sending the signal to the network with DAC. It would be…
Nikita Vorontsov
  • 194
  • 2
  • 15
3
votes
4 answers

SocketCAN continuous reading and writing

I'm writing a program that continuously sends "Hello" to a CAN-bus and reads data from the bus via SocketCAN. I want those two steps to be independent. That means even if there is no data on the bus, the program will still send "Hello". But with…
PaulPonomarev
  • 355
  • 1
  • 4
  • 20
3
votes
1 answer

how to resolve this error -- while compiling socketcan utilities

I have downloaded from SVN can utilities. Because by default can utitlities are not in kernel. svn checkout svn://svn.berlios.de/socketcan/trunk/can-utils Kernel i am using is :-- ignite@ignite:~/socketcan/can-utils$ uname -a Linux ignite…
Allan
  • 2,971
  • 4
  • 24
  • 28
3
votes
5 answers

Robust and easy to implement serial bus (automotive application)

What serial communication bus would you use in a automotive embedded system if your main selection criteria were: Electrically robust Slow speed (32 kb/s) Easy to program Easy to interface with microcontrollers It won't be transferring…
JcMaco
  • 1,258
  • 3
  • 16
  • 31
3
votes
1 answer

STM32F4Discovery: CAN filter configuration

I am using the STM32F4Discovery kit to build a simple CAN interface. I managed to configure it so I can transmit CAN messages, however, I am stuck at receiving them. As far so I know, to receive a CAN message, it has to pass acceptance filters. I…
jurij
  • 383
  • 3
  • 7
  • 21
3
votes
2 answers

Modelica and CANBus (General, CANOpen, and/or J1939)

I have experience with Simulink and CANbus interfaces for both simulation and code generation... but I really like open source. For quite awhile Octave has qualified as a MATLAB replacement (at my usage level) but I just recently found out about…
altendky
  • 4,176
  • 4
  • 29
  • 39
3
votes
3 answers

What will happen in CAN?

I had an interview. The interviewer asked me: If two nodes are sending two messages of the same identifier (0x100) with different data, who will win the arbitration? Which message will be there on the bus? If node 1 wins then what about node 2's…
Rasmi Ranjan Nayak
  • 11,510
  • 29
  • 82
  • 122
3
votes
2 answers

Best way to display high-speed data from a telnet interface on a web view?

I'd like to display data coming off a telnet interface on a web view. I have a daemon running which reads CAN bus data and produces about 500 lines of ~40 characters per second onto a telnet port. It's a few messages running at 100 Hz and most…
Tim Trampedach
  • 201
  • 2
  • 6