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
-1
votes
2 answers

Issue with a function reversing byte order

I'm working on CAN Frames, in order to decode their payload, I have to reverse their order. The payload is a uint8_t payload[8] (8 bytes in the payload) read in the can frame with an external function that works properly. I have this function…
-1
votes
1 answer

How to check in CAPL if message is receiving in simulation or not?

I want check in CAPL if the message is receiving or not in the simulation and if it is not coming in the trace, i want send new message. I have tried using functions like. I want to check particular message is receving or…
Anurag
  • 7
  • 1
  • 3
-1
votes
1 answer

More efficient way for reading CAN data in while loop

I have 3 devices which send 8 bytes of data over CAN interface. To read the buffer from CAN I am using a while loop which looks something like this: void CanServer::ReadFromCAN() { data_from_buffer_.clear(); can_frame frame; …
aikhs
  • 949
  • 2
  • 8
  • 20
-1
votes
1 answer

How to decipher CAN bus message?

I want to to know is it possible to make a script that decipher and document CAN message. My goal is to define which id of CAN bus message is related to speedometer, odometer, Engine RPM etc.
Stan
  • 1
  • 1
-1
votes
1 answer

How to append the first zero's of HEX to the BIN string?

I am trying to implement a bits extractor for CAN bus data in Excel. I struggle with the algorithm part therefore this is mainly independent from Excel/openpyxl. I have a table with the ID being stored in column B and the binary code per time step…
Nezuko
  • 34
  • 6
-1
votes
1 answer

How to automize an UDS command by a CAPL script

For test automatization in my current project it is necessary to automize the sending of UDS commands with a simple CAPL script inside of CANoe. The possible UDS commands are given by a ODX file. How can I write and execute such a CAPL script and…
Aleph0
  • 5,816
  • 4
  • 29
  • 80
-1
votes
1 answer

CAPL: Sending continous message after a key stroke

I am trying to send a message continuously after a key stroke and also reset the message after a set time. includes { } variables { int i; int j; } On key 'a' { j = 1; } on start { if(j == 1 && i <= 300) { message MyMessage msg; …
Aashu10
  • 49
  • 10
-1
votes
2 answers

Synchronizing different messages

I think it's a general software paradigm problem, so it's not related that much to embedded software. I have 3 Messages that I get at different time slices, the three messages are Odo, velocity, gps. each one has timeslice 20ms, 1sec, and 1sec. My…
andreahmed
  • 29
  • 5
-1
votes
3 answers

How return the value every time in while loop in python

i have the below code import can def abcd(): bus = can.interface.Bus(channel= '1', bustype='vector',app_name = 'python-can') MSG = bus.recv(0.5) while MSG is not None: MSG = bus.recv(1) return MSG if __name__ ==…
-1
votes
2 answers

is there a way to modify the CANoe Rx Messages before Receiving on the Bus?

I'm Receiving CAN Message from my Controller(Suppose Message ID= 0x100 signals S1,S2), But I want to change the signals of Canoe Rx message before Receiving it on the Bus.
-1
votes
1 answer

How to separate a string to separate types, a can signal?

I am working on an API to read CAN signal. This part of the code outputs the received CAN in the form of a string. xlCanGetEventString(&xlCanRxEvt) The CAN signal is in the form of: XL_CAN_EV_TAG_RX_OK ch:1 t=9026813952 id:98FF1880 dlc:8…
Akash
  • 11
  • 1
  • 4
-1
votes
1 answer

Qt creator Undefined reference to "class::function" in linux

This question is similar to one that has been asked before, but I am having an issue with Qt recognizing my class and functions despite them being defined. I am doing this in linux where the Qt version is only 5.5 while the windows version is at…
viduwoy
  • 113
  • 12
-1
votes
1 answer

How to block a particular id from a socketCAN virtual network?

I have a virtual socketCAN network. How do I block a particular ID from being sent on the network?
Verma
  • 13
  • 1
  • 1
  • 3
-1
votes
1 answer

CANopen CiA 401 input polarity

I'm trying to implement the CiA 401(I/O). But I don't know how the device should behave if the object 6002 (input polarity) changes. Should the value in object 6000 (read input) also change and if so, a PDO should also be sent, although nothing has…
gotocoffee
  • 199
  • 10
-1
votes
1 answer

CAN interface physical memory address

Where/how do I locate the physical memory address of my CAN interface card? I need to use this to open a port.
gwen