Giter VIP home page Giter VIP logo

j1708's Introduction

About

A set of python scripts to work with SAE J1708 protocol over serial port communication.

SAE J1708

SAE J1708 protocol is used in various heavy-duty equipment (e.g., lorries, loaders, diggers, etc.) and is a simple communication protocol supporting CRC shechsum. Detailed description of the protocol is provided here.

Protocol structure

Message

A J1708 message example:

MID Data 1 Data 2 Data 3 Data 4 Checksum
44 23 61 114 62 208

MID

The first byte in every message must always be a MID. Valid values of the MID is 0-255.

  • MIDs 0-68 belong to predefined devices to ensure consistency.
  • MIDs 69-86 are set aside for J1922 protocol.
  • MIDs 87-110 are reserved for future applications. Manufactures may apply to SAE Truck and Bus Electrical Committee to define a MID. MID 111 is designated for factory tests of electronic control units and shall not be used by any on-board unit.
  • MIDs 112-127 are not reserved and can be used as wanted. MIDs 128-255 are reserved for the SAE J1587 protocol, where they are defined.

CRC

The checksum is calculated as following:

As an example (using the sample message in the figure above),

  • 44+23+61+114+62+208 = 512
  • (512 AND 0xFF) = 0, so the message is correct.

Use of the scripts

Installing Dependencies

The scripts have a number of dependencies that can be installed using

To use the scripts the following packages are required:

  • pyserial
  • time
  • csv
  • sys
  • signal
  • os

To install the above-mentioned packages use the following commands:

python -m pip install --upgrade pip
python -m pip install serial, time, csv, sys, signal, os

Run

To read the serial bus COM-port number has to be updated in line 46 in j1708_com_receive.py. It is also advisible to check com.baudrate and com.timeout

Running of the script from CLI by:

python j1708_com_receive.py

will result in a log file to be created in logs/ folder.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.