1.2 IEC 62056 Standard Suite & Colored Books Map
Reference map correlating the DLMS UA Colored Books with official IEC, ANSI, and EN international standards.
1. The DLMS UA "Colored Books" System
The DLMS User Association publishes the core specifications, commonly categorized by book color:
| Book Color | Document Scope | Core Content | Primary IEC Equivalent |
|---|---|---|---|
| 📘 Blue Book | COSEM Interface Classes & OBIS System | 70+ Interface Classes, attributes, methods, OBIS 6-group naming rules, and A-XDR data types. | IEC 62056-61 / IEC 62056-62 |
| 📗 Green Book | Architecture & Communication Protocols | ACSE association state machine, Security Suites 0/1/2, HDLC/TCP profiles, and GBT streaming. | IEC 62056-46 / IEC 62056-47 / IEC 62056-53 |
| 📙 Yellow Book | Conformance Testing & CTT Tool | Test cases, conformance test tool (CTT) test suites, and interoperability certification criteria. | N/A (DLMS UA CTT) |
| ⚪ White Book | Architecture Extensions | Specific utility profile guidelines (IDIS, PRIME, G3-PLC, SMETS2). | Industry Profiles |
2. IEC 62056 Standards Breakdown
- **IEC 62056-21**: Direct local data exchange (Optical probe Mode A/B/C/D/E) - **IEC 62056-46**: Data link layer using HDLC protocol - **IEC 62056-47**: COSEM transport layer for IPv4 / IPv6 networks - **IEC 62056-53**: COSEM application layer - **IEC 62056-61**: Object Identification System (OBIS) - **IEC 62056-62**: COSEM Interface Classes1.3 Client/Server Logical Architecture & SAP Addressing
How physical meters partition into Logical Devices, Server SAPs, and role-based Client SAP access points.
1. Logical Devices & Server SAP
A single physical meter can host multiple Logical Devices (LD), each identified by a unique Server SAP (Service Access Point):
| Logical Device Type | Standard Server SAP | Role & Typical Function |
|---|---|---|
| Management Logical Device (LD 1) | 0x0001 (1) | Mandatory primary management entity hosting Association LN, Security Setup, and Clock. |
| Electricity Metering Device | 0x0001 or 0x0002 | Measurement registers, profile generics, and billing capture logs. |
| Gas / Water / Heat Sub-Meter | 0x0003 .. 0x000F | Multi-utility M-Bus client channels connected through the main meter. |
2. Client SAP Hierarchy & Permissions
Clients connect to the meter using assigned Client SAP addresses representing security roles:
Client SAP 0x0010 (16): Public Client ───► No Encryption, Basic Read (LDN, IC)
Client SAP 0x0001 (1) : Management Client ───► HLS 5 GMAC, Full Configuration & Relay Trip
Client SAP 0x0002 (2) : Firmware Upgrade ───► Image Transfer (Class 18)
Client SAP 0x0003 (3) : Utility Reader ───► Tariff Read & Billing Data Export
3. Addressing Rules in HDLC vs TCP Wrapper
- **TCP Wrapper (`IEC 62056-47`)**: Client SAP and Server SAP are 16-bit integers in the 8-byte wrapper header. - **HDLC (`IEC 62056-46`)**: Client SAP is 1 byte; Server SAP is encoded as 1, 2, or 4-byte HDLC MAC address with bit-shifting (`Address << 1 | 1`).2.1 IEC 62056-46 HDLC Link Layer & Frame Format Type 3
In-depth dissection of HDLC Frame Format Type 3 structure, MAC addressing, dual CRC-16 checksums, and link state management.
1. HDLC Frame Format Type 3 Structure
A standard DLMS HDLC frame is delimited by opening and closing 0x7E flag bytes:
┌──────┬──────────────────────┬──────────┬──────────┬─────────┬────────┬───────────────────┬────────┬──────┐
│ Flag │ Format & Length (2B) │ Dest MAC │ Src MAC │ Control │ HCS │ Information Field │ FCS │ Flag │
│ 0x7E │ Type 3 / S-Bit / Len │ (1-4 B) │ (1-4 B) │ (1 B) │ (2 B) │ (LLC + xDLMS APDU)│ (2 B) │ 0x7E │
└──────┴──────────────────────┴──────────┴──────────┴─────────┴────────┴───────────────────┴────────┴──────┘
2. Interactive HDLC Frame Dissection
SNRM (Set Normal Response Mode) Frame:
7E A0 0A 00 02 00 23 03 93 9A FB 7E
3. HDLC Control Commands Table
- **`0x93` / `0x83`**: `SNRM` — Initialize HDLC connection - **`0x73` / `0x63`**: `UA` — Unnumbered Acknowledge (Confirmation) - **`0x53` / `0x43`**: `DISC` — Disconnect link - **`0x10 .. 0xFE`**: `I-Frame` — Information Frame carrying LLC (`E6 E6 00`) and APDU - **`0x11` / `0x01`**: `RR` — Receive Ready flow control ACK2.2 IEC 62056-47 TCP/UDP Port 4059 Wrapper Profile
Protocol specification for the lightweight 8-byte TCP/UDP Wrapper header used over IP networks and cellular IoT.
1. The 8-Byte Wrapper Header
Unlike HDLC, the IP transport profile (IEC 62056-47) eliminates flag bytes, bit stuffing, and CRC checks (relying on TCP checksums) and prefixes all APDUs with an 8-byte Wrapper Header:
┌─────────────────┬─────────────────┬─────────────────┬─────────────────┐
│ Protocol Ver │ Source WPort │ Destination WPort│ Length (2B) │
│ 0x00 0x01 (2B) │ Client SAP(2B) │ Server SAP(2B) │ APDU Length(2B) │
└─────────────────┴─────────────────┴─────────────────┴─────────────────┘
2. Interactive Frame Example
Wrapper GET Request on Management Client:
00 01 00 01 00 01 00 0D C0 01 C1 00 01 00 00 01 00 00 FF 02 00
3. TCP Keep-Alive & Long Connections
- Default IANA listening port is **TCP 4059** (and UDP 4059). - For cellular NB-IoT/4G meters, TCP keep-alive packets or application-layer heartbeats are sent at 60s to 300s intervals to prevent carrier NAT timeout teardown.2.3 IEC 62056-21 Optical Probe & Mode E Baud Rate Adaptation
How handheld units and optical probes execute initial sign-on at 300 baud and switch to high-speed HDLC at 9600/19200 baud.
1. Sign-on Sequence & Baud Switching
Under IEC 62056-21 Mode E, optical communication starts at 300 baud (7E1) and transitions to high-speed DLMS HDLC:
Handheld Unit (HHU) Meter (Server)
│ │
│─── /?!<CR><LF> (300 Baud Sign-On) ──────────────►│
│ │
│◄── /LOG5\2ZMD410...<CR><LF> (Identification) ────│
│ │
│─── <ACK>050<CR><LF> (Mode E Handshake) ─────────►│
│ │
[Switch to 9600 / 19200 Baud, 8N1 HDLC Framing] │
│ │
│─── 7E A0 0A 00 02 00 23 03 93 9A FB 7E (SNRM) ──►│
│◄── 7E A0 1F 03 00 02 00 23 73 ... 7E (UA) ──────│
2. Mode E Protocol Parameter Breakdown
- `/LOG5\2`: `LOG` = Manufacturer ID, `5` = 9600 Baud rate character, `2` = Mode E (HDLC switching). - `2.4 HDLC Frame Segmentation & Two-Tier CRC-16 Checksum State Machine
The mechanics of S-bit link-layer fragmentation, LLC sublayer positioning, CRC-16 CCITT validation, and full buffer reassembly before deciphering.
1. Segmentation Bit (S-Bit) & LLC Positioning
Per IEC 62056-46 Section 6.4.4.4.3:
- When an APDU exceeds the maximum frame length, HDLC splits it across multiple frames.
- Format Type 3 Byte 2 Bit 11 is the S-bit (0xA8 for segmented, 0xA0 for final/unsegmented).
- LLC Sublayer (0xE6 0xE6 0x00) is included ONLY in Segment 1. Continuation segments contain raw payload bytes immediately following the Control field!
Segment 1 (S=1): [7E] [A8 84] [Dest] [Src] [Ctrl] [HCS] [E6 E6 00] [Ciphertext Part 1] [FCS] [7E]
Segment 2 (S=1): [7E] [A8 80] [Dest] [Src] [Ctrl] [HCS] [Ciphertext Part 2] [FCS] [7E]
Segment 3 (S=0): [7E] [A0 42] [Dest] [Src] [Ctrl] [HCS] [Ciphertext Part 3 + Tag] [FCS] [7E]
2. Golden Rule of DLMS Decryption
**Do NOT decrypt individual HDLC segments.** 1. Verify CRC-16 FCS for each segment independently; 2. Concatenate raw payload bytes into a single contiguous buffer; 3. Feed the complete buffer into AES-GCM-128 for authentication and decryption.3.1 OBIS Identification System & 6-Group (A-F) Structure
The universal 6-group (A.B.C.D.E.F) hierarchical naming convention defined in the DLMS Blue Book and IEC 62056-61.
1. OBIS Group Architecture
Every physical or logical quantity in DLMS is addressed by a 6-tuple: A.B.C.D.E.F:
| Group | Meaning | Range & Standard Value Assignments |
|---|---|---|
| A | Medium | 0: Abstract / General, 1: Electricity, 4: Heat, 7: Gas, 8: Water. |
| B | Channel | 0: No channel, 1..64: Multi-channel measurement inputs. |
| C | Physical Quantity | 1: Active Power (+), 3: Reactive (+), 11/12: Phase L1 Volt/Current, 96: Service/Tamper. |
| D | Measurement Type | 8: Time-integral (Energy), 7: Instantaneous value, 4: Current average. |
| E | Tariff / Rate | 0: Total, 1..8: Tariff Rates T1 to T8. |
| F | Billing Period | 255 (0xFF): Current value, 0..99: Historical billing capture indices. |
2. Common OBIS Examples
- `1.0.1.8.0.255`: Active Energy Import Total (Current) - `1.0.31.7.0.255`: Instantaneous Current Phase L1 - `1.0.32.7.0.255`: Instantaneous Voltage Phase L1 - `0.0.1.0.0.255`: Real-Time Clock (Class 8)3.2 Electricity OBIS Code Registry & Multi-Tariff Models
Authoritative registry of standard electricity measurement OBIS codes across single-phase and polyphase smart meters.
1. Active & Reactive Energy Registry
| OBIS Code | Interface Class | Attribute | Description & Typical Units |
|---|---|---|---|
1.0.1.8.0.255 | Class 3 / 4 | 2 | Total Active Import Energy ($+A$) [Wh] |
1.0.1.8.1.255 | Class 3 / 4 | 2 | Tariff 1 Active Import Energy ($+A$ T1) [Wh] |
1.0.1.8.2.255 | Class 3 / 4 | 2 | Tariff 2 Active Import Energy ($+A$ T2) [Wh] |
1.0.2.8.0.255 | Class 3 / 4 | 2 | Total Active Export Energy ($-A$) [Wh] |
1.0.3.8.0.255 | Class 3 / 4 | 2 | Total Reactive Import Energy ($+R$) [varh] |
2. Instantaneous Grid Quality Telemetry
| OBIS Code | Interface Class | Attribute | Description & Units |
|---|---|---|---|
1.0.32.7.0.255 | Class 3 | 2 | Phase L1 RMS Voltage [0.1 V] (Scaler = -1) |
1.0.52.7.0.255 | Class 3 | 2 | Phase L2 RMS Voltage [0.1 V] (Scaler = -1) |
1.0.72.7.0.255 | Class 3 | 2 | Phase L3 RMS Voltage [0.1 V] (Scaler = -1) |
1.0.31.7.0.255 | Class 3 | 2 | Phase L1 RMS Current [0.001 A] (Scaler = -3) |
1.0.14.7.0.255 | Class 3 | 2 | Grid Frequency [0.01 Hz] (Scaler = -2) |
3.3 Class 3/4 Registers & Signed 8-Bit Negative Scaler Parsing
How to decode Class 3/4 ScalerUnit structures, parse signed 8-bit negative exponents (-3), and prevent floating point precision loss.
1. Register Interface Class (Class 3 & 4)
Per DLMS Blue Book Section 4.3.3, Class 3 contains:
- Attribute 2 (value): Measurement quantity (integer/long/double-long)
- Attribute 3 (scaler_unit): Structure containing:
- scaler: Integer8 (Tag 0x0F) — SIGNED 8-bit integer!
- unit: Enum (Tag 0x16)
2. The Negative Scaler Decoding Trap
$$\text{Physical Value} = \text{Raw Value} \times 10^{\text}$$ - If raw value = `5230` and scaler byte = `0xFD` ($-3$ in signed int8): $$\text = 5230 \times 10^ = 5.230\text$$ - **Common Bug**: If decoded as `uint8` (`+253`), value explodes to $5.23 \times 10^$!3. High Cumulative Energy & Float32 Rounding Trap
Cumulative energy exceeding $16{,}777{,}216\text$ will lose Wh increments under IEEE 754 `float32`. Always use `Decimal` or 64-bit integer arithmetic.3.4 Class 7 Profile Generic Load Buffers & Selective Access
Architecture of load profile circular buffers, capture objects definition, and time-range vs entry-index selective filtering.
1. Profile Generic (Class 7) Architecture
Class 7 manages periodic interval capture (e.g. 15-minute load profiles, daily billing profiles):
- Attribute 2 (buffer): Two-dimensional table of captured records.
- Attribute 3 (capture_objects): Array of column descriptors (Class ID, OBIS, Attribute ID).
- Attribute 4 (capture_period): Interval in seconds (e.g. 900 for 15 min).
2. Selective Access Selector 1 (By Date Range)
To query records between two timestamps without fetching entire megabyte logs:SelectiveAccessDescriptor ::= Structure {
access_selector: 1 (RangeDescriptor),
access_parameters: Structure {
restricting_object: Structure { class_id: 8, obis: 0.0.1.0.0.255, attribute_id: 2 },
from_value: Date_Time ("2026-08-01 00:00:00"),
to_value: Date_Time ("2026-08-01 23:59:59"),
selected_values: Array [] // Empty array = all columns
}
}
3.5 Class 8 Clock RTC 12-Byte Octet-String & DST Drift Mitigation
The precise 12-byte date_time octet-string layout, timezone deviation offsets, daylight saving status masks, and clock synchronization.
1. The 12-Byte Date_Time Structure
Per DLMS Blue Book Section 4.1.6.1, the standard timestamp is a 12-byte Octet-String:
| Byte | Field | Description & Valid Range |
|---|---|---|
| 0 - 1 | Year | 16-bit Big-Endian (e.g. 0x07EA = 2026, 0xFFFF = wildcard) |
| 2 | Month | 1..12 (0xFF = wildcard, 0xFD = daylight savings end) |
| 3 | Day of Month | 1..31 (0xFD..0xFF = special/wildcard) |
| 4 | Day of Week | 1 (Monday) to 7 (Sunday), 0xFF = not specified |
| 5 | Hour | 0..23 (0xFF = wildcard) |
| 6 | Minute | 0..59 (0xFF = wildcard) |
| 7 | Second | 0..59 (0xFF = wildcard) |
| 8 | Hundredths | 0..99 (0xFF = not specified) |
| 9 - 10 | Deviation | Signed 16-bit offset from UTC in minutes (e.g. +480 for UTC+8) |
| 11 | Clock Status | Bitmask: Bit 0 (invalid), Bit 1 (doubtful), Bit 7 (daylight savings active) |
3.6 Class 70 Disconnect Control & Remote Tripping Safety
Operating internal meter load disconnect switches safely via Class 70 methods, control states, and lockout protections.
1. Disconnect Control (Class 70) Attributes
- **Attribute 2 (`output_state`)**: `Boolean` (`true` = connected, `false` = disconnected). - **Attribute 3 (`control_state`)**: `Enum` (`0`: Disconnected, `1`: Connected, `2`: Ready for Reconnection). - **Attribute 4 (`control_mode`)**: Modes 1 to 6 controlling manual push-button vs remote reconnect conditions.2. Remote Disconnect / Reconnect Methods
- **Method 1 (`remote_disconnect`)**: Opens contactor, trips power. - **Method 2 (`remote_reconnect`)**: Closes contactor or transitions to `Ready for Reconnection` mode.In Security Suite 1, Class 70 methods must ALWAYS be transmitted inside `General-Glo-Ciphering` (`0xDB`) with authenticated and encrypted security!
3.7 Class 20/22 Schedules & Safe Distant Epoch Anchoring
Why using 0xFF wildcards triggers continuous 1Hz execution loops, why 01 00 empty arrays fail on legacy firmware, and why 2099/2100 is the universal standard.
1. Schedule Execution Time Traps
- **Trap 1 (0xFF Wildcards)**: Writing `FF FF FF FF` across time bytes matches every second, causing an infinite 1Hz execution storm. - **Trap 2 (Past Times / 0000:00:00)**: RTOS delta schedulers evaluate past timestamps as expired alarms and fire immediately upon `SET`. - **Trap 3 (Year 9999 Overflow)**: Exceeds 32-bit signed Unix epoch ($2^-1$) and wraps into year 1911. - **Trap 4 (Empty Array `01 00` Failure)**: Rejected by ~15% of meter firmware enforcing static `min_entries >= 1` table constraints.2. The Universal Golden Standard (Year 2099/2100)
Setting a confirmed distant future timestamp:09 0C 08 33 0C 1F FF 17 3B 3B 00 80 00 00
3.8 A-XDR BER Tag Encoding Directory & Data Structure Trees
Complete catalog of A-XDR compact primitive type tags, ASN.1 structures, length octet encodings, and nested data parsing.
1. Standard A-XDR Type Tags Directory
| Tag (Hex) | A-XDR Type Name | Encoding Format & Length Rules |
|---|---|---|
0x00 | null-data | 0 bytes payload |
0x01 | array | Length byte $N$ followed by $N$ elements |
0x02 | structure | Length byte $N$ followed by $N$ distinct typed elements |
0x03 | boolean | 1 byte (0x00 = false, 0x01 = true) |
0x04 | bit-string | Length in bits followed by packed byte array |
0x05 | double-long | 4 bytes signed integer |
0x06 | double-long-unsigned | 4 bytes unsigned integer |
0x09 | octet-string | Length byte $L$ followed by $L$ raw bytes |
0x0C | utf8-string | Length byte $L$ followed by $L$ UTF-8 characters |
0x0F | integer8 | 1 byte signed integer ($-128 .. +127$) |
0x11 | unsigned8 | 1 byte unsigned integer ($0 .. 255$) |
0x12 | long-unsigned | 2 bytes unsigned integer (16-bit) |
0x16 | enum | 1 byte unsigned enumeration |
4.1 ACSE Association Lifecycle (AARQ 0x60 / AARE 0x61 / RLRQ / ABRT)
State machine and ASN.1 handshake exchange for Association Request (AARQ), Response (AARE), Release (RLRQ), and Abort (ABRT).
1. ACSE Association Exchange
Client (HES) Meter (Server)
│ │
│─── AARQ (0x60) [App Context, System Title, CtoS] ─►│
│ │
│◄── AARE (0x61) [Result: 00, System Title, StoC] ──│
│ │
│─── Action-Request (Method 1: CtoS GMAC Tag) ──────►│
│ │
│◄── Action-Response (Method 1: Server Proof Tag) ──│
│ │
│========= Associated (Authorized Channel) =========│
│ │
│─── RLRQ (0x62) [Release Request] ────────────────►│
│◄── RLRE (0x63) [Release Response] ────────────────│
2. AARQ APDU Dissection
- `0x60`: `AARQ` tag - `0xA1`: Application Context Name (`LN_with_ciphering` or `LN_no_ciphering`) - `0xA6`: Calling AP Title (Client System Title, 8 bytes) - `0xAC`: Calling Authentication Value (CtoS Challenge) - `0xBE`: User Information field containing proposed xDLMS `InitiateRequest`4.2 Security Suites 0, 1 & 2 Cryptographic Matrix
Comparative cryptographic profile across DLMS Security Suite 0 (legacy), Suite 1 (AES-128 + ECC P-256), and Suite 2 (AES-256 + P-384).
1. Cryptographic Algorithms Comparison
| Security Parameter | Security Suite 0 (Legacy) | Security Suite 1 (Current Standard) | Security Suite 2 (High Security) |
|---|---|---|---|
| Symmetric Cipher | AES-GCM-128 | AES-GCM-128 | AES-GCM-256 |
| Key Agreement | Pre-shared Static Keys | ECDH over NIST P-256 (Ephemeral) | ECDH over NIST P-384 |
| Digital Signature | None | ECDSA with SHA-256 (NIST P-256) | ECDSA with SHA-384 (NIST P-384) |
| GMAC Tag Length | 12 Bytes | 12 Bytes | 12 Bytes |
| Invocation Counter | 4 Bytes (Mandatory) | 4 Bytes (Mandatory) | 4 Bytes (Mandatory) |
4.3 HLS 5 (GMAC) Challenge-Response Mutual Authentication & Table 43 Vectors
Bidirectional challenge calculation, Client/Server System Title orientation, and Green Book Table 43 official verification vectors.
1. HLS 5 Challenge-Response Formula
$$\text{CtoS Tag} = \text_{\text}(\text \parallel IC_{\text}, \text_{\text}, \text)$$ $$\text{StoC Tag (Server Proof)} = \text_{\text}(\text \parallel IC_{\text}, \text_{\text}, \text)$$
2. Official Green Book Table 43 Standard Vector
- **Client System Title**: `4D4D4D0000000001` - **Authentication Key (GAK)**: `D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF` - **StoC Challenge**: `503677524A323146` - **Client IC**: `1` - **Expected HLS CtoS Output**:10 00 00 00 01 1A 52 FE 7D D3 E7 27 48 97 3C 1E 28
4.4 General-Glo-Ciphering (0xDB) & Security Control Byte Bitmasks
Deconstructing the 0xDB encrypted APDU envelope, Security Control bitmasks, IV assembly, and AAD formulation.
1. Structure of General-Glo-Ciphering (0xDB)
┌──────┬────────┬──────────────┬────────┬────────────────┬──────────────────────────┬──────────┐
│ Tag │ Length │ System Title │ SC (1B)│ Invocation Cnt │ Ciphertext Stream (AES) │ GMAC Tag │
│ 0xDB │ 0x08 │ (8 Bytes) │ 0x30 │ (4 Bytes) │ (Encrypted xDLMS APDU) │ (12 B) │
└──────┴────────┴──────────────┴────────┴────────────────┴──────────────────────────┴──────────┘
2. Security Control Byte (SC) Bitmask
- **Bits 0-1**: Security Suite ID (`00` = Suite 0, `01` = Suite 1, `10` = Suite 2) - **Bit 4**: **Authenticated** (`1` = Authenticated via GMAC) - **Bit 5**: **Encrypted** (`1` = Encrypted via AES-CTR) - **Bits 6-7**: Key type (`00` = Global Unicast Key GUEK, `01` = Dedicated Key, `10` = Broadcast Key)Common SC values:
- 0x10: Global Key, Authenticated Only
- 0x30: Global Key, Authenticated & Encrypted (Standard Production Mode)
4.5 Invocation Counter ($IC$) Non-Volatile Persistence & Cold-Start Sync
How non-volatile storage in smart meters enforces anti-replay policies across TCP teardowns and how HES pre-reads IC via Public Client.
1. The Monotonic IC Invariant
- The meter security engine drops any frame where $IC_{\text} \le IC_{\text}$. - Resetting $IC$ to `1` upon HES worker restart locks out communication permanently.2. Cold-Start Synchronization Procedure
1. Connect via **Public Client (SAP 16)** (Plain, no ciphering required); 2. Read **Class 64 (`Security Setup`, `0.0.43.1.0.255`) Attribute 4** (`global_invocation_counter`); 3. Synchronize HES counter: $$\text IC = \text IC + 50$$ 4. Reconnect via Management Client (SAP 1) with synchronized counter.4.6 Association LN Access Control Matrix & Object Access Modes
Why authenticated HLS 5 associations fail with scope-of-access-violated when reading Class 70 or Class 8 without PDU-level encryption.
1. Object Access Modes in Association LN
Per DLMS Blue Book Section 4.5.3, Attribute 2 of 0.0.40.0.0.255 defines per-object permissions:
- 1: read_only (Plaintext allowed)
- 3: read_and_write
- 4: authenticated_read
- 5: authenticated_and_encrypted_read
If Clock (Class 8) or Relay (Class 70) is configured with Mode 5, sending a plain Get-Request results in scope-of-access-violated (0xC4 0x01 C1 01 01). The request must be wrapped inside 0xDB ciphering.
5.1 xDLMS DataBlock-G vs GBT (General Block Transfer) Streaming
Comparing traditional stop-and-wait datablocks with General Block Transfer (GBT) streaming windows, and resolving AARQ Bit 19 negotiation deadlocks.
1. DataBlock-G vs GBT
| Feature | Traditional DataBlock (0xC4 0x02) | General Block Transfer (GBT 0xE0) |
|---|---|---|
| Transmission Mode | 1-by-1 stop-and-wait | Streaming sliding window (Window size 1 to 64) |
| Round-Trip Delay | High latency over cellular NB-IoT | 75% faster bulk transfer throughput |
| Conformance Bit | Standard Conformance | Bit 19 (general-block-transfer) |
| Framing Tag | xDLMS Service Tag | 0xE0 GBT Control Header inside 0xDB |
2. Conformance Bit 19 Rule
If HES does not support GBT, ensure Bit 19 is cleared in `AARQ` (`0x007E1F`).5.2 Class 18 Image Transfer Firmware OTA Upgrade & Signature Verification
Complete OTA firmware upgrade lifecycle: initiation, zero-indexed block transfer, bitstring tracking, ECDSA signature formats, and activation.
1. The 4-Step Image Transfer Lifecycle
Per DLMS Blue Book Section 4.3.8 (0.0.44.0.0.255):
1. Method 1 (image_initiate): Pass image identifier (e.g. "V3.2.0") and image size in bytes;
2. Method 2 (image_block_transfer): Send blocks sequentially starting at block_number = 0;
3. Method 3 (image_verify): Submit digital signature (ASN.1 DER encoded ECDSA P-256);
4. Method 4 (image_activate): Execute firmware flash and reboot.
5.3 Class 40 (Push Setup) Unsolicited Event Notification & Backoff
Configuring unsolicited alarm pushes (power outage, tamper detection) over TCP/UDP and managing randomized backoff retry intervals.
1. Push Setup (Class 40) Configuration
- **Attribute 2 (`push_object_list`)**: Array of captured OBIS attributes sent in push; - **Attribute 3 (`send_destination_and_method`)**: Destination IP, port, and transport protocol (TCP/UDP); - **Attribute 5 (`randomisation_start_interval`)**: Random delay to prevent simultaneous grid reconnection storms.6.1 Open-Source SDK Integration Guide (Gurux.DLMS / Python / C)
Step-by-step developer guide for connecting to smart meters using Gurux.DLMS in Python, ANSI C, and Java.
1. Python Gurux.DLMS Quickstart
from gurux_dlms.secure import GXDLMSSecureClient
from gurux_dlms.enums import Authentication, Security, InterfaceType
from gurux_dlms.objects import GXDLMSClock
client = GXDLMSSecureClient(True, 1, 1, Authentication.HIGH_GMAC, None, InterfaceType.WRAPPER)
client.ciphering.systemTitle = bytes.fromhex("4D4D4D0000000001")
client.ciphering.authenticationKey = bytes.fromhex("D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF")
client.ciphering.blockCipherKey = bytes.fromhex("000102030405060708090A0B0C0D0E0F")
client.ciphering.security = Security.AUTHENTICATION_ENCRYPTION
# Ready to generate AARQ and exchange messages
6.2 Top 10 DLMS Engineering Traps & Diagnostic Fault Tree
Comprehensive diagnostic fault tree resolving the 10 most common DLMS engineering failures in lab and field deployments.
1. Top 10 Diagnostic Fault Matrix
| # | Observed Symptom | Primary Root Cause | Standard Remediation |
|---|---|---|---|
| 1 | invalid-password / challenge-mismatch | IV System Title inverted during Server Proof | Use Server System Title for StoC verification (Green Book Table 43). |
| 2 | scope-of-access-violated (0xC4 0x01 C1 01 01) | Plaintext read on Class 70/8 | Wrap request in 0xDB General-Glo-Ciphering. |
| 3 | Meter drops fresh connection after restart | IC reset to 1 (Replay protection) | Pre-read Class 64 Attribute 4 via Public Client (SAP 16). |
| 4 | Current value reports $10^$ A | Scaler byte 0xFD decoded as unsigned | Unpack 0x0F as signed 8-bit integer (struct.unpack('b')). |
| 5 | Block Transfer out-of-sequence error | 15-min circular buffer shift without snapshot | Enforce Selective Access by Date Range (Blue Book 4.3.7.2). |
| 6 | OTA image_verify fails | Block transfer started at 1 instead of 0 | Ensure block numbers start at 0 (Blue Book 4.3.8). |
| 7 | OTA signature rejected | Raw 64B vs 71B ASN.1 DER ECDSA format | Wrap ECDSA P-256 in ASN.1 DER 0x30 0x45 0x02 0x21 .... |
| 8 | Buffer read hangs after AARQ | Conformance Bit 19 GBT mismatch | Clear Bit 19 in AARQ or implement GBT streaming. |
| 9 | Schedule continuous 1Hz firing | Execution time set with 0xFF wildcards | Use confirmed safe distant epoch (2099-12-31-FF 23:59:59). |
| 10 | Cumulative energy increments lost | Float32 24-bit mantissa truncation |
3.0 COSEM Interface Classes & Object Architecture
Fundamental object-oriented architecture of COSEM Interface Classes defined in IEC 62056-62 and Blue Book.
1. COSEM Interface Classes Hierarchy
COSEM structures meter data into discrete, strongly-typed Interface Classes: - **Class 1 (Data)**: Simple variables (Logical Device Name `0.0.42.0.0.255`) - **Class 3 (Register)**: Measurement scalars with `scaler_unit` (`1.0.1.8.0.255`) - **Class 4 (Extended Register)**: Register with capture timestamp and status - **Class 7 (Profile Generic)**: Circular historical capture buffers - **Class 8 (Clock)**: 12-byte real-time clock and calendar - **Class 15 (Association LN)**: Application association and access rights table - **Class 70 (Disconnect Control)**: Remote relay tripping and reconnection4.0 AARQ Handshake & Security Suites 0/1/2 Overview
Application Association Request (AARQ) parameters, High Level Security (HLS 5 GMAC), and ciphering suites.
1. Association & Security Parameters
- **Application Context**: `LN_with_ciphering` (`2.16.756.5.8.1.3`) - **Calling AP Title**: 8-byte Client System Title (e.g. `4D4D4D0000000001`) - **Security Control (`0x30`)**: Authenticated and Encrypted via AES-GCM-128.6.0 Official Standards, CTT & Open-Source SDKs
Official standards portals, DLMS UA testing tools, and open-source protocol libraries.
1. Official Standards & Conformance Links
- Official Portal: DLMS User Association Official Portal - IEC Webstore: IEC 62056 Standards Suite - Gurux C Stack: Gurux.DLMS.c GitHub Repository - Gurux Objects Directory: Gurux DLMS Objects Reference - OpenMUC Java: OpenMUC jDLMS Library