GG System Software GbR
Software Engineering
CAN ISO Transport Protocol (ISO 15765-2)
                              CAN ISO TRANSPORT PROTOCOL (ISO 15765-2)

                                  Günter Gebhardt, M. Systems Eng.
                                    g.gebhardt@gg-sw-systems.de
                                        www.gg-sw-systems.de
                                            1. June 2022


    1. Overall N_PDU Format

        +------+-------+--------+
        | N_AI | N_PCI | N_Data |
        +------+-------+--------+

        N_AI   - Address Information
        N_PCI  - Protocol Control Information
        N_Data - Data field


        N_AI consist of or depends on the following elements

        Mtype    - Message Type (diagnostics, remote diagnostics)
        N_TAtype - Target Address Type (physical, functional)
        N_TA     - Target Address (0x00-0xFF)
        N_SA     - Source Address (0x00-0xFF)
        N_AE     - Address Extension (0x00-0xFF, Mtype 'remote diagnostics')


        CAN/CANFD Frame usage is defined by the following parameters:

        CAN_DL (n) - Physical length of CAN/CANFD frame data in bytes.
        TX_DL      - Transmit data link layer data length (limits CAN_DL, 8 - 64)

    1.1. Addressing Formats

    1.1.1. Normal Addressing, physical/functional Target Address, 11 Bit ID

        Used when Mtype is 'diagnostics'.

        +-----------+---------+--------+     +--------+
        | 11 Bit ID | Byte 0  | Byte 1 | ... | Byte n |
        +-----------+---------+--------+     +--------+
        |<--N_AI--->|<-N_PCI->|<-------N_Data-------->|

    1.1.2. Normal fixed Addressing, physical Target Address, 29 Bit ID

        Used when Mtype is 'diagnostics'.

        +-----------+---------+--------+     +--------+
        | 29 Bit ID | Byte 0  | Byte 1 | ... | Byte n |
        +-----------+---------+--------+     +--------+
        |<--N_AI--->|<-N_PCI->|<-------N_Data-------->|

        +--------+     +--------+--------+     +-------+-------+     +-------+
        | Bit 28 | ... | Bit 16 | Bit 15 | ... | Bit 8 | Bit 7 | ... | Bit 0 |
        +--------+     +--------+--------+     +-------+-------+     +-------+
        |<--------0x18DA------->|<--------N_TA-------->|<-------N_SA-------->|
        |<-------------------------------N_AI------------------------------->|

    1.1.4. Normal fixed Addressing, functional Target Address, 29 Bit ID

        Used when Mtype is 'diagnostics'.

        +-----------+---------+--------+     +--------+
        | 29 Bit ID | Byte 0  | Byte 1 | ... | Byte n |
        +-----------+---------+--------+     +--------+
        |<--N_AI--->|<-N_PCI->|<-------N_Data-------->|

        +--------+     +--------+--------+     +-------+-------+     +-------+
        | Bit 28 | ... | Bit 16 | Bit 15 | ... | Bit 8 | Bit 7 | ... | Bit 0 |
        +--------+     +--------+--------+     +-------+-------+     +-------+
        |<--------0x18DB------->|<--------N_TA-------->|<-------N_SA-------->|
        |<-------------------------------N_AI------------------------------->|

    1.1.5. Extended Addressing, physical/functional Target Address, 11 Bit ID

        Used when Mtype is 'diagnostics'.

        +-----------------------+--------+---------+--------+     +--------+
        |       11 Bit ID       | Byte 0 | Byte 1  | Byte 2 | ... | Byte n |
        +-----------------------+--------+---------+--------+     +--------+
        |<--N_AI except N_TA--->|<-N_TA->|<-N_PCI->|<-------N_Data-------->|

    1.1.6. Mixed Addressing, physical Target Address, 29 Bit ID

        Used when Mtype is 'remote diagnostics'.

        +--------------------+--------+---------+--------+     +--------+
        |      29 Bit ID     | Byte 0 |  Byte 1 | Byte 2 | ... | Byte n |
        +--------------------+--------+---------+--------+     +--------+
        |<-N_AI except N_AE->|<-N_AE->|<-N_PCI->|<-------N_Data-------->|
        |<-----------N_AI------------>|

        +--------+     +--------+--------+     +-------+-------+     +-------+
        | Bit 28 | ... | Bit 16 | Bit 15 | ... | Bit 8 | Bit 7 | ... | Bit 0 |
        +--------+     +--------+--------+     +-------+-------+     +-------+
        |<--------0x18CE------->|<--------N_TA-------->|<-------N_SA-------->|
        |<--------------------------N_AI except N_AE------------------------>|

    1.1.7. Mixed Addressing, functional Target Address, 29 Bit ID

        Used when Mtype is 'remote diagnostics'.

        +--------------------+--------+---------+--------+     +--------+
        |      29 Bit ID     | Byte 0 |  Byte 1 | Byte 2 | ... | Byte n |
        +--------------------+--------+---------+--------+     +--------+
        |<-N_AI except N_AE->|<-N_AE->|<-N_PCI->|<-------N_Data-------->|
        |<-----------N_AI------------>|

        +--------+     +--------+--------+     +-------+-------+     +-------+
        | Bit 28 | ... | Bit 16 | Bit 15 | ... | Bit 8 | Bit 7 | ... | Bit 0 |
        +--------+     +--------+--------+     +-------+-------+     +-------+
        |<--------0x18CD------->|<--------N_TA-------->|<-------N_SA-------->|
        |<--------------------------N_AI except N_AE------------------------>|

    1.1.8. Mixed Addressing, physical/functional Target Address, 11 Bit ID

        Used when Mtype is 'remote diagnostics'.

        +--------------------+--------+---------+--------+     +--------+
        |      11 Bit ID     | Byte 0 |  Byte 1 | Byte 2 | ... | Byte n |
        +--------------------+--------+---------+--------+     +--------+
        |<-N_AI except N_AE->|<-N_AE->|<-N_PCI->|<-------N_Data-------->|
        |<-----------N_AI------------>|


    2. N_PCI Types

        +-------------------------+
        |          Byte 0         |
        | 7  6  5  4 | 3  2  1  0 |
        | 1st Nibble | 2nd Nibble |
        |     FT     |            |
        +-------------------------+
        |<---------N_PCI--------->|

        1st Nibble - Defines the frame type (FT):
                     0x0 : SF-I (Single Frame ISO compliant)
                     0x1 : FF-I (First Frame ISO compliant)
                     0x2 : CF (Consecutive Frame ISO compliant)
                     0x3 : FC (Flow control frame)
        2nd Nibble - Content depends on the frame type determined by 1st Nibble


    3. Frame Types

    3.1. Single Frame (CAN_DL <= 8)

        +-------------------------+--------+     +--------+
        |          Byte 0         | Byte 1 |     | Byte n |
        | 7  6  5  4 | 3  2  1  0 |        |     |        |
        | 1st Nibble | 2nd Nibble |        | ... |        |
        |     0x0    |    DL      |        |     |        |
        +-------------------------+--------+     +--------+
        |<---------N_PCI--------->|<-------N_Data-------->|

        DL - Data Length (0x1-0x7)


    3.2. Single Frame (CAN_DL > 8)

        +-------------------------+--------+--------+     +--------+
        |          Byte 0         | Byte 1 | Byte 2 |     | Byte n |
        | 7  6  5  4 | 3  2  1  0 |        |        |     |        |
        | 1st Nibble | 2nd Nibble |        |        | ... |        |
        |     0x0    |    0x0     |   DL   |        |     |        |
        +-------------------------+--------+--------+     +--------+
        |<--------------N_PCI------------->|<-------N_Data-------->|

        DL    - Data Length (0x1-(TX_DL - N_AE.size - N_PCI.size))
        TX_DL - Size of the N_PDU i.e. the CAN frame.


    3.3. First Frame (DL <= 4095)

        +-------------------------+--------+--------+     +--------+
        |          Byte 0         | Byte 1 | Byte 2 |     | Byte n |
        | 7  6  5  4 | 3  2  1  0 |        |        |     |        |
        | 1st Nibble | 2nd Nibble |        |        | ... |        |
        |     0x1    |   DL MSB   | DL LSB |        |     |        |
        +-------------------------+--------+--------+     +--------+
        |<--------------N_PCI------------->|<-------N_Data-------->|

        DL MSB - Holds the most significant bits of DL.
        DL LSB - Holds the least significant bits of DL.
        DL     - Data Length of the whole message (0x001-0xFFF)


    3.4. First Frame (DL > 4095)

        +-------------------------+--------+--------+--------+--------+--------+     +--------+
        |          Byte 0         | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 |     | Byte n |
        | 7  6  5  4 | 3  2  1  0 |        |        |        |        |        |     |        |
        | 1st Nibble | 2nd Nibble |        |        |        |        |        | ... |        |
        |     0x1    |     0x0    |  0x00  |        |        |        |        |     |        |
        +-------------------------+--------+--------+--------+--------+--------+     +--------+
        |<-------------N_PCI-------------->|<-----------DL----------->|<-------N_Data-------->|

        DL - Data Length of the whole message in big endian format (0x00000001-0xFFFFFFFF)


    3.5. Consecutive Frame

        +-------------------------+--------+     +--------+
        |          Byte 0         | Byte 1 |     | Byte n |
        | 7  6  5  4 | 3  2  1  0 |        |     |        |
        | 1st Nibble | 2nd Nibble |        | ... |        |
        |     0x2    |     SN     |        |     |        |
        +-------------------------+--------+     +--------+
        |<--------N_PCI---------->|<-------N_Data-------->|

        SN - Sequence Number (0x1-0xF)


    3.6. Flow Control Frame
         
        +-------------------------+--------+--------+
        |          Byte 0         | Byte 1 | Byte 2 |
        | 7  6  5  4 | 3  2  1  0 |        |        |
        | 1st Nibble | 2nd Nibble |        |        |
        |     0x3    |     FS     |   BS   |  STmin |
        +-------------------------+--------+--------+
        |<------------------N_PCI------------------>|

        FS    - Flow Status:
                0x0: CTS, Clear To Send
                0x1: WT, Wait
                0x2: OVFLW, Overflow
        BS    - Block Size:
                0x00 (unacknowleged/acknowledged without retry): Unlimited block size
                0x01-0xFF (unacknowledged): Number of CFs in one block
                0x01-0x10 (acknowledged with retry): Number of CFs in one block
        STmin - Minimum Separation Time
                0x00-0x7F: ST in number of milliseconds
                0xF1-0xF9: ST in number of microseconds starting with 100us and a step width of 100us