Addressing

ISO-15765 defines several addressing modes and this module supports them all. Depending on the addressing mode, the source/target addresses will be defined in a different way. An IsoTP address is represented by the isotp.Address object.


Definitions

class isotp.Address(addressing_mode=0, txid=None, rxid=None, target_address=None, source_address=None, physical_id=None, functional_id=None, address_extension=None, **kwargs)[source]

Represents the addressing information (N_AI) of the IsoTP layer. Will define what messages will be received and how to craft transmitted message to reach a specific party.

Parameters must be given according to the addressing mode. When not needed, a parameter may be left unset or set to None.

Both the TransportLayer and the isotp.socket expects this address object

Parameters:
  • addressing_mode (int) – The addressing mode. Valid values are defined by the AddressingMode class

  • txid (int or None) – The CAN ID for transmission. Used for these addressing mode: Normal_11bits, Normal_29bits, Extended_11bits, Extended_29bits, Mixed_11bits

  • rxid (int or None) – The CAN ID for reception. Used for these addressing mode: Normal_11bits, Normal_29bits, Extended_11bits, Extended_29bits, Mixed_11bits

  • target_address (int or None) – Target address (N_TA) used in NormalFixed_29bits and Mixed_29bits addressing mode.

  • source_address (int or None) – Source address (N_SA) used in NormalFixed_29bits and Mixed_29bits addressing mode.

  • physical_id – The CAN ID for physical (unicast) messages. Only bits 28-16 are used. Used for these addressing modes: NormalFixed_29bits, Mixed_29bits. Set to standard mandated value if None.

  • functional_id – The CAN ID for functional (multicast) messages. Only bits 28-16 are used. Used for these addressing modes: NormalFixed_29bits, Mixed_29bits. Set to standard mandated value if None.

  • address_extension (int or None) – Address extension (N_AE) used in Mixed_11bits, Mixed_29bits addressing mode

Type:

int or None

Type:

int or None

class isotp.AddressingMode[source]
Normal_11bits = 0
Normal_29bits = 1
NormalFixed_29bits = 2
Extended_11bits = 3
Extended_29bits = 4
Mixed_11bits = 5
Mixed_29bits = 6
class isotp.TargetAddressType[source]
Physical = 0
Functional = 1

Addressing modes

Normal addressing

In normal addressing, a CAN arbitration ID is selected for transmission (txid) and reception (rxid).

Condition to receive a message (discarded if not met):
  • Message arbitration ID must match receiver rxid

This mode is possible in both legislated 11-bits and extended 29-bits CAN identifiers

Example :
  • rxid : 0x123

  • txid : 0x456

// Reception of a 10 bytes payload
0x123    [8]   10 0A 00 01 02 03 04    // First frame
0x456    [4]   30 00 08 00             // Flow control
0x123    [6]   21 05 06 07 08 09       // Consecutive frame

Normal fixed addressing

In normal fixed addressing, a target_address and a source_address is encoded in the CAN arbitration ID.

Condition to receive a message (discarded if not met):
  • Message Target Address must match receiver source_address

  • Message Source Address must match the receiver target_address

This mode is only possible with extended 29-bits CAN identifiers.

A message arbitration ID sent in normal fixed addressing is encoded like the following (with <TA>=Target Address and <SA>=Source Address)

  • 1-to-1 communication (target_address_type = Physical) : 0x18DA<TA><SA>

  • 1-to-n communication (target_address_type = Functional) : 0x18DB<TA><SA>

Example :
  • source_address : 0x55

  • target_address : 0xAA

// Reception of a 10 bytes payload
0x18DA55AA    [8]   10 0A 00 01 02 03 04  // First frame
0x18DAAA55    [4]   30 00 08 00           // Flow control
0x18DA55AA    [6]   21 05 06 07 08 09     // Consecutive frame

Extended addressing

In extended addressing, rxid and txid must be set just like normal addressing, but an additional source_address and target_address must be given. The additional addresses will be added as the first byte of each CAN message sent.

Condition to receive a message (discarded if not met):
  • Message arbitration ID must match receiver rxid

  • Payload first byte must match receiver source_address

This mode is possible in both legislated 11-bits and extended 29-bits CAN identifiers

Example :
  • rxid : 0x123

  • txid : 0x456

  • source_address : 0x55

  • target_address : 0xAA

// Reception of a 10 bytes payload
0x123    [8]   55 10 0A 00 01 02 03    // First frame
0x456    [5]   AA 30 00 08 00          // Flow control
0x123    [8]   55 21 04 05 06 07 08 09 // consecutive frame

Mixed addressing - 11 bits

Mixed addressing (11 bits) is a mix of normal addressing and extended addressing. The payload prefix is called address_extension

When used in legislated 11-bits CAN, Mixed addressing behaves like extended addressing with both source_address and target_address being defined by address_extension

Condition to receive a message (discarded if not met):
  • Message arbitration ID must match receiver rxid

  • Payload first byte must match receiver address_extension

Example :
  • rxid : 0x123

  • txid : 0x456

  • address_extension : 0x99

// Reception of a 10 bytes payload
0x123    [8]   99 10 0A 00 01 02 03    // First frame
0x456    [5]   99 30 00 08 00          // Flow control
0x123    [8]   99 21 04 05 06 07 08 09 // consecutive frame

Mixed addressing - 29 bits

Mixed addressing (29 bits) is a mix of normal fixed addressing and extended addressing. The payload prefix is called address_extension

A message arbitration ID sent in 29 bits mixed addressing is encoded like the following (with <TA>=Target Address and <SA>=Source Address)

  • 1-to-1 communication (target_address_type = Physical) : 0x18CE<TA><SA>

  • 1-to-n communication (target_address_type = Functional) : 0x18CD<TA><SA>

Condition to receive a message (discarded if not met):
  • Message Target Address must match receiver source_address

  • Message Source Address must match the receiver target_address

  • Payload first byte must match receiver address_extension

Example :
  • source_address : 0x55

  • target_address : 0xAA

  • address_extension : 0x99

// Reception of a 10 bytes payload
0x18CE55AA    [8]   99 10 0A 00 01 02 03    // First frame
0x18CEAA55    [5]   99 30 00 08 00          // Flow control
0x18CE55AA    [8]   99 21 04 05 06 07 08 09 // consecutive frame