RF Wireless World

Browse articles, tutorials, tools, and vendors.

Matter MRP: Message Reliability Protocol Explained

By RF Wireless Expert Team

This page explains Matter’s Message Reliability Protocol (MRP) and how it ensures guaranteed communication over unpredictable networks.

UDP in a Lossy World: Unpacking Matter’s Message Reliability Protocol (MRP)

In the world of computer networking, there are two primary ways to send data viz. TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). TCP is like a certified mail delivery as it guarantees your package delivery. But TCP is heavy, slow and requires constant connection maintenance. UDP is like throwing a postcard in the mail and it is incredibly fast and lightweight, but there is no guarantee it will reach its destination.

Because smart home devices are especially battery powered sensors on Thread networks; they need to conserve energy and bandwidth.For this reason, Matter primarily uses UDP for its day to day operational messages. However, turning on a light or unlocking a door isn’t something that can just be “lost in the mail.”

To solve the unreliability of UDP, the Matter specification introduces the Message Reliability Protocol (MRP). MRP sits on top of UDP and provides a lightweight, highly optimized “return receipt” system to guarantee message delivery. Let us explore how MRP works.

1. The Anatomy of MRP Message (‘R’ and ‘A’ Flags)

When a Matter device sends a message that absolutely must arrive (like a command to unlock a door), it utilizes specific bits in the Exchange Flags of the message header:

  • The ‘R’ (Reliable) Flag: The sender sets this bit to 1. This tells the receiving device: “This message is important. You must send me an acknowledgment (Ack) when you get it.”
  • The ‘A’ (Acknowledgment) Flag: When the receiving device replies, it sets this bit to 1 and includes the specific Message Counter of the original message. This tells the sender: “I successfully received message #12345.”

2. Smart Acknowledgment: Piggybacking vs. Standalone

To save battery life and reduce wireless traffic (preventing “network storms”), MRP is designed to be as efficient as possible with its Acks.

  • Piggybacked Acks: If a device receives a reliable message and needs to send data back anyway (e.g. smart thermostat replying with the current temperature), it won’t send a separate Ack. Instead, it “piggybacks” the Ack onto the temperature data response.

  • Standalone Acks: If the device receives a command but has no immediate data to send back, it will wait a brief moment (defined by the MRP_STANDALONE_ACK_TIMEOUT, which defaults to 200 milliseconds). If it still has nothing to say, it will transmit a tiny, empty message containing nothing but the ‘A’ flag to confirm receipt.

Matter MRP

3. Retransmission and Backoff

If a sender transmits a message with the ‘R’ flag and doesn’t get an Ack back, it assumes the message was lost in the “lossy world” of Wi-Fi or Thread interference. It will automatically resend the message, but it does so using a highly mathematical Retransmission Timer.

  • Max Retries: A sender will try to send a message up to a maximum number of times (defaulting to 5 attempts, defined as MRP_MAX_TRANSMISSIONS). If it fails 5 times, it alerts the application that the device is unreachable.

  • Jitter and Exponential Backoff: If the network is congested, spamming the network with retries will only make the congestion worse. Therefore, MRP uses a “two phase” backoff scheme. The first retry happens relatively quickly (linear backoff). If it fails again, the time between retries increases exponentially. Furthermore, the protocol injects random “jitter” (i.e. randomized delay of up to 25%) into the timer so that multiple devices don’t accidentally re-try at the exact same millisecond and crash into each other.

4. Adapting to Sleepy Devices (ICDs)

One of the most powerful features of MRP is its awareness of Intermittently Connected Devices (ICDs). These are battery operated devices, like window sensors, that spend 99% of their time asleep with their radios turned off to save power.

If a sender tries to talk to a sleeping device, a standard fast retry mechanism would fail immediately. MRP solves this by tracking the Session Context of the destination device:

  • Active Mode: If the receiving device is currently awake, the sender expects an Ack quickly (SESSION_ACTIVE_INTERVAL, defaulting to 300ms).

  • Idle Mode: If the receiving device is asleep, the sender dynamically stretches its retry timer (SESSION_IDLE_INTERVAL, defaulting to 500ms or longer). It patiently holds the message and spaces out its retries, giving the sleepy device time to wake up, check its messages and reply.

5. Handling Duplicates

In a lossy network, sometimes the original message does reach the target, but the Acknowledgment gets lost on the way back.

The sender, thinking the message failed, will resend it. The receiver now has two identical “Unlock Door” commands. To prevent the door from trying to unlock twice (known as a Replay Attack or duplicate execution), MRP uses Message Counters.

The receiver maintains a “Message Reception State” table. When it sees the duplicate message counter, it immediately drops the command so it isn’t executed twice. Crucially, however, it still sends an Ack back. It knows the sender is panicking because it missed the first Ack, so it sends another one to satisfy the sender and close the transaction.

Summary

By implementing the Message Reliability Protocol, Matter gets the best of both worlds. It utilizes the lightning fast, low overhead nature of UDP, but layers on intelligent retry timers, duplicate detection and sleep aware acknowledgments to ensure that your smart home commands never get lost in the ether.

Continue Learning Matter Protocol

Compare Matter With Other Technologies

Continue Learning Core Networking : TCP, IP & UDP

Keep Reading