EmCan Protocol Specification

Version 3.5, 10 November 2014

Index

Introduction

EmCan is a protocol layered on CAN (Controller Area Network).  CAN is attractive for connecting multiple devices of a single system distributed over a small distance, like a few meters up to a few 100 meters if necessary.  This document is written assuming the reader is familiar with the basics of CAN. 

CAN is a well thought out serial bus scheme, with hardware available built into many microcontrollers that handles sending and receiving whole packets, called frames in CAN.  While CAN is well designed and suitable for interconnecting distributed embedded devices of systems like a single industrial machine or a house, it requires a set of higher level conventions and protocols to use effectively in many such instances.  The EmCan protocol is exactly that. 

Some of the goals of the EmCan protocol are:

Version History

A new major version indicates major or incompatible changes from the previous version.  A new minor version indicates clarifications, text fixes, and minor compatible changes.  All versions 0 are drafts that should not be relied on by application developers.  There can be significant differences between minor versions of major version 0. 

0.1, 16 Sep 2012

First draft.  Various things left out, including how EmCan uses the stream protocol. 

0.2, 23 Sep 2012

Added reserved range of node-specific extended frames for device test modes. 

0.3, 29 Oct 2012

Added links to pages for vendor blocks and application IDs.  Fixed inconsistancy where role IDs were sometimes 31 bits and sometimes 32.  Role IDs are 32 bit values. 

0.4, 4 Dec 2012

APPROLE is now sent by a node in response to a deliberate remote request as before, but also when ACK is requested in APPRROLE or SETROLE commands from the host. 

0.5, 17 Dec 2012

Made bits 18, 17, and 7 in the extended frame ID fully reserved.  Previously these were described as reserved for application use.  Added deliberate NACK response to a ACK-requested frame.  Extended frame ID bit 14 now has a specific meaning in ACK frames.  Was previously required to be 0.  Removed the optional data bytes from the SETROLE command sent from the host.  SETROLE from the host to a node now always has 4 data bytes, and from a node to the host 8 data bytes. 

0.6, 4 Jan 2013

Moved ADRASSIGN bus control opcode from 14 to 8.  Added ADRREQRES bus control opcode.  Added mention of deliberate NACK usage for STROUT and STRIN commands.  Added Ports section.  Started the Stream Protocol section. 

0.7, 10 Jan 2013

Changed the EmCan-reserved range of stream command and response opcodes.  This was previously 0-31, is now 0-63.  Added the Non-volatile Settings section.  Changed the reserved EmCan node-addressed extended opcodes to the last 32 instead of the last 16, and the device test opcodes to the previous 32 before that instead of the previous 16.  The device test opcode range is now 960-991, and the EmCan reserved range 992-1023.  Added extended data frames PORTWR, PORTRD, CONFIG, NPORTS, PORTYPE, PORTSCALE, PORTOFS, PORTINIT, PORTCFG, and PORTROLE.  Moved SETROLE extended data frame opcode from 1010 to 1018.  Added the SETDUSE and SETPUSE stream commands. 

0.8, 23 Jan 2013

Changed bits in the CONFIG frame FLAGS bytes. 

0.9, 25 Feb 2013

Clarified when various port-related frames would result in ACK, NACK, or no reply at all.  This is now more uniform, and the general rules were added to the Ports section of this document. 

1.0, 6 Mar 2013

Added definition of the floating point format used with the PORTSCALE and PORTOFS frames.  Full implementations of what is described in this version have been created and tested on two different processors. 

2.0, 17 April 2013

The values of the dim parameter to the PORTYPE frame were re-assigned.  The unscaled numeric type was added as dim 1 and other existing IDs now have different dim numbers.  Dim 10 was added, which is frequency in units of 1/second. 

3.0, 13 June 2013

Restructured the document into separate files for the major sections and added various cross-links.  Added the external stream protocol section. 

3.1, 12 May 2014

Bit 7 of the flags byte in a CONFIG frame is now the REQCFG bit.  This bit was previously reserved.  In CONFIG frame description, added example sequences to enter and exit configuration mode. 

3.2, 5 Sep 2014

Added ADRELEASE standard broadcast frame.  Added PORTFUNC extended node-addresses frame. 

3.3, 7 Sep 2014

Clarified that the functionid parameter to the PORTFUNC frame can be 0 bytes long to indicate that port has no specific function ID assigned to it. 

3.4, 6 Nov 2014

Renamed EmCan server stream response STRINRES to STRINSYN.  Added SYNC command to the virtual byte stream to a node.  Special meaning has been assigned to a STRIN frame with 0 data bytes. 

3.5, 10 Nov 2014

Added SYNC standard data frame.