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:
First draft. Various things left out, including how EmCan uses the stream protocol.
Added reserved range of node-specific extended frames for device test modes.
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.
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.
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.
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.
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.
Changed bits in the CONFIG frame FLAGS bytes.
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.
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.
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.
Restructured the document into separate files for the major sections and added various cross-links. Added the external stream protocol section.
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.
Added ADRELEASE standard broadcast frame. Added PORTFUNC extended node-addresses frame.
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.
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.
Added SYNC standard data frame.