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

Communication protocol implementation in embedded C++

I have been implementing a CAN based proprietary communication protocol in C++. The protocol uses messages with following structure: 1 Control packet (3 bytes header, 5 payload bytes) 0 - 124 Data packets (2 bytes header, 6 payload…
Steve
  • 805
  • 7
  • 27
-1
votes
1 answer

How many nodes a typical CAN/LIN/MOST Networks will contain?

I would like to know number of nodes a typical network(CAN/LIN/MOST) Contain and On which basis we will decide?
Arun
  • 15
  • 1
  • 7
-1
votes
1 answer

STM32F746 CAN Initialisation timeout

Good day all I have been trying to migrate from a STM32F407 to a STM32F746. The issue I ran into was using the ST HAL library to initialise the CAN. The code was generated from MX Cube (4.16). Using a Nucleo-144 STM32F746, I could get past the…
Flip
  • 881
  • 7
  • 13
-1
votes
1 answer

CAN Communication

How can I implement CAN communication in c# windows application. I have to create an application that communicate to the device. In earlier project I used serial port. What will be the major difference between these two.. Am new to this topic.
user3575807
  • 49
  • 1
  • 7
-1
votes
1 answer

Convert String To Char In Arduino

How can I sent data with CAN bus from one Arduino board to another? The data must be like this example #include #include MCP_CAN CAN0(10); // Set CS to pin 10 void setup() { …
Amin Seifi
  • 58
  • 1
  • 6
-1
votes
2 answers

CAN BUS Acknowledgment error

I am using STM32F429 CAN bus Program with TJA1041A as CAN Transreciver.The Problem is the messages are not getting acknowledged and herewith I am attaching the code for further reference.I am using PCAN View to see the messages.I kindly request…
user2870154
  • 77
  • 2
  • 3
  • 9
-1
votes
3 answers

CAN diagnostics

I have to develop a smartphone application which will communicate with a car diagnostic tool. Generally, the protocols used in the diagnostic are KWP2000, UDS and OBD. My question is " how to communicate with the car ? and how to work with these…
Andromida
  • 1,095
  • 1
  • 11
  • 28
-2
votes
1 answer

Esp32 sn65hvd230: I can't get it to read in real time

I am working on a project based on the ESP32 processor and Arduino framework, which communicates with another board via CANBUS protocol. The bitrate is 125k so it is presumably "fast". I am using the Sandeep Mistry library or also known as…
WikiLift
  • 11
  • 5
-2
votes
1 answer

Converting an integer into three hexadecimal variables

I have a problem when trying to convert a 6 digits number into three hexa decimal numbers I'm using an Arduino Nano I already did the following Converting to string Hexa Cutting string with substring into three other strings But my CAN library want…
Exosys
  • 1
  • 2
-2
votes
1 answer

slcand error : Inappropriate ioctl for device

I want to use can interface with slcand, but I have a problem. To link can device(canable) with slcand, I make symbolic link with udev-rule SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{product}=="canable gs_usb",…
-2
votes
1 answer

WSL2 Virtual can interface error : recv failed with error: 11, remove this node 4

I refered these 2 blogs to enable vcan in WSL2: https://www.reddit.com/r/CarHacking/comments/ot3gjf/socketcancanutils_on_windows/ My environment OS : Windows 11 Kernel : 5.10.102.1-microsoft-standard-WSL2 Well worked file following the blog copied…
nayang
  • 157
  • 1
  • 14
-2
votes
1 answer

CAPL - (this) keyword

I am new to CAPL , and I was wondering how this word works in my example ? on errorFrame { int ReportFirstDetecetdError_Ch1 = 0; if ( this.msgChannel == 1 ) { AmountOfDetected_CAN_Error_Ch1++; if (…
Milad
  • 3
  • 2
-2
votes
1 answer

Can Open read sensor data

I just bought a „Contelec Vert-x“ degree sensor and connected it via can bus on my LPC55S16 Board. The question now is how do i read the data the sensor gives me with CanOpen. The documentation is not good and the examples for MCUXpresso are just…
Mawin
  • 1
-2
votes
1 answer

How to obtain CAN transmitted data (256 bytes)using Diagnostic functions using CAPL?

256 bytes of data is transmitted to CAN bus as response to a particular DID. It consists of 14 samples of data AND one sample consists of 12 bytes of data (10 different values of 10 different variables packed across 12 bytes). I need to collect…
-2
votes
1 answer

How can I talk only to one ECU in a two ECU Car with ELM237 and OBDII

I am sending following ELM237 commands to a Porsche Cayenne. There are two ECU on the Bus 7E9 and 7E8. I would like to address only one at a time. I thought I can do that by using atsh7E8 to talk only to one but then the answers contain only the…
Ride Sun
  • 2,145
  • 3
  • 18
  • 41