Managed TDMA in NPR

This page describes how the schedule works, what the terms mean, and why a clean link can still ping badly.

The original protocol description by F4HDK is the authoritative source — see the NPR protocol specification document on the NPR Hackaday project page. What follows is the operator's eye view.

One master, many clients

An NPR network has exactly one master and one or more clients.

The master defines timing on the channel, sends out the periodic allocation frame that says who transmits when, decides how slots are shared between connected clients, and measures and applies timing advance so that uplink bursts arrive where it expects them. Clients follow the master's timing, report how much demand they have for airtime, and only transmit in the opportunities they have been assigned. That is the whole point of NPR: the channel is shared, but it is not random. The master keeps order.

This is also why two NPR masters cannot share one channel. The schedule is a single-master design; if you want two networks in the same place, give them different radio_network_id values (the NPR equivalent of CTCSS) and ideally different frequencies as well.

The TDMA frame

The schedule is a repeating TDMA frame. Its exact duration depends on the modulation profile (see Modulation Profiles), but the structure is always the same:

        TDMA frame  (one full cycle, duration depends on profile)
        +--------------------------------------------------------------+
        |                                                              |
        v                                                              v
+----------+----+----+----+----+----+----+----+----+----+----+----+----+--- +
| ALLOC    | µs | µs | µs | µs | µs | µs | µs | µs | µs | µs | µs | µs |...|
| (master) | 1  | 2  | 3  | 4  | 5  | 6  | 7  | 8  | 9  | 10 | 11 | 12 |   |
+----------+----+----+----+----+----+----+----+----+----+----+----+----+---+
     ^       \____________________________________________________________/
     |                  17 regular microslots, last one reserved
     |                  for multiframe / "slow" cadence clients
     |
     `--- reduced microslot at the start of every TDMA frame:
          master broadcasts the allocation frame here

Each TDMA frame contains one short slot at the very beginning where the master broadcasts the allocation, followed by seventeen regular microslots that the master can hand out to clients. The last regular microslot is reserved for the multiframe cadence used by low-demand clients (x8-style), which is described below. There are also small TX/RX switching margins and a timing-advance margin built into the schedule, but as an operator you do not need to count them — the master and the clients do.

The first frame inside a slot starts exactly at the slot boundary. If the client has more to send and the slot is long enough, more frames follow back-to-back inside that slot. The whole burst still has to fit into the slot the master allocated, and if the client has nothing to send when its turn comes, it sends a NULL frame anyway — that NULL is what keeps the master in sync and what reports current demand.

Terms worth knowing

A few short definitions will save a lot of confusion:

  • TDMA frame — one full schedule cycle, repeating. Duration depends on the modulation profile.
  • Microslot — the smallest regular unit of allocation inside a TDMA frame. The master gives clients one or more microslots per frame.
  • Timeslot (slot) — one contiguous block of microslots assigned to a single client.
  • Allocation frame — the short broadcast at the start of every TDMA frame in which the master publishes the schedule.
  • TOP — the synchronization marker carried in the TDMA byte; clients use it to lock onto the master's timing.
  • TAtiming advance, the master's correction of a client's perceived "slot start" so its uplink bursts arrive at the right time despite propagation delay.
  • Demand — the value a client puts in the low five bits of its TDMA byte to tell the master how much it would like to send. Not a byte count; an approximate number of microslots.

The allocation frame

At the beginning of every TDMA frame the master sends an allocation frame with protocol ID 0x1F and broadcast destination client ID 0x7F. Each entry in that frame tells one client:

  • when its slot starts inside this TDMA frame,
  • how long the slot is,
  • whether it is a regular per-frame slot or a multiframe slot,
  • which timing-advance correction is currently being applied to it.

Demand reporting

Each client reports demand in the low five bits of the TDMA byte inside its uplink traffic. The value is not a byte count — it is an approximation of how many microslots the client would like the next time. In PacketRF that demand is derived from the client's signaling backlog plus the IPv4 backlog, with a small amount of smoothing so that one short burst does not make the master immediately reallocate the channel.

Fast mode and slow mode

This part matters in operation more than any other.

In fast mode a client gets at least one transmit opportunity in every TDMA frame. This is what you want for interactive use: ping times are roughly one TDMA frame (see Latency and Ping Expectations for the numbers), and bulk transfers actually move.

In slow mode a client only gets a slot on the multiframe cadence — by default x8, meaning one transmit opportunity every eight TDMA frames. The client is still fully connected, the link is still working, the master still has it on the books — it just only gets airtime occasionally. This is the schedule the master falls back to for clients that are not asking for much, so that interactive clients are not slowed down by the merely connected ones.

Timing advance

The client's local idea of "slot start" is not quite enough on its own. The master's idea of slot start is delayed by propagation — roughly 5 µs/km round-trip — so the master sees a uplink burst later than the client sent it. NPR solves this with timing advance: the master measures where uplink frames actually arrive and tells the client to shift its slot start earlier, so future bursts land in the right place.

This matters more and more as the path gets longer. The protocol's maximum theoretical link length is 300 km, set by the timing-advance window itself. In practice the modulation profile usually limits you first.