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

How to wrap a text file or string into a CAN message format in python?

I want to send a text file consisting of a string across the CANtact toolkit which accepts only CAN message format (eg [1,2,3,4,5,6,7,8]or[147,63,24,95,67,22,15,77]) of 8 bytes long. How to convert the text file to such CAN message format preferably…
annonymous
  • 131
  • 3
  • 14
-2
votes
1 answer

Monitor a CAN message

I have a script with CAN signals A,B and C. All the signals are periodic. I want to send signal C depending on the value of A and B. Is there a way to monitor CAN signals via CAPL (Trying to monitor real time data). Suppose if I want to perform an…
Nikhil
  • 139
  • 1
  • 5
  • 14
-2
votes
1 answer

stm32f4 discovery CAN transmit

This is my program for CAN transmit. I just want to see through the oscilloscope wether something is being sent or not. I am using stm32f407 and attolic true studio for it, but i am unable to see any signal on my tx pin. Kindly tell me where is…
imran
  • 11
  • 2
-2
votes
1 answer

CAN Bus: Is simulatenous communication possible?

I need to establish a HMI protocol based on CAN, that enables the simultaneous communication of the application Device with the HMI Device? Restriction is that CAN can be realised as a simultaneous bus access, by using CSMA/CA method. it is based on…
qwerty
  • 105
  • 3
-2
votes
1 answer

building example of canopen from canfestival error

I've got canopen source from canfestival. I got errors when I built its win32test example on visual stdio, there wasn't any lib file in file that I downloaded and extracted. any help would be appreciated. the errors: error C2065:…
samini
  • 195
  • 11
-2
votes
1 answer

Algorithm for bitmask on CAN messages

Using CAN communications with a DBC as database, there are two different ways of encoding integer signals to the 64bit (8 byte) message data: Intel and Motorola. To convert the 8 byte of message data to the distinct signals, I first want to use a…
mxcd
  • 1,954
  • 2
  • 25
  • 38
-2
votes
1 answer

Socket-CAN does not work when using linux socket-communication(via wifi)

this is Server-side code (raspberry pi) #include #include #include #include #include #include #include #include #include #include…
whoami
  • 1
-2
votes
1 answer

Using thread class to manage sending/receiving messages

I have a class that I'm using to manage creation of and destruction of threads that are responsible for sending and receiving CAN messages. I don't know if this is the best way to go about it, so I'm looking for advice on how to manage my threads…
Rethipher
  • 336
  • 1
  • 14
-3
votes
0 answers

CAPL script to produce a Bus off on can Network

Actually I am trying to produce a BUS off using CAPL predefined functions. I am sending error frame using this function canOutputErrorFrame(can1.errorframe,8,0) repetitively so the counter reach 255 , but I saw that the network doesn't change its…
-3
votes
1 answer

why CAN hardware acceptance filter present in receive?

enter image description here I interested in CAN HW object. I aware of CAN Acceptance filter that in change of CAN ID filtering. why CAN hardware acceptance filter present in receive? When CAN message received, is CAN arbitration procedure…
최 고운
  • 3
  • 1
  • 4
-3
votes
2 answers

How to run a simulation of CAN messages on Python

I have am currently learning how to use libraries in python and I have a project in mind, which requires me to use the CAN library https://python-can.readthedocs.io/en/master/index.html . I would like to simulate CAN messages to test and create a…
-3
votes
3 answers

making OBD-II reader using STM32F3

i start making my own obd2 reader with stm32f303k8 and MCP2551 transciever CAN BUS . For that i start with CubeMX for configuration and Keil using Hal functions but i still trying to get data from car.. until i found stm32f10x code who remplace…
-3
votes
1 answer

How to write a parent program that is using other C programs?

I am making a can-bus network that will survey some sensors to gather data in order to have better understanding of an environment that we want to analyse and control. In order to do so we use candump to monitor traffic and can send to sen…
-3
votes
2 answers

File does not open in C

File does not show up when I enter what i want but it also doesn't give me the error. The file is: Account Name Balance 100 Jones 24.98 200 Doe 345.67 300 White 0.00 400 Stone -42.16 500 Rich 224.62 int main(void) { int…
-3
votes
1 answer

Programming a motor connected to computer through CAN communication?

I have a motor connected to my computer, which is connected through CAN to the motor. Basically, I have a USB-to-CAN adapter, to which I connect a USB cable from my computer. Then, from the adapter, the motor is connected through CAN. Now, I wish to…
1 2 3
77
78