.. _knowledge-base-segmentation: Segmentation ============ .. _knowledge-base-message-segmentation: Message Segmentation -------------------- To transmit a diagnostic message, its information (payload and addressing) must be unambiguously encoded into one or more segments (these segments are called :ref:`UDS Packets ` by this documentation) that are specific for bus used. .. note:: Segmentation process is specific for each bus due to various topologies supported by each bus, various communication models (e.g. Master/Slave) enforced by them, etc. Segmentation on CAN ``````````````````` .. _knowledge-base-unsegmented-message-transmission: Unsegmented message transmission '''''''''''''''''''''''''''''''' When mentioning unsegmented message transmission, we mean a case when an entire :ref:`Diagnostic Message ` can be fully transmitted by a single packet. :ref:`Single Frame (CAN Packet) ` is the only type of CAN Packets that can be used in the described scenario. .. figure:: ../../images/CAN_Unsegmented_Message.png :alt: Unsegmented Message on CAN :figclass: align-center :width: 100% Transmission of an unsegmented Diagnostic Message on CAN bus. A sender transmits a :ref:`Single Frame (CAN Packet) ` that contains an entire :ref:`Diagnostic Message `. .. _knowledge-base-segmented-message-transmission: Segmented message transmission '''''''''''''''''''''''''''''' When a :ref:`Diagnostic Message ` to be transmitted on CAN contains payload which size is greater than a :ref:`Single Frame ` capacity, then the message payload must be divided and transmitted by many CAN packets. The first packet to carry such messages is :ref:`First Frame (CAN Packet) ` and its transmission is followed by :ref:`Consecutive Frames (CAN Packets) `. A receiver controls the stream of incoming :ref:`Consecutive Frames ` by sending :ref:`Flow Control (CAN Packet) ` after :ref:`First Frame ` and each complete transmission of :ref:`Consecutive Frames ` block. .. note:: The size of :ref:`Consecutive Frames ` block is determined by :ref:`Block Size ` parameter which value is carried by :ref:`Flow Control `. .. note:: The minimum time between two :ref:`Consecutive Frames ` is determined by :ref:`Separation Time Minimum ` parameter which value is carried by :ref:`Flow Control `. .. figure:: ../../images/CAN_Segmented_Message.png :alt: Segmented Message on CAN :figclass: align-center :width: 100% Transmission of a segmented Diagnostic Message on CAN bus. A sender initiates :ref:`Diagnostic Message ` transmission with a :ref:`First Frame (CAN Packet) ` Then, a receiver controls the stream of incoming :ref:`Consecutive Frames (CAN Packets) ` by transmitting :ref:`Flow Controls (CAN Packets) `. .. seealso:: Only the typical use case of :ref:`Flow Control ` was described here. Check :ref:`Flow Status ` parameter and meaning of its values to study less likely scenarios. .. _knowledge-base-packets-desegmentation: Packets Desegmentation ---------------------- Desegmentation is an unambiguous operation which is the reverse process to a `message segmentation`_. It transforms one or more :ref:`UDS packets ` into a :ref:`diagnostic message `. .. note:: There are many ways to segment a diagnostic message into CAN packets, but there is always only one correct way to perform desegmentation and decode a diagnostic message out of CAN Packets.