PduApi 2.2.1
PduApi - Toolbox
Loading...
Searching...
No Matches
doip_isotp_gw

DoIP ISOTP Gateway Version @CMAKE_PROJECT_VERSION@ Copyright 2021 @PDUAPI_COPYRIGHT.

doip_isotp_gw [options]

'doip_isotp_gw' is an implementation of a doip-isotp gateway. On DoIP side it works like a server/ECU and on CAN/ISOTP it works like a tester.

To understand the options and documentation below completly please read the ISO 13400 and ISO 15765-2 first.

Options:

-4 IPv4 only. Default is IPv6 and IPv4. -6 IPv6 only. Default is IPv6 and IPv4. Broadcast address 'FF02::1'. -b <blocksize> For messages received from ECU, set the Blocksize in FlowControl Message. Default: 255 Please check this value with the qlen from 'ip link' to avoid dropped can-frames. ensure blocksize is smaller than the 'qlen' value. -c <licfile> License file. Optional parameter for non Demo Version. Default: 'doip_isotp_gw.lic' in executable directory. –direct-connection <ip:port> Works in diretion connection mode. Send Vehicle Response mesage without request. automatically set when use –ota. -e <EID> EID size 6 hex values. Default: MAC address. –disable_fillerbyte Disable filledbyte handling. Default: Enabled. –fillerbyte <hex> Set filled byte. Default: 0x55. –fd <dlc> Use CAN-FD with DLC. 0: classic CAN (default), 8-15 CAN-FD. DLC will be reduced in case messages are shorter. -g <GID> GID size 6 hex values. Default: MAC address. -l <LA> Logical address of DoIP Gateway. Mandatory parameter. -m <normal,extended,fixed,mixed>[:ae] Isotp Address mode.'ae' is set in case of 'Mixed'. –maxsockets <1-255> number of connected sockets. counter after RoutineActRequest. Default: 255 -n <can-name> CAN interface name. Default: 'can0' -p <port> Port. Default is 13400. Not avaible in '–ota' - mode. –portfile <filename> In case of port==0, write the dynamic allocated listen port into <filename>. Could be used to test independent test cases. –padding <Byte> padding value which can be written as hex like 0x55 which is recommended. -q Quiet mode. Do now show header. —ota <ip> Run in a client mode to connect to a DoIP-Switch with address <ip>. Not avaible in Demo Version. A 'Vehicle announcement message(0x0004)' is send over TCP/IP to the server. Behaviour is like describt in '9.2.1 Direct connection scenario'. -r Routing activation Request required. Automatically set by '-s <key>' parameter. Default: false -s <key> Enable security access. Not avaible in Demo Version. See below. –stmin <stmin> stMin for receiving messages from ECU. Default: 0. For possible values please see below. -t <vin sync-status> Report sync status ( values: 0 - Synchronised, 1 - not synchronized) –timeout <sec> Timeout in seconds (decimal) during a message is complete received via TCP. Current default: 10sec This timeout will be enabled, when a incomming message registered and disabled when the message is completly received. If timeout occurs, connection is closed by gateway. –timeout_send <msec> setsockopt( SO_SNDTIMEO). Zero means infinite -v <VIN|ip> VIN size 17 ASCII values. Mandatory parameter. For <ip> the ip address is set to VIN.

Documentation:

This DoIP - Isotp 15765-2 Gateway converts messages between Ethernet and CAN-BUS.
The messages are converted between DoIP[ISO 13400-2:2012] and ISOTP[ISO 15765-2 Version 2016] Messages.
Multiple DoIP-Tester can connect and send to multiple ECU.
Typical usage is the Convertion from UDSonIP to UDSonCAN.


+--------------+
| DoIP-Tester  |-------------+                                    +-------+
+--------------+              \                                   +--|  ECU  |
                               \                                  |  +-------+
                                *********************             |
+--------------+    UDSonIP     *********************   UDSonCAN  |  +-------+
| DoIP-Tester  | -------------> **  DoIP-ISOTP-GW  **-------------+--|  ECU  |
+--------------+    Ethernet    *********************   CAN-BUS   |  +-------+
                                *********************             |
                               /                                  |  +-------+
+--------------+              /                                   +--|  ECU  |
| DoIP-Tester  |-------------+                                    |  +-------+
+--------------+                                                  |
                                                                  +--   ...
     ...

Usecases:

a) Extend the distance from your PC/Tester to your CAN-BUS. b) Have access from multiple testers in the network to your CAN-BUS with a single CAN-Adapter c) In '–ota' - mode you can access your CAN-BUS from anywhere in the world. Cloud/Server process is required.

Supported messages between DoIP-Tester and 'doip_isotp_gw':

  • Vehicle identification request ([0x0001], [0x0002] EID, [0x0003] VIN). Vehicle identification response [0x0004] message content is set by doip_isotp_gw arguments.
  • Routing activation request [0x0005] is supported and returns the LA given by '-l <LA>' option.
  • Routing activation request OEM [0x0005] like Routing activation request with some extension. See 'ISOTP address mode' below.
  • DoIP entity status request/response [0x4001/0x4002]:
    • Node type: gateway [0x00]
    • Max Socket: 1-255. Be careful with rlimit RLIMIT_NOFILE is below default of 1024.
    • Currently open sockets: <0-255>
    • Max. data size: 4GB - 4Byte DoIP-Header. The real supported data size depends on os/kernel settings.
  • Diagnostic power mode information request (0x4003) returns always 'ready' [0x01] .
  • Diagnostic message (0x8001). Forwarded to ISOTP 15765-2. See below: Diagnostic Messages
  • Diagnostic message positive acknowledgement [0x8002].
  • Diagnostic message negative acknowledgement [0x8003]. UDS Negative Respnse Code send by [0x8002]
  • Vehicle announcement message [0x0004] only supported in '–ota' mode.

Not supported messages:

  • Alive check request [0x0007] not supported/not send to tester.

ISOTP address mode

Routing activation request OEM can be used to set individual address mode for each connection separatly.

+-------------------------------------—+ | 2 Byte | SA | +-------------------------------------—+ | 1 Byte | Activation type [0x00,0x01] | +-------------------------------------—+ | 4 Byte | Reserved 0x00000000 | +-------------------------------------—+ | 4 Byte | OEM: DoIP-ISOTP-GW specific* | +-------------------------------------—+

*OEM : 4 Byte DoIP-ISOTP-GW: +-------—+-----------------------------—+ | 1 Byte | CAN Response Format**/*** | +-------—+-----------------------------—+ | 1 Byte | CAN Request Format** | +-------—+-----------------------------—+ | 1 Byte | N_AE [bit 3 in Format**] | +-------—+-----------------------------—+ | 1 Byte | Padding [bit 4,5 in Format**] | +-------—+-----------------------------—+

**Request/Response - Format specification: +-----------—+----------------------------—+ | Bit position | Description | +-----------—+----------------------------—+ | 4,5 | 00 - use default padding | |(Request only)| 10 - use this Padding | | | 11 - not use Padding | +-----------—+----------------------------—+ | 3 | use N_AE extended addressing | +-----------—+----------------------------—+ | 2 | 0 - UUDT *** | | | 1 - USDT | +-----------—+----------------------------—+ | 1 | 0 - 11 bit | | | 1 - 29 bit | +-----------—+----------------------------—+ | 0 | 0 - no FC *** | | | 1 - use FC | +-----------—+----------------------------—+

*** not implemented in Demo Version

The format specifier are identically to the format specifier descript in D-PDU API/ISO 22900.

Diagnostics Messages:

DOIP Diagnostic messages [0x8001] are forwared to ISOTP 15765-2 messages only. DoIP SA, TA are mapped to the ISOTP Header SA, TA. DoIP SA and TA have 16 bit, but ISOTP 15765-2 has only 8 bit. So only 8 bit are allowed in this DoIP-Gateway. ISOTP N_AE is defined by '-m Mixed:N_AE' option. Every DoIP-Diagnostic message enhances the ISOTP Response table that return messages can find their way back. Closing a TCP/IP connection cleans the response table from it's own entry.

Features:

  • Diagnostics message send to ECU can be up to ~4GB, independent to avaible memory given by Linux Kernel.
  • Receive diagnostics message is planned in 'Non Demo Version' up to ~4GB independent of avaible memory.

    In NON-Demo-Version this DoIP-ISOTP-Gateway can also work as a multiplexer to multiple CAN adapters by using the address mode 'Mixed'. Then N_AE selects the CAN-Adapter.

DLC - Values -> CAN-FD Length:

8 : 8 Bytes 9 : 12 Bytes 10 : 16 Bytes 11 : 20 Bytes 12 : 24 Bytes 13 : 32 Bytes 14 : 48 Bytes 15 : 64 Bytes

IPv6 suport:

'doip_isotp_gw' supports IPv4 as well as IPv6 per default. In IPv6 doip_isotp_gw is listening on Broadcast address 'FF02::1'.

ISOTP Addressing:

Only 'Physical' adressing is supported. 'Functional' addressing in Modes 'Fixed' and 'Mixed' are NOT supported.

ISOTP stMin:

'stMin' possible values to received ContinousFrames:

0x00 - 0x7F wait time between frames 0-127 msec. 0xF1 - 0xF9 wait time between frames 100-900 usec.

'doip_isotp_gw' has a context switch correction. So the CAN - Frames are send quite accurate within stMin time to the ECU. No further calculation is required.

Linux:

On Linux 'ip link' is used to handle can interfaces.

Please set hardware paramter like frequence, txquelength, ... manually.

Be sure about 'qlen' should be greater than '-b <blocksize>' parameter to avoid dropping canframes. A value of 'qlen' >= 255 is recommended because of maximum block length.

Only 'mtu 72' can send CAN-FD frames. If you see 'mtu 16' on 'ip link', no CAN-FD is supported by your hardware.

Non Demo features:

Support of security login in that form that 'Routing activation Request' can return Routing activation response code 0x04 [Routing activation denied due to missing authentification].

Support Diagnostice over th air. Using the parameter –ota <ip>.

Warrenty:

This DEMO Version is free to use without any warranty.

Support:

In case of error or features request, please report to '@PDUAPI_SUPPORT_EMAIL@' .

This DoIP-ISOTP-Gateway can be adapted to your personal needs. Please contact @PDUAPI_COPYRIGHT.

Known Issues:

  • In case of using multiple tester with Address-Mode Extended and Normal at the same time, it is possible that a package from an ECU is ambigous. This happens, when the Tester for Normal Address Mode with TA=0x, TA=1x, TA=2x. In this case it is not possible to decide to which tester the incomming ECU message belongs to, because the first byte of the CAN-Frame could be the N_TA or the N_PCI of an ISOTP message.
  • Another case is when more tester accecss to a single ECU via Address mode NORMAL.
  • DoIP supports 16 bit SA and TA, but for address mode Extended, Fixed and Mixed, ISOTP 15765-2 supports only 8 bit. In these address modes only 8-bit SA, TA are allowed in DoIP protocol otherwise '0x02 - Invalid source address' or '0x06 - Target unreachable' is returned in 'Diagnostic message negative response'. For Address-Mode Normal the SA and TA can be 11-bit or 29-bit depending on can-id len.
  • It is recommended to use Address-Mode Fixed (default) or Mixed. It uses the 29-bit ID instead of the first byte in CAN message.

Example:

A minimal example is showned below:

‍>doip_isotp_gw -l 0x22 -v 12345678901234567

Example sequence from DoIP-Tester & CAN:

UDP-Broadcast-Send : Vehicle identification request UDP-Recv : Vehicle identification response TCP : Connect to doip_isotp_gw TCP-Send : Routing activation request TCP-Recv : Routine activation response - 0x10 success TCP-Send : UDS Message CAN : Recv UDS using ISOTP 15765-2 TCP-Recv : Diag Message Ack CAN : Send UDS-Response using ISOTP 15765-2 TCP-Recv : UDS Message (UDS Response) TCP-Send : Diag Message Ack TCP : shutdown/close