Wireless M-Bus to NB-IoT - Configuration Messages
Guide to the communication protocol of the wireless M-Bus to NB-IoT converters ACR-CV-1xx101NI-W-D2 and ACR-CV-1xx101NI-W433-D2.
Introduction
This manual describes a use of the following Lua script Lua script which sets up a protocol to communicate with the ACRIOS NI-W-D converter and a server configured for this purpose. The system makes use of various payload messages (uplink and downlink) that enable both data gathering and device configuration.
First, we look at general principles used in this communication protocol, then there is an overview of uplink messages (device → server communication), then there is an overview of downlink messages (server → device communication) and finally there is a full example of communication between an ACR-CV unit and the server along with an explanation.
Payload
The communication between the device and the server is achieved with help of payload messages. The payload messages are sent in two directions.
- Uplink Message
- This message type is sent from the converter to the server with the requested information.
- Downlink Message
- This message type is sent from the server to the converter with specific commands.
Uplink Command Bytes
| Command Byte | Description |
|---|---|
| 0xFF | Gather report (Legacy) |
| 0xFE | Configuration acknowledge |
| 0xFD | wM-Bus IDs acknowledge |
| 0xFB | Scanning done |
| 0xFA | Status report |
| 0xF9 | Bootloader request |
| 0xF7 | Bootloader answer |
| 0xF6 | wM-Bus IDs checksum |
| 0xF4 | Gather report acked |
| 0xF3 | Scanned unit with mode report |
| 0xF2 | Status report extended |
| 0xF1 | Error report |
| 0xF0 0xFF | Beacon report |
| 0xF0 0xFE | Send once data |
| 0xF0 0xFD | Send once end of gathering |
| 0xF0 0xFC | Sontex ID acknowledge |
| 0xF0 0xFB | Send Sontex frame |
| 0xF0 0xFA | Send number of Sontex IDs |
| 0xF0 0xF9 | Sontex scan finished |
| 0xF0 0xF8 | Scan report with payload |
| 0xF0 0xF7 | BUP key readout |
| 0xF0 0x00 | Data report with ACRCOM |
Downlink Command Bytes
| Command Byte | Description |
|---|---|
| 0x01 | Send IDs |
| 0x02 | Send config |
| 0x03 | Request config |
| 0x04 | Request scan |
| 0x05 | Request IDs |
| 0x06 | Request status |
| 0x07 | Request reset |
| 0x08 | Downlink send ack |
| 0x09 | Specified Error Report |
| 0x0A | Error Report |
| 0x0B | Planned gathering |
| 0x0C | Set Sontex list of IDs |
| 0x0D | Request Sontex ID checksum |
| 0x0E | Request Sontex scan |
| 0x0F | Request scan with payload |
| 0x10 | Set Sensus BUP key |
| 0x11 | Get Sensus BUP key |
Communication Diagrams
This section outlines communication essential for various configurations such as ID readout, encryption keys in BUP mode, and other processes described further below. Every process is clearly depicted and explained through UML diagrams.
Configuration
The primary purpose of downlink communication is remote configuration of the target device. Configuration messages are sent in response to specific messages received from the uplink device. Keep in mind that not all the messages qualify for a response. Downlink messages are only processed when they respond to the following uplink messages:
- 0xF4
- 0xF0 0xFF
- 0xF0 0xFA
- 0xF0 0xF9
- 0xFB
- 0xF1 (specifically when triggered by command 0x0A)
- 0xF0 0xFD
General Configuration
This diagram explains a configuration procedure following a beacon message.
If the device is not configured, it sends a 0xF4 0x01 gather report message. Without a filter of IDs set, the converter will automatically send an uplink every hour to open a receive window for a possible downlink.
Setting IDs
- Wireless M-Bus devices
Below is a diagram showing a process of Wireless M-Bus ID configuration.
- Sontex devices
Configuring Sontex devices involves scanning configured IDs, unlike with the usual Wireless M-Bus devices. This difference is caused by the need of these meters to receive a request for a specified meter ID , in other words, there is a need for active communication, rather than gathering frames passively sent by the meters (passive communication). The benefit of the extra scan in the configuration procedure is that the meter's availability is ensured.
Setting BUP Keys
This section covers the procedures for setting and retrieving BUP (Bubble Up Protocol) keys. Further explanation can be found in the diagrams below.
BUP is a communication protocol used by Sensus/Xylem water meters (MeiStream, iPerl). The communication is encrypted, and if the decryption key is provided, the ACR-CV device can verify the integrity of received frames. Without the decryption key, the ACR-CV cannot verify the integrity and checksum of received BUP messages. Therefore, the key is required.
Note that if an empty key is set, the default BUP Sensus key is used.
Set BUP Key
The following diagram showcases how the process of setting the BUP key works.
Get BUP Key
The following diagram showcases how the process of getting the BUP key works.
Gathering Modes
In addition to specific communication configurations, the Lua scripts available for this device allow for three different approaches to scheduled gathering:
- Multimode: This mode is managed by the server, this mode operates using the following Lua script. Once a configuration message is received from the server, the device enters scheduled gathering mode. It regularly sends beacon messages to maintain communication with the server. In response, the server calculates the necessary interval until the next gathering session and sends a scheduled gathering message back to the device, which then waits until the next gathering session.
Pros
- You can set-up an exact list od IDs with help of Wireless M-Bus ID filter.
- This way, the readout cycle can terminate sooner and does not send any unwanted meter data.
Cons
- It is required to send the configuration from the server.
-
SendOnce: This mode is manually configured directly in the following Lua script. This script works similarly to "Multimode" but does not require server for configuration:
workdayOnly = true -- true for workdays only, false for all days
numberOfDays = 3 -- the number of days/workdays since the end of month
startHour = 10 -- an hour of the start of the readout
randomizeSeconds = 7200 -- up to 7200s~2hrs of delayed start since startHour
Pros
- The Lua script contains the configuration itself, therefore there is no need for configuration from the server.
- The device sends data from every meter in its range.
Cons
- There is no option to configure Wireless M-Bus ID filter.
- The readout cycle may take longer, because it scans for data from meter for an exactly specified amount of time.
-
Periodic Wake-Up: This mode is used by default when no specific gathering schedule is configured. Both of the Lua scripts use a predefined interval to wake up periodically:
pDaysDef = 7 -- days
pHrsDef = 0 -- hours
pMinsDef = 0 -- minutesIn the meantime, the device sends beacon messages to maintain connectivity.
You can look at the following diagram for a simple representation of how the gathering modes differ.
Scheduled Gathering
The diagram below showcases how the device regularly sends beacon messages to maintain communication with the server. In response, the server calculates the necessary interval until the next gathering session and sends a "Planned gathering" message back to the device, which then waits until the next gathering session.
Passive Gathering
Passive gathering is often used by:
- standard Wireless M-Bus devices
- Apator Metra
- Sensus
- BUP and others
Active Gathering
Sontex devices, which are using protocol Radian, are among devices that use active gathering. This protocol requires query-response type of communication and for that reason it is called "Active".
In Active gathering, the 0xF4 report is sent with an empty list of IDs.
Combination of Both Active and Passive Gathering
Both Active and Passive types of gathering are combined in this case. The difference is that the device maintains two separate lists of IDs for Passive and Active gathering, and the devices using Passive gathering are processed first, while devices using the Active gathering are processed last. For further details, see the diagram below.
Scanning for Devices
There are two approaches to scanning: Passive and Active. Passive Wireless M-Bus devices send data frames periodically, whereas Active devices, such as Sontex, require a request before they transmit data. The diagrams below showcase the communication between the server and the device.
-
Wireless M-Bus devices
The unit scans for nearby wM-Bus IDs and sends its device ID, RSSI, and manufacturer ID to the server/backend. This feature is used for automatic allocation based on RSSI or general ID sniffing.
-
Sontex devices
Sontex devices require a request for a specific ID to receive a response; therefore, the list of IDs must be sent in combination with the scan command. See the section here and diagram below.
Uplink Command Bytes
This section provides description for uplink messages that are the individual payloads sent by the converter to the server.
Data Report
This is a periodic report sent by the converter, where the first byte defines the local Wireless M-Bus ID followed by raw data from the Wireless M-Bus device.
Each device is limited to 240 local Wireless M-Bus IDs in range from 0 (0x00) to 127 (0xF0)
| Example | Description | Size | Byte Number |
|---|---|---|---|
| 0x01 | Local wM-Bus ID | [1B] | 1 |
| 0xXX | Raw device data | [xB] | 2 |
Gather Report (0xFF) (Legacy)
This command gathers report for number of devices (N). The report is sent after every scanning cycle and includes information about which ID was found and which was not.
Note that this command is marked as Legacy. It is used only in the older versions of the Lua script.
Payload Description
| Example | Description | Size | Byte Number |
|---|---|---|---|
| 0xFF | Command byte | [1B] | 1 |
| 0x01 | ID1 was found | [1B] | 2 |
| 0x01 | ID2 was found | [1B] | 3 |
| 0x00 | ID3 was not found | [1B] | 4 |
| 0x01 | ID4 was found | [1B] | 5 |
| 0xXX | xxxxxx | [NxB] | 6 |
0x01 = IDs received
0x00 = IDs not found
Configuration Acknowledgment (0xFE)
This message confirms that the configuration was successfull.
Payload Description
| Example | Description | Size | Byte Number |
|---|---|---|---|
| 0xFE | Command byte | [1B] | 1 |
| 0x78 | Time per entry [s] | [1B] | 2 |
| 0x00 | Gather time S mode [s] | [1B] | 3 |
| 0x00 | Gather time T/C mode [s] | [1B] | 4 |
| 0x00 | Wake up period [Days] | [1B] | 5 |
| 0x00 | Wake up period [Hours] | [1B] | 6 |
| 0x0F | Wake up period [minutes] | [1B] | 7 |
| 0x06 | Filter length | [1B] | 8 |
| 0x0E | Config version | [1B] | 9 |
| 0x1E | Gather time M mode [s] | [1B] | 10 |
Time per entry - This is a time in seconds for how long it took to scan for one ID. The total scan time is calculated by multiplying the time by the amount of IDs.
Gather time S, T, and M mode - This is a time in seconds defining for how long the device should receive the data in S, T, or M mode.
Filter length - This is the total number of device IDs stored in the memory of a device.
Config version - This is a number that increments with each new configuration (0 to 255).
W M-Bus IDs Acknowledgment (0xFD)
This message confirms configuration of the wM-Bus IDs.
Payload Description
| Example | Description | Size | Byte Number |
|---|---|---|---|
| 0xFD | Command byte | [1B] | 1 |
| 0x03 | Filter length [= N] | [1B] | 2 |
| 0x90 0x82 0xCB 0x01 | Filter ID 1 | [4B] | 3-6 |
| 0x74 0x82 0xCB 0x01 | Filter ID 2 | [4B] | 7-10 |
| 0x75 0x82 0xCB 0x01 | Filter ID 3 | [4B] | 11-14 |
| 0xXX 0xXX 0xXX 0xXX | N x Filter ID X | [N x 1B] | N |
The byte order of filter IDs (as seen in the example above) starts with LSB and ends with MSB (little endian). Here are some examples of IDs:
ID1 = 01 CB 82 90
ID2 = 01 CB 82 74
ID3 = 01 CB 82 75
Scanning Done (0xFB)
This report is sent after the scanning cycle is completed.
| Example | Description | Size | Byte Number |
|---|---|---|---|
| 0xFB | Command byte | [1B] | 1 |
Status Report (0xFA)
Status report contains signal strength, battery voltage and Lua script version that the device is currently using.
Payload Description
| Example | Description | Size | Byte Number |
|---|---|---|---|
| 0xFA | Command byte | [1B] | 1 |
| 0x0F 0x0B 0x0E | Status report | [3B] | 2-4 |
| 0x33 0x2E 0x30 | Script version | [3B] | 5-7 |
The status report contains 3 bytes. where:
- 1st byte (0x0F) is a signal strength.
- 2nd byte (0x0B) is the LSB of battery voltage.
- 3rd byte (0x0E) is the MSB of battery voltage.
Bootloader Request (0xF9)
Note that the following example is split into multiple parts for better understanding, but otherwise it is sent in a form of a single frame.
Below is the first part of the frame, it contains bootloader specific command byte, bootloader version and bootloader request type.
These are the different bootloader request types:
- BL_REQ_ALL - Contains the entire frame, including all three following parts:
- NB-IoT
- Chip IDs
- CRC section
- BL_REQ_NBIOT_IDS - contains only NB-IoT related part.
- IMEI, IMSI, ICCID separated with 0x00 (can be be seen in the example below).
- BL_REQ_CHIP_IDS - contains only chip information.
- BL_REQ_SECTIONS_CRC - contains only CRC part of the frame.
| Example | Description | Size | Byte Number |
|---|---|---|---|
| 0xF9 | Command byte | [1B] | 1 |
| 0x06 0x06 | Version | [2B] | 2-3 |
| 0x00 | BL request type | [1B] | 4 |
NB-IoT IDs Section (BL_REQ_NBIOT_IDS)
Payload Description
IMEI
| Example | Description | Size | Byte Number |
|---|---|---|---|
| 0x38 0x36 0x38 0x33 0x33 0x33 0x30 0x33 0x35 0x30 0x33 0x37 0x31 0x32 0x32 | IMEI (868333035037122) | xB (ASCII) | 1-15 |
| 0x00 | Split by zero | [1B] | 16 |
IMSI
| Example | Description | Size | Byte Number |
|---|---|---|---|
| 0x39 0x30 0x31 0x34 0x30 0x35 0x37 0x31 0x30 0x30 0x35 0x38 0x39 0x31 0x35 | IMSI (901405710058915) | xB (ASCII) | 1-15 |
| 0x00 | Split by zero | [1B] | 16 |
ICCID
| Example | Description | Size | Byte Number |
|---|---|---|---|
| 0x38 0x39 0x38 0x38 0x32 0x32 0x38 0x30 0x30 0x30 0x30 0x30 0x31 0x30 0x30 0x39 0x35 0x34 0x35 0x39 | ICCID (89882280000010095459) | xB (ASCII) | 1-20 |
| 0x00 | Split by zero | [1B] | 21 |
Chip IDs Section (BL_REQ_CHIP_IDS)
Payload Description
Chip EUI
| Example | Description | Size | Byte Number |
|---|---|---|---|
| 0x5D 0x00 0x31 0x00 0x0D 0x50 0x42 0x59 0x37 0x39 0x38 0x20 | Chip EUI (0x203839375942500D0031005D) | 12B (little endian) | 1-12 |
Flash size in kB, Chip package, Chip ID & Rev
| Example | Description | Size | Byte Number |
|---|---|---|---|
| 0x00 0x01 0x00 0x00 | Flash size in kB (100 kB) | 4B (little endian) | 1-4 |
| 0x0A 0x00 0x00 0x00 | Chip package (10) | 4B (little endian) | 5-8 |
| 0x35 0x64 0x01 0x10 | Chip ID & Rev (REV Z, id 435) | 4B (little endian) | 9-12 |
Chip Package Types:
These numbers refer to commonly used chip package types.
- 0 - LQFP64
- 10 - UFQFPN48
- 11 - LQFP48
Revision:
These following bytes allow identification of commonly used revisions.
0x10016435 → 0x1001
((0x10016435 & 0xFFFF0000) >> 16)
- 0x1000 - REV A
- 0x1001 - REV Z
- 0x2001 - REV Y
Chip ID:
These following bytes refer to commonly used chip IDs.
0x10016435 → 0x435
0x10016435 & 0xFFF
- 0x435 = STM32L43xxx/STM32L44xxx
- 0x462 = STM32L45xxx/STM32L46xxx
- 0x464 = STM32L41xxx/STM32L42xxx
CRC Section (BL_REQ_SECTIONS_CRC)
Payload Description
| Example | Description | Size | Byte Number |
|---|---|---|---|
| 0xF5 0x09 | CRC16 BL | 2B (little endian) | 1-2 |
| 0x5B 0x1B | CRC16 Config | 2B (little endian) | 3-4 |
| 0x56 0x38 | CRC16 App | 2B (little endian) | 5-6 |
| 0x94 0x56 | CRC16 Lua | 2B (little endian) | 7-8 |
| 0x80 0x9E | CRC16 Fragment | 2B (little endian) | 9-10 |