RIOT and CAN. Vincent Dupont. RIOT Summit September 25-26, OTA keys. Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit / 34

Similar documents
J1939-based application profiles

Linux and ISO with CAN FD

MotoHawk support for ISO 15765

Chances and challenges

Linux and ISO with CAN FD. 15 th international CAN Conference 2015 Dr. Oliver Hartkopp (Volkswagen AG)

Research and Development of Vehicle Fault Diagnostic Protocol ISO15765

J1939 OVERVIEW. 1

OBDII J1708/J1587 Simulator

LDV Communications Specification

CAN bus and NMEA2000 1

PLC2 Board Communication Manual CANopen Slave

Workshop on In Vehicle Network using CAN By

OBD Simulator. Software to simulate and re-play a vehicle.

Controller area network

SAE J1939. Serial Control and Communications Vehicle Network

GW-7238D J1939 to Modbus TCP Server / RTU Slave Gateway

CAN FD for commercial vehicles: Chances and challenges

CANgate User's Manual

CANgate User's Manual

CANgate User's Manual

Today. Last Time. Motivation. CAN Bus. More about CAN. What is CAN?

Vehicle Network Gateway (VNG)

Standardized Tool Components for NRMM-Diagnostics

PCAN-OBD-2 API. Documentation. API Implementation of the OBD-2 Standard (ISO ) Document version ( )

Holger Zeltwanger CAN CAN. protocol and its impacts on CANopen. CiA

NC1701 ENHANCED VEHICLE COMMUNICATIONS CONTROLLER

The Controller Area Network (CAN) Interface

GW-7228 J1939/Modbus RTU Slave Gateway

Automotive and industrial use cases for CAN FD

CANoe and CANalyzer as Diagnostic Tools

ON-BOARD DIAGNOSTICS SCANNER

Installation and operation manual PCIe-CAN-01 / PCIe-CAN-02

mobydic 4910 Multiprotocol ECU Simulator v1.01 Features

SAE J1939. Serial Control and Communications Vehicle Network. Presented by Wilfried Voss

In the table below you will find the icon conventions used throughout the Support Note. This icon indicates notes and tips that facilitate your work.

CANopen CFW-11. Communication Manual. Phone: Fax: Web:

ABSOPOS Series CANopen DS406 V3.1 Operating Manual Configuration and CAN-Bus Coupling

PCAN-PassThru API. User Manual. Pass-Thru API and Connection of Pass-Thru Software to PEAK CAN Interfaces. Document version 1.1.

Motors I Automation I Energy I Transmission & Distribution I Coatings. CANopen CFW500. User s Manual

Communication Networks for the Next-Generation Vehicles

The House Intelligent Switch Control Network based On CAN bus

CAN FD filter for Classical CAN controllers

SURFACE VEHICLE RECOMMENDED PRACTICE

Using the MPC5777M MCAN Module to Exchange CAN FD Messages

Advcan QNX Driver User Manual V1.02

K-line Communication Description

Application Layer. Chapter 2.6. Layered model automation system. Application Process. Application. Data Link Physical.

Controller Area Network

Diagnostics via CANoe Gateways

UNH-IOL MIPI Alliance Test Program

PISO-CAN200/400. Linux SocketCAN CANopen Manual

USBCAN-OBD. USB to CAN adapter. User Manual. Document version 3.01 (2015/04/22)

CS 856 Latency in Communication Systems

CAN FD with Dynamic Multi-PDU-to-Frame Mapping

CANopen. Network configuration. Operating instructions Software. Integration of Bürkert devices in CANopen networks

CANopen CFW100. User s Manual. Phone: Fax: Web: -

EP A1 (19) (11) EP A1 (12) EUROPEAN PATENT APPLICATION. (43) Date of publication: Bulletin 2012/45

High-Speed Reprogramming and Calibration with CAN FD: A Case Study

Conto D2 COMMUNICATION PROTOCOL CONTENTS 1.0 INTRODUCTION

SRS501 User s manual

CDN067 DEVICENET SPECIFICATIONS

Welcome to the Webinar Embedded Software for J1939

CAN-FD Flexible Data Rate CAN

Electrohydraulic Actuators PVE-CI, Series 6

Unified Diagnostic Services Protocol Implementation in an Engine Control Unit

Abrites Diagnostics for Peugeot/Citroën User Manual

Understanding and Using the Controller Area Network Communication Protocol

Indigo. Vector Diagnostic Tester V / 6

Diagnostic Trends 2017 An Overview

FlexRay and Automotive Networking Future

Implementation and validation of SAE J1850 (VPW) protocol solution for diagnosis application

CANalyzer.J1939. Product Information

J1939. Stack and SDK for esd CAN Hardware. Software Manual. to Product C , C , C , C

CANopen Library User Manual

CAN in Space workshop

Microprocessor Communication Module Connecting On Board Diagnostic System and Personal Computer

Quo Vadis SAE J1939 Standardization

PCAN-ISO-TP API. Documentation. API Implementation of the ISO-TP Standard (ISO ) Document version ( )

Product Information ES582.1 Compact USB Device

INNOVATIVE TECHNOLOGY LTD CC2. Communications Protocol Manual GA863. Issue version Page 1 of 108

Automatic validation of diagnostics in ECUs

Embedded Software for J1939

Two Wire Interface (TWI) also commonly called I2C

LIN. Specification Package. Revision 2.1

Motors Automation Energy Transmission & Distribution Coatings. Software WSCAN. User's Manual

CE4DMID01 COMMUNICATION PROTOCOL CONTENTS 1.0 INTRODUCTION

ISO INTERNATIONAL STANDARD. vehicles Diagnostics on. systems. routiers Diagnostic sur gestionnaire de réseau de communication

The I-7530A RS-232/485/422 to CAN Converter

iobd2 MFi BT VAG Adapter User Manual

Introduction to Controller Area Network (CAN)

Simplify CAN and LIN In-vehicle Network Testing

Appendix A DawnEdit Parameter and Message Database Editor

AN-946 APPLICATION NOTE

Layer 7. Application Layer. Chapter 2.6. Layered model automation system. Application Process. Application. Management. Data Link Physical

VSI-2534 User Manual

COMMUNICATION MODBUS PROTOCOL MF96001 / 021 NEMO 96HD

USB to CAN Equipment Specification (V1.01) Contents Aug. 28, Sept. 14, 2012

Quo vadis SAE J1939 standardization

This document is a preview generated by EVS

DA-ST512. User s Manual

Transcription:

RIOT and CAN Vincent Dupont OTA keys RIOT Summit September 25-26, 2017 Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 1 / 34

Who am I? What is OTA keys? Me: Embedded software engineer: 6 years, 3 at OTA keys RIOT: 1.5 year Hardware support Device drivers Storage CAN support Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 2 / 34

Who am I? What is OTA keys? Me: Embedded software engineer: 6 years, 3 at OTA keys RIOT: 1.5 year Hardware support Device drivers Storage CAN support OTA keys: Continental subsidiary: car-sharing systems Embedded system, backend, mobile Created 3 years ago, joint-venture between Continental and D Ieteren (Belgian VW group importer) Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 2 / 34

Goal of this presentation 1 CAN bus technology 2 RIOT CAN stack 3 CAN stack usage example Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 3 / 34

Content 1 What is CAN? Physical Layer Link layer ISO-TP 2 CAN in RIOT 3 Use case example: OBD 4 Future Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 4 / 34

What is CAN? Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 5 / 34

Physical Layer: ISO 11898-2 Definition CAN is a multi-master serial bus standard for connecting Electronic Control Units [ECUs] also known as nodes. Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 6 / 34

Physical Layer: ISO 11898-2 Definition CAN is a multi-master serial bus standard for connecting Electronic Control Units [ECUs] also known as nodes. Node 1 Node 2 Node n CAN High CAN Low Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 6 / 34

Physical Layer: ISO 11898-2 Definition CAN is a multi-master serial bus standard for connecting Electronic Control Units [ECUs] also known as nodes. Node 1 Node 2 Node n CAN High CAN Low Recessive bus Dominant bit (0) bus is electrically driven, recessive (1) is not (node is open-drain) Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 6 / 34

CAN Layers Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 7 / 34

Link Layer: ISO 11898-1 8 bytes per frame Error management Frames are addressed, not nodes: CAN IDentifiers IDs are priority (the lower, the more priority) Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 8 / 34

Link Layer: ISO 11898-1 8 bytes per frame Error management Frames are addressed, not nodes: CAN IDentifiers IDs are priority (the lower, the more priority) arbitration phase: Node A 079 0 (SOF) 0 0 0 0 1 1 1 1 0 0 1 Node B 080 0 0 0 0 1 Stops transmitting Node C 700 0 1 Stops transmitting Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 8 / 34

Link Layer: ISO 11898-1 8 bytes per frame Error management Frames are addressed, not nodes: CAN IDentifiers IDs are priority (the lower, the more priority) arbitration phase: Node A 079 0 (SOF) 0 0 0 0 1 1 1 1 0 0 1 Node B 080 0 0 0 0 1 Stops transmitting Node C 700 0 1 Stops transmitting Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 8 / 34

Link Layer: ISO 11898-1 8 bytes per frame Error management Frames are addressed, not nodes: CAN IDentifiers IDs are priority (the lower, the more priority) arbitration phase: Node A 079 0 (SOF) 0 0 0 0 1 1 1 1 0 0 1 Node B 080 0 0 0 0 1 Stops transmitting Node C 700 0 1 Stops transmitting Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 8 / 34

Link Layer: ISO 11898-1 8 bytes per frame Error management Frames are addressed, not nodes: CAN IDentifiers IDs are priority (the lower, the more priority) arbitration phase: Node A 079 0 (SOF) 0 0 0 0 1 1 1 1 0 0 1 Node B 080 0 0 0 0 1 Stops transmitting Node C 700 0 1 Stops transmitting Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 8 / 34

Link Layer: ISO 11898-1 8 bytes per frame Error management Frames are addressed, not nodes: CAN IDentifiers IDs are priority (the lower, the more priority) arbitration phase: Node A 079 0 (SOF) 0 0 0 0 1 1 1 1 0 0 1 Node B 080 0 0 0 0 1 Stops transmitting Node C 700 0 1 Stops transmitting Filters: receive if (can id&mask) ==filter Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 8 / 34

ISO-TP: ISO 15765-2 Segmentation Up to 4095 bytes Use a pair of CAN IDs Channel between 2 nodes Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 9 / 34

ISO-TP: ISO 15765-2 Segmentation Up to 4095 bytes Use a pair of CAN IDs Channel between 2 nodes Header (4 bits): Value Definition 0 Single frame (SF) 1 First frame (FF) 2 Consecutive frame (CF) 3 Flow control (FC) Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 9 / 34

ISO-TP: ISO 15765-2, Example Node A Node B First frame (length, data) Flow control (block size, stmin) Consecutive frame (index, data) Consecutive frame (...) Consecutive frame (...) Flow control (block size, stmin) Consecutive frame (...) Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 10 / 34

Content 1 What is CAN? 2 CAN in RIOT Overall architecture candev Link layer conn can 3 Use case example: OBD 4 Future Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 11 / 34

Architecture conn can conn can isotp isotp CAN link layer raw / router / pkt / dll candev drivers Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 12 / 34

Architecture conn can conn can isotp isotp CAN link layer raw / router / pkt / dll candev drivers implement candev Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 12 / 34

Architecture conn can conn can isotp conn can user interfaces isotp CAN link layer raw / router / pkt / dll candev drivers implement candev Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 12 / 34

Architecture conn can conn can isotp conn can user interfaces isotp CAN link layer CAN stack: isotp, link layer raw / router / pkt / dll candev drivers implement candev Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 12 / 34

Architecture conn can conn can isotp conn can user interfaces isotp CAN link layer raw / router / pkt / dll CAN stack: isotp, link layer 1 thread per layer candev drivers implement candev Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 12 / 34

Candev structure typedef struct candev candev_t; typedef void (*candev_event_cb_t)(candev_t *dev, candev_event_t event, void * arg); struct candev { const struct candev_driver * driver; candev_event_cb_t event_callback; void * isr_arg; /* CAN specific */ struct can_bittiming bittiming; enum can_state state; }; Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 13 / 34

Candev driver interface typedef struct candev_driver { int (*init)(candev_t * dev); void (*isr)(candev_t * dev); /*... */ } candev_driver_t; Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 14 / 34

Candev driver interface typedef struct candev_driver { int (*init)(candev_t * dev); void (*isr)(candev_t * dev); int (*send)(candev_t *dev, const struct can_frame * frame); int (*abort)(candev_t *dev, const struct can_frame * frame); /*... */ } candev_driver_t; Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 14 / 34

Candev driver interface typedef struct candev_driver { int (*init)(candev_t * dev); void (*isr)(candev_t * dev); int (*send)(candev_t *dev, const struct can_frame * frame); int (*abort)(candev_t *dev, const struct can_frame * frame); int (*get)(candev_t *dev, canopt_t opt, void * value, size_t max_len); int (*set)(candev_t *dev, canopt_t opt, void * value, size_t value_len); /*... */ } candev_driver_t; Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 14 / 34

Candev driver interface typedef struct candev_driver { int (*init)(candev_t * dev); void (*isr)(candev_t * dev); int (*send)(candev_t *dev, const struct can_frame * frame); int (*abort)(candev_t *dev, const struct can_frame * frame); int (*get)(candev_t *dev, canopt_t opt, void * value, size_t max_len); int (*set)(candev_t *dev, canopt_t opt, void * value, size_t value_len); int (*set_filter)(candev_t *dev, const struct can_filter * filter); int (*remove_filter)(candev_t *dev, const struct can_filter * filter); } candev_driver_t; Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 14 / 34

Link Layer raw can (dll.c) router (router.c) can dll (dll.c) pkt (pkt.c): wraps gnrc pkt candev (device.c) Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 15 / 34

Link Layer: sending User raw can can dll candev raw can send msg send ok can dll dispatch tx conf msg send Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 16 / 34

Link Layer: receiving, step 1: register filter User x raw can router can dll candev raw can subscribe rx can router register already registered? Register filter only if needed set filter ok / ko ok / ko Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 17 / 34

Link Layer: receiving, step 2: receive User x raw can router can dll candev can dll dispatch rx ind can router dispatch rx ind Dispatch to user threads msg send 1 msg per thread inc usage counter ok / ko Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 18 / 34

Link Layer: receiving, step 3: free User x raw can router can dll candev Free each user thread raw can free frame can router free frame decrement usage counter if counter == 0 free frame Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 19 / 34

conn can Provide synchronous calls to interact with CAN stack connection-oriented interface More suitable for user code and complex applications Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 20 / 34

conn can Provide synchronous calls to interact with CAN stack connection-oriented interface More suitable for user code and complex applications Available functions: conn can raw create: needed only to receive, set filters conn can raw send conn can raw recv conn can raw close: unsetfilters Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 20 / 34

conn can isotp Available functions: Bonus: conn can isotp create conn can isotp bind: setfilter conn can isotp send conn can isotp recv conn can isotp close: unsetfilter conn can isotp select: ifmoduleconn CAN ISOTP MULTI used, a thread can bind multiple isotp connections Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 21 / 34

Content 1 What is CAN? 2 CAN in RIOT 3 Use case example: OBD 4 Future Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 22 / 34

OBD Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 23 / 34

OBD Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 23 / 34

OBD o -board on-board ECU 1 Tester OBD port ECU 2 ECU 3..8 Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 24 / 34

OBD On top of CAN and ISO-TP Up to 8 ECUs Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 25 / 34

OBD On top of CAN and ISO-TP Up to 8 ECUs ECU Tester Address ECU Address Broadcast 0x7DF #0 0x7E0 0x7E8 #n 0x7En 0x7En + 8 Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 25 / 34

OBD: request example ID Request 0x7DF 0x02 0x01 0x0D 0x55 0x55 0x55 0x55 0x55 isotp mode pid Broadcast SF 1 Vehicle padding 2bytes read Speed Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 26 / 34

OBD: request example ID Request 0x7DF 0x02 0x01 0x0D 0x55 0x55 0x55 0x55 0x55 isotp mode pid Broadcast SF 1 Vehicle padding 2bytes read Speed ID Response 0x7E8 0x03 0x41 0x0D 0x7F 0x55 0x55 0x55 0x55 isotp mode pid value ECU #1 SF 1 Vehicle 127 padding 3bytes resp Speed km/h Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 26 / 34

OBD 9 modes PIDs (Parameter Identifiers) Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 27 / 34

OBD 9 modes Example PIDs (Parameter Identifiers) Mode PID Description 1 0x0 PIDs supported (range 0x01 0x20) 1 0xC Engine RPM 1 0xD Vehicle speed 9 0x2 VIN (Vehicle Identification Number) 3 No PID Diagnostic Trouble Codes (DTCs) Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 27 / 34

OBD: a bit of code /* Step 1: Prepare to receive ECUs responses */ conn_can_raw_t raw_conn; int ifnum = 0; struct can_filter filter = {. can_id = 0x7E8,. can_mask = 0xfffffff8, }; conn_can_raw_create(&raw_conn, &filter, 1, ifnum, 0); Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 28 / 34

OBD: a bit of code /* Step 1: Prepare to receive ECUs responses */ conn_can_raw_t raw_conn; int ifnum = 0; struct can_filter filter = {. can_id = 0x7E8,. can_mask = 0xfffffff8, }; conn_can_raw_create(&raw_conn, &filter, 1, ifnum, 0); /* Step 2: Send request */ struct can_frame frame; memset( frame.data, 0x55, 8); // init with padding frame. data[0] = 0x02; // isotp header: SF, l=2 frame. data[1] = 0x1; // mode frame. data[2] = 0x0; // pid ( supported PIDs range 0-0 x20) frame. can_dlc = 8; // Frame length frame. can_id = 0x7DF; // Broadcast ID conn_can_raw_send(&raw_conn, &frame, 0); Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 28 / 34

OBD: a bit of code /* Step 3: Wait for ECUs, save ECU address supporting PID */ canid_t ecus[8]; int nb_ecus = 0; while ( conn_can_raw_recv(&raw_conn, &frame, TIMEOUT) > 0) { if ( check_frame(&frame)) { ecus[ nb_ecus++] = frame. can_id; } } Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 29 / 34

OBD: a bit of code /* Step 4: Send actual request */ /* For each ECU supporting PID */ canid_t ecu_addr = ecus[i]; canid_t tester_addr = ecu_addr - 8; /* Init ISO-TP with addresses and padding */ struct isotp_options options = {. tx_id = tester_addr,.rx_id = ecu_addr,. txpad_content = 0x55,.flags = CAN_ISOTP_TX_PADDING, }; /* Create and bind connection */ conn_can_isotp_create(&isotp_conn, &options, ifnum); conn_can_isotp_bind(&isotp_conn); Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 30 / 34

OBD: a bit of code /* Step 4: Send actual request */ /* For each ECU supporting PID */ canid_t ecu_addr = ecus[i]; canid_t tester_addr = ecu_addr - 8; /* Init ISO-TP with addresses and padding */ struct isotp_options options = {. tx_id = tester_addr,.rx_id = ecu_addr,. txpad_content = 0x55,.flags = CAN_ISOTP_TX_PADDING, }; /* Create and bind connection */ conn_can_isotp_create(&isotp_conn, &options, ifnum); conn_can_isotp_bind(&isotp_conn); /* Send request frame (as in previous slide) */ conn_can_raw_send(&raw_conn, &frame, 0); Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 30 / 34

OBD: a bit of code /* Step 4: Send actual request */ /* For each ECU supporting PID */ canid_t ecu_addr = ecus[i]; canid_t tester_addr = ecu_addr - 8; /* Init ISO-TP with addresses and padding */ struct isotp_options options = {. tx_id = tester_addr,.rx_id = ecu_addr,. txpad_content = 0x55,.flags = CAN_ISOTP_TX_PADDING, }; /* Create and bind connection */ conn_can_isotp_create(&isotp_conn, &options, ifnum); conn_can_isotp_bind(&isotp_conn); /* Send request frame (as in previous slide) */ conn_can_raw_send(&raw_conn, &frame, 0); /* Wait for response */ uint8_t buf[32]; conn_can_isotp_recv(&isotp_conn, buf, sizeof( buf), TIMEOUT); conn_can_isotp_close(&isotp_conn); /* Buf contains ECU response */ /* If multi frame, isotp layer reconstructed it */ Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 30 / 34

Content 1 What is CAN? 2 CAN in RIOT 3 Use case example: OBD 4 Future Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 31 / 34

What for the future? CAN stack: Add actual drivers for hardware Merge candev and netdev Re-use parts of gnrc for CAN stack New higher-layer protocols (OBD, Broadcast Manager, J1939, CANopen, DeviceNet...) Adapt stack to CAN-FD Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 32 / 34

What for the future? CAN stack: Add actual drivers for hardware Merge candev and netdev Re-use parts of gnrc for CAN stack New higher-layer protocols (OBD, Broadcast Manager, J1939, CANopen, DeviceNet...) Adapt stack to CAN-FD RIOT and vehicle: DoIP (Diagnostic over IP): the future of vehicle diagnostics Connected car Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 32 / 34

Conclusion : fun and easy to hack and use, thanks to its community now the only free OS for small embedded systems with a CAN stack with full ISO-TP support Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 33 / 34

Thank you! Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 34 / 34

Other physical layers High-Speed CAN: ISO 11898-2, most commonly used Low-Speed (aka Fault-Tolerant) CAN: ISO 11898-3. Up to 125kbit/s Low-Speed high-voltage: ISO 11992-1. For truck-trailer point-to-point communication Single-Wire CAN: SAE J2411 Source: https://www.can-cia.org/can-knowledge/can/ systemdesign-can-physicallayer/ Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 1 / 5

Link layer: errors 5 sources of error: Bit monitoring Bit stu ng Frame check Acknowledgement check CRC check Error frame 6 consecutives dominant or recessive bits 2 error counters (Tx and Rx): c apple 127: error active 127 < c apple 255: error passive c > 255: bus o Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 2 / 5

Bit timing Bit timing Bit divided in time quanta (TQ) (1TQ = Clock/BRP), 4 segments: Synchronization (SYNC) Propagation (PROP) Phase segment 1 (PS1) Phase segment 2 (PS2) Sample point between PS1 and PS2 Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 3 / 5

ISO-TP: ISO 15765-2, Header Header example: Value (hex) Definition 05 SF, length 5 bytes 10 08 FF, length 8 bytes 1F FF FF, length 4095 bytes 21 CF, index 1 25 CF, index 5 30 FC CTS (clear to send) 31 FC Wait 32 FC Overflow Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 4 / 5

Diagnostic Transport layer: ISO-TP UDS (Unified Diagnostic Services): ISO 14229-1 Services Tester sends a request, ECU responds Applications: diagnostic (read/write data, error codes), firmware update (read/write memory), etc. OBD (On-Board Diagnostic): ISO 15031 Vincent Dupont (OTA keys) RIOT and CAN RIOT Summit 2017 5 / 5