CAN Interface
CAN Platform interface
CAN Overview
The Controller Area Network (CAN) interface serves as a foundational abstraction for communication between electronic control units (ECUs) or nodes in embedded systems. It provides a standardized protocol that facilitates reliable, real-time data exchange in distributed systems, making it a cornerstone of automotive and industrial communication.
A CAN interface acts as a communication endpoint on a shared bus, enabling multiple devices to transmit and receive data efficiently. It supports robust communication by integrating priority-based arbitration, error detection, and fault confinement mechanisms, ensuring data integrity even in harsh environments
CAN Types
CAN : Represents standard CAN operation, supporting up to 1 Mbps with a maximum payload of 8 bytes.
CAN_FD : Represents CAN-FD (Flexible Data Rate) operation, supporting higher data rates (up to 8 Mbps) and payloads up to 64 bytes.
Supported Communication Modes
The following modes of CAN communication are supported:
Blocking - Here the read/write function waits(blocked) till the operation is performed or time out.
Non-Blocking - The read/write function returns immediately with appropriate return values.
The HAL will support different modes of operations such as Idle, Init, Normal, Sleep, Test etc.
Application Interface
The below table captures the functions that are to be called from the application layer.
Function |
Description |
|---|---|
rs_can_open |
To open the CAN interface. |
rs_can_set_config |
To configure the CAN interface. |
rs_can_configure_rx_filters |
To configure the CAN rx filters |
rs_can_set_tx_buffers |
To set up the transmit buffers to the CAN interface to be used for the CAN stack |
rs_can_set_rx_buffers |
To set up the receive buffers to the CAN to be used for the CAN stack |
rs_can_set_mode |
To set up the operation mode for the CAN stack |
rs_can_transmit |
To transmit the CAN frame data to the CAN interface |
rs_can_put_transmit_buf |
To release the transmit buffer of CAN. |
rs_can_register_callback |
To registers the given callback function for CAN operation |
rs_can_close |
To close the CAN interface. |
Error Code
Every API’s for the CAN returns some success or failure values. Please refer below section,
Implementation Guide
This section explains how to implement the CAN interface using the RAPIDSEA stack, the steps to be followed are
Configure the preferred method of RX or TX communication(Blocking / Non-Blocking).
Configure the CAN interface.
Then call the open call of the CAN interface.
Perform the transmit and receive operations as required and handle the error codes.
Close the CAN interface.
Documentation from the relevant header as follows:
Warning
doxygenfile: Cannot find file “rs_can.h