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

Tiny-CAN I-XL socketCAN extended format

My Problem is the following. I am using the Tiny-CAN I-XL CAN-USB adapter and socketCAN on Linux. I configure the CAN adapter by doing: sudo slcan_attach /dev/ttyUSB0 -w sudo ip link set can0 type can bitrate 100000 restart-ms 500 sudo ifconfig…
Bant
  • 53
  • 1
  • 7
0
votes
1 answer

STM32F4 - CAN bus transmit succeeds every time, but CAN receive only succeeds on the first call

I'm using an STM32F469 Discovery board and I'm trying to use the CAN features. I understand that on this board CAN1 cannot be used at the same time as the touchscreen. Therefore I need to use CAN2, but in order to enable CAN2, CAN1 needs to be…
James Elder
  • 1,583
  • 3
  • 22
  • 34
0
votes
2 answers

How to access Interactive Generator block (IG) in Vector CANoe CAPL?

I want to access IG block in CAPL,e.g activate/deactivate message sending, set signal value. but I didn't find this kind of capl function.
ZQ Liu
  • 1
  • 1
  • 1
  • 2
0
votes
0 answers

STM32 F1 - How to configure CAN filters using CAN interrupts?

I can configure CAN filters from main.c file, but I want also to configure them by sending frame from the other node. There is the code from interrupt I want to use to configure filters: HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin); …
Juras
  • 23
  • 1
  • 9
0
votes
0 answers

STM32f4 401cDisco: When I use can StdPeriph it shows lots of errors in it's basic functions

When I attach my own libraries (that have already worked on other devices) stm32f4xx_can.c goes crazy as shown in this photo: Eclipse says it has something to do with these colons and semicolons, but that's apparently not the problem. How do I…
Manaslu
  • 228
  • 1
  • 13
0
votes
1 answer

Convert binary to bytearray with 8bit encoding

I am writing code which create messages to be sent over a CANBUS using a particular protocol. An example format for a data field of such a message is: [from_address (1 byte)][control_byte (1 byte)][identifier (3 bytes)][length (3 bytes)] The data…
oirectine
  • 139
  • 8
0
votes
1 answer

CAN bus delay between sending remote requests

What is the proper way to send multiple remote requests in CAN2.0B/A? Is it usual to have some delay between them like 1/50s, for the receiver to react? I know it shouldnt be needed if proper interrupts are used, i just want to do it the way it is…
Piet Jan
  • 11
  • 2
0
votes
1 answer

How to Claim Address on J1939 CAN bus?

My main goal is to to get VIN no of my control unit but for that i need to send command to controller and before sending any command to controller i must have to claim address. I have send below command on my network but didn't got any response from…
jtro
  • 121
  • 1
  • 2
  • 5
0
votes
0 answers

CAN RX interrupt freezing on STM32

I have a problem that my RX interrupt callback doesn't trigger after some time of running state (sometimes 30 seconds, sometimes 10 minutes...), and I don't know any more where to look for the failure. I am using a CANopen stack from Emtas, but this…
Michal D
  • 109
  • 15
0
votes
1 answer

Lin bus add a slave to a configured lin cluster

Hello I'm working on lin bus and i wanted to know if is it possible to autoaddress a slave that we add on a cluster already configured. imagine a cluster with master and several slaves working (NAD assigned and LDF created) and we add a new slave…
B.Abd
  • 13
  • 4
0
votes
2 answers

CAN bus arbitration method

I am trying to understand CAN bus arbitration method using the following example but i am not understanding why the bus level is 0(zero) somewhere and 1 elsewhere.Here s1,s2,s3 are three nodes with three different identifiers and logic zero means…
query
  • 531
  • 3
  • 7
  • 30
0
votes
1 answer

How does CANopen client communicate with Modbus slave through CANopen/Modbus gateway ?

I am now studying and developing a CANopen client with a python stack and i'm struggling to find out how to communicate with a slave Modbus through a gateway. Since the gateway address is the one present in the Object Dictionary of the CANopen, and…
B.Abd
  • 13
  • 4
0
votes
1 answer

How can I get "mode & PIDs" from raw OBD2 identifier 11 or 29 bit?

I have connected OBD2 and getting the can data (11bit 500kpbs CAN) using atmel can controller. I get data. Now, how do I get the mode and PIDs from this data? For example, my data looks like this: 15164A8A-FF088B52 -- Data:…
Eugene
  • 17
  • 2
  • 6
0
votes
0 answers

Copy Value into byte array in python

I need to copy a value (bigger then a byte) into a byte array for working with CAN messages in python. The value needs to be copied into the array by defining a startbit (NOT byte!) with a supplied length, while the rest of the array stays…
Robin K.
  • 25
  • 6
0
votes
0 answers

How can I use mcp2515 & device tree?

My Kernel Source writes platform data to device tree.(kernel version 3.10.9) The board used is Exynos5422. So I wrote mcp2515 platform data parameter to .dts dts: spi_1: spi@12d30000 { status = "okay"; spi-src-clk = <0>; …
GMLEE
  • 1
  • 1