ISO transport protocol over CAN

ISO transport protocol over CAN (ISO15765)

CAN_ISOTP_RX_FLAGS_MASK

rx flags mask

1
0x0000FFFF
CAN_ISOTP_LISTEN_MODE

listen only flag (do not send FC)

1
0x0001
CAN_ISOTP_EXTEND_ADDR

enable extended addressing

1
0x0002
CAN_ISOTP_TX_PADDING

enable CAN frame padding tx path

1
0x0004
CAN_ISOTP_HALF_DUPLEX

half duplex error state handling

1
0x0040
CAN_ISOTP_RX_EXT_ADDR

different rx extended addressing

1
0x0200
CAN_ISOTP_TX_FLAGS_MASK

tx flags mask

1
0xFFFF0000
CAN_ISOTP_TX_DONT_WAIT

do not send a tx confirmation msg

1
0x00010000
CAN_ISOTP_DEFAULT_FLAGS
1
0
CAN_ISOTP_DEFAULT_EXT_ADDRESS
1
0x00
CAN_ISOTP_DEFAULT_PAD_CONTENT
1
0xCC /* prevent bit-stuffing */
CAN_ISOTP_DEFAULT_FRAME_TXTIME
1
0
CAN_ISOTP_DEFAULT_RECV_BS
1
0
CAN_ISOTP_DEFAULT_RECV_STMIN
1
0x00
CAN_ISOTP_DEFAULT_RECV_WFTMAX
1
0
kernel_types.h::kernel_pid_t isotp_init(char * stack, int stacksize, char priority, const char * name)

Initialize the isotp layer.

Parameters

stack:stack for the isotp thread
stacksize:size of stack
priority:priority of the isotp thread
name:name of the isotp thread

Return values

  • the pid of the isotp thread
int isotp_send(struct isotp * isotp, const void * buf, int len, int flags)

Send data through an isotp channel.

Parameters

isotp:the channel to use
buf:the data to send
len:length of the data to send
flags:flags for sending

Return values

  • the number of bytes sent
  • < 0 if an error occured (-EBUSY, -ENOMEM)
int isotp_bind(struct isotp * isotp, sys/include/can/common.h::can_reg_entry_t * entry, void * arg)

Bind an isotp channel.

Initialize the channel, set the filter on the DLL and add the channel to the list of bound channels

Parameters

isotp:the channel to bind
entry:entry identifying the CAN ifnum and the upper layer either by its pid or its mailbox
arg:upper layer private parameter

Return values

  • 0 on success, < 0 on error
int isotp_release(struct isotp * isotp)

Release a bound isotp channel.

Unset the filter on the DLL and remove the channel from the list of bound channels

Parameters

isotp:the channel to relase

Return values

  • 0 on success, < 0 on error
void isotp_free_rx(sys/include/can/common.h::can_rx_data_t * rx)

Free a received buffer.

This MUST be called by the upper layer when the received data are read

Parameters

rx:the received data

struct isotp_fc_options

The isotp_fc_options struct.

It describes the flow control options

uint8_t bs

blocksize provided in FC frame, 0 = off

uint8_t stmin

separation time provided in FC frame 0x00 - 0x7F : 0 - 127 ms 0x80 - 0xF0 : reserved 0xF1 - 0xF9 : 100 us - 900 us 0xFA - 0xFF : reserved

uint8_t wftmax

max.

number of wait frame transmiss., 0 = ignored

struct isotp_options

The isotp_options struct.

It describes the ISO-TP options

can.h::canid_t tx_id

transmit CAN ID

can.h::canid_t rx_id

Receive CAN ID.

uint16_t flags

set flags for isotp behaviour.

uint8_t ext_address

set address for extended addressing

uint8_t txpad_content

set content of padding byte (tx)

uint8_t rx_ext_address

set address for extended addressing

struct tpcon

The tpcon struct.

It describes the current connection status

unsigned idx

current index in buf

uint8_t state

the protocol state

uint8_t bs

block size

uint8_t sn

current sequence number

int tx_handle

handle of the last sent frame

include/net/gnrc/pkt.h::gnrc_pktsnip_t * snip

allocated snip containing data buffer

struct isotp

The isotp struct.

This is the main struct used by an ISO-TP channel

struct isotp * next

next bound channel

struct isotp_options opt

channel options

struct isotp_fc_options rxfc

rx flow control options (defined locally)

struct isotp_fc_options txfc

tx flow control options (defined remotely)

struct tpcon tx

transmit state

struct tpcon rx

receive state

xtimer.h::xtimer_t tx_timer

timer for tx operations

xtimer.h::xtimer_t rx_timer

timer for rx operations

sys/include/can/common.h::can_reg_entry_t entry

entry containing ifnum and upper layer msg system

uint32_t tx_gap

transmit gap from fc (in us)

uint8_t tx_wft

transmit wait counter

void * arg

upper layer private arg