Frame Layers (80h+, 10h+ and 20h+)

OSI: Transport Layer

Keywords: framing, error detection, CRC, PHY, encapsulation, low communication overhead, sensors, internet of things, embedded systems, sensor networks

Scope

The scope of this project is to define the Isotropic Sensor Network Frame layer for broadcast and peer to peer connection in distributed sensor area network, wired or wireless, low and high data rate devices, battery powered devices, short-range devices with short operational space, low-cost devices to support trivial sensors, besides the fully featured devices.

Purpose

The purpose of this specifications is to provide a standard for low complexity, low cost, and low power (aware) consumption devices (sensors) to encapsulate higher level protocols.

Typical use:

  • Low-level transmissions, to define basic packet length with CRC

  • Payloads inside nested layers without CRC

Key features

  • Basic Frame Layer for Short Payloads

  • Error Detection using with CRC

  • For use in PHY Transmission as well as Encapsulation of Other Layers

  • Low-Cost and Compact Implementation

Definitions, Acronyms and Abbreviations

CRC

Cyclic Redundancy Check

device

An entity containing this protocol implementation. Also referred as sensor device or just sensor or device.

frame

The format of aggregated bits that are transmitted together in time.

packet

The format of aggregated bits that are transmitted together in time across the physical medium.

LSB

least significant byte/bit

MSB

most significant byte/bit

Packet Formats

Frame layer defines two packet formats:

  1. Short Frame Format, with a single preamble (protocol identification byte) and up to 64 B of user payload data for transmission in error-free channels,

  2. Compact Frame Format, which adds a 8-bit CRC for transmission in error-nous channels

Short Frame Format

Fields

Protocol ID

Length

Payload

Bits

2

6

length x 8

Value

0b11

0..63

data

Protocol ID:

defines the unique protocol identification number

Length:

the last 6 L-bits of first byte represent payload length. Value from 0..63 defines 1..64 payload bytes.

Payload:

embedded data

Compact Frame Format

Fields

Protocol ID

Length

Payload

CRC

Bits

2

6

length x 8

8

Value

0b10

0..63

data

8-bit CRC

Protocol ID:

the first two bits define the unique protocol identification number

Length:

the last 6 L-bits of first byte represent payload length. Value from 0..63 defines 1..64 payload bytes.

Payload:

embedded data

CRC:

8-bit CRC polynomial 0xa6 per Koopman representation, or 0x4D as normal representation, providing HD=2 over 2048 bits and HD=3 up to 247 bits

Code Example:

/**
 * Calculates 8-bit CRC using module-2 Division on a bit (slow) basis
 *
 * Usage:
 *   uint8_t crc = isn_frame_crc8( first_byte );
 *   crc = isn_frame_crc8( second_byte ^ crc );
 *   crc = isn_frame_crc8( third_byte ^ crc );
 *   ...
 *   crc = isn_frame_crc8( final_byte ^ crc ); // result is the final CRC
 *
 * \arg remainder to be chained and final value represents the crc.
 */
static uint8_t isn_frame_crc8(uint8_t remainder)
{
    uint8_t bit;
    for (bit = 8; bit > 0; --bit) {
        if (remainder & 0x80) {
            remainder = (remainder << 1) ^ 0x4D;
        } else {
            remainder = (remainder << 1);
        }
    }
    return remainder;
}

Long Frame Format

Fields

Protocol ID

Length

Length

Payload

CRC

Bits

4

4

8

length x 8

16

Value

0b0001

MSB length

LSB length

data

16-bit CRC

Protocol ID:

the first four bits define the unique protocol identification number

Length:

Value from 0..4095 define 1..4096 payload size.

Payload:

embedded data

CRC:

Due to hardware implementations the standard CCITT ISO/IEC 3309 polynomial 0x1021 is used, with HD3, HD4 up to 32751 bits, HD5 and further are None.

Otherwise the best 16-bit CRC polynomial would be 0xd175 per Koopman representation, or 0xA2EB as normal representation, providing HD=3, HD=4 up to 32751 bits, and HD=5..6 up to 93 bits.

More complex implementations may use both and auto detect the used one.

Jambo Frame Format

Fields

Protocol ID

Length

Length

Payload

CRC

Bits

3

5

8

length x 8

32

Value

0b001

MSB length

LSB length

data

32-bit CRC

Protocol ID:

the first four bits define the unique protocol identification number

Length:

Value from 0..8191 define 1..8192 payload size.

Payload:

embedded data

CRC:

Due to hardware implementations the standard ISO/IEC 3309 polynomial 0x04c11db7 is used, with HD3 up to 4294967263, HD4 up to 91607 bits, HD5 up to 2974, HD6 up to 268.

Otherwise the best 32-bit CRC polynomial 0xd419cc15 per Koopman representation, or 0xA833982B as normal representation, providing HD=3, HD=4, HD=5 up to 65505 bits, and HD=6 up to 1060 bits.

More complex implementations may use both and auto detect the used one.

Document Changes

Date

Release

Changes

January 29, 2012

0.1

Draft Specifications, Evaluation

February 14, 2016

1.0

Public version of Renewed Sensor Frame Layer

February 25, 2017

1.1

Removed 0x00 as termination, added CRC8 code example

September 15, 2018

1.2

Added Short Frame, Long Frame is to be revised

June 9, 2021

1.3

Added Long Frame, adaptive switch between Short/Long

August 29, 2022

1.4pre

Updated Long/Jambo Frame into 4/8 kB frames and 16/32 CRCs

References