ISO15765 - DoCAN Protocol
DoCAN Overview
ISO 15765 (ISO-TP or DoCAN) is an international standard for sending data packets over a CAN-Bus that exceed the eight byte maximum payload of CAN frames. ISO-TP segments longer messages into multiple frames, adding metadata that allows the interpretation of individual frames and reassembly into a complete message packet by the recipient allowing up to 4GB of transfers.
Embien offers its implementation of the protocol via the RAPIDSEA DoCAN stack. Some of the major features of the stack are
Support for both SF, FF, CF and FC
Support for various timing configuration
Multi-message filtering
Up to 4095 bytes transfer support
MISRA-C compliant ANSI C source code
Can be used with or without RTOS
Can support 8, 16, 32, 64-bit CPUs
As captured in the below diagram, the DoCAN stack is typically accessed by the higher level application stack like UDS and this in-turn calls the lower level CAN HAL.
Using DoCAN
This section covers the details of how to use the DoCAN stack. Essentially the DoCAN is responsible for framing of packets and de-framing of packets of large messages over smaller CAN frames. It employs frames such as SingleFrame (SF), FirstFrame(FF), ConsecutiveFrame(CF) and FlowControl(FC) packets to manage the message flow.
As it is message oriented, the RAPIDSEA DoCAN stack has to be provided with the buffers during initialization. The size of the buffers can be determined by the user based on their application requirement. For example, if 4096 message size has to be supported, each of the buffer must be of at least this size plus a few more.
When the higher level application layer wants to transfer a message, it should first request one from the DoCAN layer, fill it with data and queue it for transmission. Then the DoCAN stack sends the message over one or more frames and informs the caller of the status of the transfer. Similarly when an incoming message is received, DoCAN consolidates it over multiple frames in a single message and provides it to the application layer as a single message.
The below table captures the function that are to be called from the application logic.
Function |
Description |
|---|---|
rs_iso15765_open |
To initialize the ISO15765 DoCAN stack |
rs_iso15765_get_version_info |
To get docan version information |
rs_iso15765_set_tx_msg_buf |
To assign buffers for transmission |
rs_iso15765_set_rx_msg_buf |
To assign buffers for reception |
rs_iso15765_release_transmit_msg |
To release the transmit buffer of DoCAN message |
rs_iso15765_rx_buffer_handled |
To indicate successful processing of received message |
rs_iso15765_get_transmit_msg_buf |
Retrieves a free transmit message buffer for preparing a new DoCAN frame. |
rs_iso15765_queue_transmit_msg |
Queues a prepared message for transmission through the DoCAN stack. |
rs_iso15765_change_param |
Allows updating configurable parameters such as block size and STmin parameters. |
rs_iso15765_register_callback |
Registers callback function to be called on events |
rs_iso15765_process |
To be periodically called for internal processing |
rs_iso15765_close |
To free the DoCAN handle |
There are several callback functions through which the DoCAN stack retrieves dynamic parameters or notifies the application about specific events. These functions are captured in the below table.
Function |
Description |
|---|---|
rcb_iso15765_get_dynamic_bs |
Provides the application-defined dynamic Block Size (BS) for flow control. |
rcb_iso15765_get_dynamic_stmin |
Provides the dynamic Separation Time (STmin) value required for flow control. |
rcb_iso15765_param_changed |
Notifies the application when the DoCAN communication parameters (BS and STmin) have been updated. |
rcb_iso15765_rx_seg_msg_started |
Called when segmented reception begins (First Frame received). |
rcb_iso15765_msg_rxed |
Indicates that a complete DoCAN message has been received and is ready for application processing. |
rcb_iso15765_msg_txed |
Indicates that the message transmission is completed (Single Frame or the last Consecutive Frame). |
The details of these functions are covered in the below sections.
The application logic should call the rs_can_init function and use the returned handle when initializing the DoCAN stack.
The below table captures the functions that are called by the DoCAN stack to interface with the CAN Data Link Layer, as well as the callback functions used by the CAN layer to notify the DoCAN stack about transmit and receive events.
Function |
Description |
|---|---|
rs_can_register_callback |
Registers the ISO15765 DoCAN stack call back with the CAN layer |
rs_can_get_transmit_buf |
To get CAN buffers for transmission |
rs_can_transmit |
To transmit CAN buffers |
rs_can_put_transmit_buf |
Releases or returns the CAN transmit buffer after use. |
rcb_iso15765_can_tx_done |
Callback invoked by the CAN layer to notify that a CAN frame transmission is complete. |
rcb_iso15765_can_frame_rxed |
Callback invoked by the CAN layer when a new CAN frame is received, passing it to the DoCAN stack for processing. |
More details of these CAN related functions are available in the CAN Interface page.
The below diagram captures the high level sequence of operations associated with the DoCAN stack.
Refer to the ISO14229 - UDS Protocol page for an example about how the RAPIDSEA UDS stack uses the DoCAN.
Dependency
This stack depends on the below RAPIDSEA interfaces that can be obtained or custom implemented.
DoCAN Header Details
Documentation from the relevant header as follows:
Warning
doxygenfile: Cannot find file “rs_iso15765.h