How WIRES-X Actually Works, Byte by Byte

How WIRES-X Actually Works, Byte by Byte

Table of Contents

What really happens when you press the X button, from the bits on air to the room list on your screen.

In How C4FM, System Fusion and WIRES-X Work we looked at WIRES-X from the user’s side: nodes, rooms, and the [X] button that lists and connects them. In Teaching qradiolink to Speak D-STAR and Fusion we got C4FM voice out of an SDR.

This week qradiolink learned the other half: it can now send WIRES-X commands over RF to an MMDVM hotspot running YSFGateway. It can ask the node for its status, connect to a room by number and disconnect, just as a Yaesu radio does. Building that meant getting every byte right, because the hotspot ignores anything it doesn’t fully understand. So this post goes through WIRES-X one layer at a time, using the code as the reference.

How to read this post. The main text explains how it works. Grey boxes marked ⚙ Under the bonnet go down to the bytes and the code. Skip them freely.


Two halves of WIRES-X

“WIRES-X” covers two quite different things:

  1. The radio-to-node protocol. This is how your radio asks the node for a room list, and how the node answers. It travels over the air, inside ordinary C4FM frames, and it’s the same whether the node is a real Yaesu node or an open-source hotspot.
  2. The node-to-internet backhaul. On a Yaesu node, the WIRES-X PC software talks to Yaesu’s servers and other nodes using Yaesu’s own closed protocol. On an MMDVM hotspot, YSFGateway stands in for the node and links to open YSF and FCS reflectors instead.
flowchart LR
    R["Fusion radio<br/>or qradiolink"] -- "WIRES-X commands<br/>in Data FR frames (RF)" --> H["MMDVM hotspot<br/>MMDVMHost"]
    H -- "YSF frames<br/>(UDP, localhost)" --> G["YSFGateway<br/>acts as the node"]
    G -- "YSF protocol<br/>UDP 42000" --> Ref[("YSF / FCS<br/>reflector = 'room'")]
    G -. "replies" .-> H -. "Data FR frames (RF)" .-> R

This post is about the first half, the part you can actually see on the air, and which every radio and hotspot has to agree on. Everything here was written to match YSFGateway’s CWiresX class, by Jonathan Naylor G4KLX, which is the open-source reference most hotspots run.


What the X button can ask for

A WIRES-X conversation is always the same shape: the radio sends a short command, and about a second later the node sends back a reply. There are only a handful of commands:

CommandWhat the radio is askingNode’s reply
DX“Who are you, and what are you linked to?”Node ID, name, link status, current room, frequency
ALL“List your rooms, starting at number n”A page of up to 20 rooms
SEARCH“List rooms whose name contains this text”A page of matching rooms
CATEGORY“List the rooms in this category”A page of rooms
CONNECT“Link to room nnnnn”Node details with the new room, or “not linked” if it failed
DISCONNECT“Unlink”Node details with status “not linked”

When you press [X] on a Fusion radio, it sends DX first. That’s why the radio shows the node’s name and the room you’re on before you’ve done anything else.


Layer 1 — riding on Data FR frames

WIRES-X doesn’t have its own modulation or frame format. It borrows Fusion’s Data FR (“data full rate”) mode, which is one of the four payload layouts the FICH can announce (DT = 1). Voice modes fill the frame with AMBE+2 speech. Data FR fills it with two 20-byte data channels, DCH1 and DCH2, and nothing else.

Diagram of a YSF Data FR frame. 960 bits in 100 milliseconds: a 40-bit sync, a 200-bit FICH, then five sub-blocks each holding 72 bits of DCH1 and 72 bits of DCH2. Below, the chain for one data channel: 20 bytes are whitened, a 16-bit CRC and 4 tail bits are added to make 180 bits, a rate one half convolutional code doubles that to 360 bits, which are interleaved and split into five 72-bit pieces.

Every frame is 120 bytes: 960 bits, sent as 480 four-level symbols at 4800 symbols per second, so exactly 100 ms. That gives WIRES-X 40 bytes of payload per frame, or 3.2 kbit/s. It’s slow by internet standards, but plenty for short commands and a room list.

⚙ Under the bonnet — coding one data channel

qradiolink’s YSFEncoder::writeDataFRModeData() (a port of MMDVMHost’s CYSFPayload) does this for each 20-byte channel:

  1. Whitening. XOR the 20 bytes with a fixed mask, 93 D7 51 21 9C 2F 6C D0 EF 0F F8 3D F1 73 20 94 ED 1E 7C D8. Command data is full of spaces and repeated bytes. Whitening breaks those patterns up so the symbol stream doesn’t sit on one level for long, which would upset the receiver’s clock recovery and DC offset.
  2. CRC. Add a 16-bit CRC-CCITT over the 20 whitened bytes, giving 22 bytes, then a zero byte, of which 4 bits are used as tail bits to flush the encoder: 180 bits.
  3. Convolutional code. Rate ½, constraint length 5, the same code as the FICH: 360 bits.
  4. Interleave. A 9 × 20 table spreads neighbouring bits across the frame, so a short fade damages a few bits in many places rather than many bits in one place.
  5. Place. The 45 coded bytes go into the frame as five 9-byte pieces. DCH1 and DCH2 alternate: after the 5-byte sync and 25-byte FICH, the frame is five repeats of 9 bytes DCH1, 9 bytes DCH2.

On receive, MMDVMHost runs this backwards and checks each CRC separately. A frame can lose DCH1 and still deliver DCH2. YSFGateway refuses to accept any frame whose CRC fails, which matters later.


Layer 2 — a WIRES-X transmission

A WIRES-X command is a complete, normal Fusion transmission: a header frame, some communications frames, and a terminator. Each frame’s FICH says which it is, and the hotspot treats it like any other over until it sees Data FR frames carrying a command.

FrameFICHDCH1DCH2
HeaderFI = headerCSD1CSD2
Comm 0FI = comm, FN = 0CSD1CSD2
Comm 1FI = comm, FN = 1CSD3message bytes 0–19
Comm 2 … 7FI = comm, FN = 2…7next 20 bytesnext 20 bytes
TerminatorFI = terminatorCSD1CSD2

The CSD (“callsign data”) blocks say who’s talking. In a WIRES-X command, CSD1 is ********** (ten asterisks, meaning “everyone”) followed by the sending station’s 10-character node name. CSD2 is the operator’s callsign. CSD3 is spaces.

The FICH fields that matter here:

  • DT = 1: this is Data FR. YSFGateway ignores WIRES-X processing for anything else.
  • FN / FT: frame number, and the number of the last frame in the message. A command fitting in 20 bytes has FT = 1. One needing 60 bytes has FT = 2, and so on. When the receiver reaches FN == FT, it knows the message is complete.
  • BN / BT: block number and block total, for messages longer than one block of 8 frames (see below).
  • SQ: the DG-ID. qradiolink stamps its configured DG-ID here, the same as on voice.

⚙ Under the bonnet — long messages and the 260/259 rule

One block is 8 comm frames, FN 0 to 7. Comm 0 carries only CSD, comm 1 carries 20 message bytes, and comms 2 to 7 carry 40 each, so block 0 holds 260 bytes.

If a message is longer, the next block starts again at FN 0 with BN incremented. In every block after the first, comm 1’s DCH2 starts with a 0x00 byte, so it carries only 19 message bytes: 259 per block. That’s why both YSFGateway and qradiolink’s WiresXEncoder::frame() start with:

if (length > 260U) { bt = 1U + (length - 260U) / 259U; length += bt; }

The length is then rounded up to 20 + a whole number of 40-byte chunks, so the last frame is always full (padding is spaces).

A full ALL reply, a page of 20 rooms, is 1,031 bytes. That’s BT = 3 (four blocks), 32 comm frames plus a header and terminator: 34 frames, 3.4 seconds of transmission. It’s the reason a room list takes a noticeable moment to arrive on your radio.


Layer 3 — the command message

Inside the data channels, every WIRES-X message, command or reply, has the same frame:

[ seq ] [ command bytes ] [ parameters … ] [ 0x03 ] [ checksum ]
  • seq is a sequence number that goes up by one with each command.
  • The command is three bytes for a request and four for a reply.
  • 0x03 marks the end of the data. The receiver finds it by scanning backwards from the end.
  • The checksum is the 8-bit sum of every byte from seq up to and including the 0x03, keeping only the low byte.
CommandRequest bytesParametersReply bytes
DX5D 71 5Fnone5D 51 5F 26
ALL5D 66 5F01 + 3-digit start number5D 46 5F 26
SEARCH5D 66 5F11 + 3-digit start + 16-character text5D 46 5F 26
CATEGORY5D 67 5Fcategory list5D 46 5F 26
CONNECT5D 23 5Fone filler byte + 5-digit room ID5D 41 5F 26
DISCONNECT5D 2A 5Fnone5D 41 5F 26

ALL and SEARCH share a command and differ only in the first two parameter characters, 01 or 11. CONNECT and DISCONNECT share a reply, and the status byte inside tells you which happened. YSFGateway’s source also notes that real radios add one more byte after the DX request, identifying the model: 2B for an FT-70D, 29 for an FTM-100D and 28 for an FT2D.

Timeline. qradiolink transmits a 200 millisecond preamble, six repeated header frames as a 600 millisecond lead-in, then the real header, communications frames 0 and 1, and a terminator, about 1.2 seconds in all. YSFGateway’s one-second timer starts at the last command frame, then the hotspot transmits its reply: header, five communications frames and a terminator, 0.7 seconds. Below, the 20 command bytes: sequence 00, command 5D 71 5F, end marker 03, checksum 30, then 14 spaces.

⚙ Under the bonnet — a CONNECT, worked through

To connect to room 12345 with sequence number 1, qradiolink’s WiresXEncoder::connect() builds:

01  5D 23 5F  20  31 32 33 34 35  03  02  20 20 20 20 20 20 20 20
seq CONNECT   fill "1 2 3 4 5"    end sum  padding to 20 bytes

Checksum: 01 + 5D + 23 + 5F + 20 + 31 + 32 + 33 + 34 + 35 + 03 = 0x202, low byte 0x02.

That’s 20 bytes, so FT = 1 and the whole command fits in comm frame 1’s DCH2. On the hotspot, YSFGateway’s CWiresX::process() stores DCH2 of FN 1, sees FN == FT, finds the 0x03, checks the sum, matches 5D 23 5F, and reads the room ID from byte 5. It skips byte 4, the filler.

An 8-bit sum is a very weak check on its own: swap two bytes and it won’t notice. It doesn’t need to be strong, because each 20-byte channel has already passed its own CRC-CCITT. The sum just confirms that the message was reassembled from the right frames.


Layer 4 — the node’s replies

YSFGateway doesn’t answer straight away. Each command starts a 1-second timer, and the reply goes out when it expires. That gives the radio time to drop out of transmit and start listening. A CONNECT also starts a 3-second busy timer, during which the gateway is linking to the reflector.

The DX reply is 129 bytes. Laid out by byte offset:

BytesContents
0Sequence number
1–45D 51 5F 26 (DX reply)
5–9The node’s 5-digit WIRES-X ID
10–19Node name (callsign)
20–33Node description
35Status: 0 offline, 1 busy, 2 not linked, 3 linked
36–40Linked room’s ID (if status is 3)
41–56Room name, 16 characters
57–59Number of stations in the room
70–83Room description
84–106Frequency, e.g. 00434.000000-000.000000 (TX frequency, then the repeater shift)
1270x03 end marker
128Checksum

The CONNECT and DISCONNECT replies use the same layout with a different command. The ALL reply lists rooms instead. After the header and node details, bytes 22 to 27 hold two 3-digit numbers, the page size (20) and the total number of rooms. Then come the rooms, 50 bytes each:

Bytes in entryContents
05 (marks a room entry)
1–5Room ID
6–21Room name, 16 characters, upper case
22–24Stations connected
35–48Description, 14 characters
490x0D (carriage return)

The page is always padded to 20 entries, so every ALL reply is the full 1,031 bytes and 3.4 seconds long, even if the node only has three rooms.

⚙ Under the bonnet — decoding a reply

qradiolink’s WiresXDecoder mirrors the encoder:

  • A header frame resets the buffer.
  • Comm FN 0 is ignored (CSD only).
  • Comm FN 1 contributes DCH2: 20 bytes in block 0, or 19 bytes after the leading 0x00 in later blocks.
  • Comm FN 2–7 contribute DCH1 and DCH2, 40 bytes each.
  • On the terminator, it scans backwards for 0x03, checks the sum, matches the 4-byte reply code, and pulls out the fields at the offsets above.

It also copes with joining a reply part-way through, by starting to collect as soon as a comm frame arrives.


Where do room numbers come from?

On Yaesu’s network, room and node IDs are issued by Yaesu when you register. An MMDVM hotspot has no Yaesu registration, so YSFGateway makes the open reflector list look like WIRES-X rooms. Every reflector in the YSF host list has a 5-digit ID, and that’s what appears on your radio as a “room”. When you CONNECT to 12345, YSFGateway looks the ID up, then links to that reflector using the YSF network protocol (YSFP polls, YSFD data, YSFU unlink, on UDP port 42000), as described in the C4FM post. A few low numbers are reserved for special entries. FCS rooms are listed in the same way.

Some reflectors understand WIRES-X themselves, XLX reflectors for example, which list their modules as rooms. For those, YSFGateway has a pass-through mode: it forwards DX, ALL and CONNECT commands to the reflector and lets the reflector answer, handling only DISCONNECT locally.


The new code is in four places:

  • src/YSF/wiresxencoder.cpp builds DX (info), CONNECT, DISCONNECT, ALL and SEARCH bursts: the message, the checksum, the 260/259 framing, the CSD and FICH for every frame. It’s a port of YSFGateway’s own reply-building code, run in the opposite direction.
  • src/YSF/wiresxdecoder.cpp reassembles and parses the node’s replies.
  • gr_modem::transmitC4FMWiresX() puts a burst on air.
  • RadioController::sendWiresX() keys the transmitter, tunes it and sets the power.

With remote control enabled, you drive it over qradiolink’s telnet control port (4939 by default):

wiresx info 0             # DX: who is the node, and what is it linked to?
wiresx list 0             # ALL: the room list
wiresx search HUB         # SEARCH: rooms whose name contains "HUB"
wiresx connect 00014      # CONNECT to room 00014
wiresx disconnect 0       # DISCONNECT

The decoder sits in qradiolink’s C4FM receive path. Every received frame with DT = 1 (Data FR) goes into WiresXDecoder, and when a complete, checksum-valid reply has been put back together, qradiolink prints it in the log, in the GUI’s text area, and back to the telnet session that sent the command. Here’s a real exchange with my WPSD hotspot:

qradiolink> wiresx info 0
Sending Wires-X info  over C4FM (reply shows in the qradiolink log)

qradiolink> Wires-X INFO: node MW0AXD-Y (45409) MW0AXD_WPSD - linked to room 00014 GB-HUBNET

Every field in that last line came over the air inside the 129-byte DX reply described above:

ShownReply bytesField
MW0AXD-Y10–19Node name
454095–9Node’s WIRES-X ID
MW0AXD_WPSD20–33Node description
linked35Status 3
0001436–40Linked room’s ID
GB-HUBNET41–56Room name

That’s about 2.5 seconds from typing the command to seeing the answer: roughly 1.2 s for qradiolink’s transmission, 1 s for YSFGateway’s timer, and 0.7 s for the reply.

The command bytes were also checked against an off-air recording of a real Yaesu FT2D sending CONNECT. qradiolink’s encoder produces the same layout (5D 23 5F, the filler byte, the 5-character room ID, 0x03), and the same checksum the FT2D sent, 0x9D.

What it took to get the hotspot to listen

Getting the bytes right was the easy part. The harder part was getting a gated SDR transmitter to deliver them cleanly. qradiolink keeps the bladeRF’s transmitter idle between overs, so every transmission starts from cold, and a WIRES-X command is very short. A DX command is only four frames, 0.4 seconds. Voice worked because a voice over lasts for seconds and the first few frames don’t matter. A WIRES-X command has no spare frames.

  • The preamble. Each burst starts with 240 bytes of 0x77, 200 ms of the outermost symbols alternating (+3, −3, +3, −3). It gives the hotspot’s demodulator a strong, regular signal to lock its clock and levels to.
  • A header lead-in. Even with the preamble, the hotspot logged only “received RF header … end of transmission”. It saw the header and terminator but lost the comm frames in between, because they arrived while it was still acquiring frame sync. The fix is to send the header frame six times before the real burst. That adds 600 ms of valid Fusion frames for the modem to lock on to, and YSFGateway ignores header frames when looking for commands, so the extras are harmless.
  • One over, not several. Real Yaesu radios seem to repeat WIRES-X commands, so an early version sent the whole burst several times in one transmission. MMDVMHost dropped the lot, because a new header straight after a terminator in the same carrier isn’t a valid Fusion transmission. The burst now goes out once.
  • The right frequency and power. The WIRES-X path has to apply the same per-mode C4FM frequency offset and TX power as voice. Without them the burst went out almost silent, or slightly off frequency, and the hotspot heard nothing.
  • Don’t break voice afterwards. The first version switched the transmitter fully off after each command, which left voice PTT disabled. It now returns the transmitter to exactly the state it was in before.

The result: wiresx connect from qradiolink changes rooms on the air, and wiresx info reads back the node’s status, with no Yaesu radio involved.


Summary

  • WIRES-X on the air is just Fusion data. Commands and replies are ordinary C4FM transmissions in Data FR mode: 40 bytes per 100 ms frame, each 20-byte half protected by CRC-CCITT, a convolutional code and interleaving.
  • Messages are simple. A sequence number, a 3- or 4-byte command, parameters, 0x03 and an 8-bit sum. Long replies span several 8-frame blocks, using the 260/259-byte rule.
  • The node answers after a second. DX gives the node’s status and room in 129 bytes. A room list is always 1,031 bytes, 3.4 seconds on air.
  • On a hotspot, “rooms” are open reflectors. YSFGateway plays the part of a WIRES-X node and links to YSF and FCS reflectors by their 5-digit IDs.
  • The hard part was RF, not protocol. Short bursts from a cold, gated SDR need a preamble and a header lead-in before a hotspot will hear them.

Share :

Related Posts

The HotSpotRadio-USB: a Filtered AllStar Node

The HotSpotRadio-USB: a Filtered AllStar Node

Back in Building a Shari Node for Allstar we put together a low-power personal AllStarLink node around the SA818 radio module — a Raspberry Pi, a USB sound fob and a bare SA818. This time we’re looking at a tidier, ready-made take on the same idea: the HotSpotRadio-USB from hotspotradios.com, designed by Marshall (KE6PCV).

Read More
Teaching qradiolink to Speak D-STAR and Fusion

Teaching qradiolink to Speak D-STAR and Fusion

How a laptop, a bladeRF and a lot of HackRF recordings got two digital voice modes on the air.

Read More
Introduction to APRS and Direwolf

Introduction to APRS and Direwolf

APRS (Automatic Packet Reporting System) is a way of sending short pieces of data over radio: positions, weather reports, status messages and short text messages. Every station on the same frequency hears every packet, and any of them can pass it on. Many of those packets end up on the internet, where anyone can see them on a map at aprs.fi.

Read More