Real-time bus
Duplex
There are two transfer directions,
- Downstream (from PC to the modules)
- Upstream (from the modules to the PC)
The upper bus levels (USB and FDX) are running full duplex and transmit up- and downstream simultaneously. The lower levels (HDX and EDG) are running half duplex and toggle between the two directions. Because of this, the net bandwidth of HDX and EDG is half compared to FDX. The FDX level is using the additional bandwidth for its real-time v-channels, which are only available on this bus level.
Any component requiring real-time v-channels must be on the FDX bus. Powerboards and Boosters are examples of components using real-time v-channels.
Bus Frame
RTB uses fixed sized frames with 1024 bytes each. The reason for large frames,
- Atomic execution across multiple devices
- Synchronous reporting of telemetric data
- Less frequent arbitrations on half duplex busses (HDX & EDG)
With an average frame rate of 120[F/s], RTB transmits 120 [kB/s] downstream and simultaneously 120[kB/s] upstream, giving a total throughput of 240[kB/s] full duplex over the FDX bus. In addition, each bus cycle addresses multiple destinations simultaneously, providing an atomic execution characteristic across multiple devices. Currently a bus cycle addresses in parallel,
- 16 Powerboards & DCC generators
- 896 track sensors
- 3 accessory devices
FDX Frame
The FDX bus sits right below the USB layer and operates full-duplex sending data in both directions simultaneously (downstream / upstream).
Since USB runs at 3 Mbps and FDX runs at 2 Mbps, I created a downstream bandwidth oversubscription of 1.5:1 at the FDX layer. This ensures that the FDX bus always has data for downstream transmission and always enough bandwidth upstream.
Bus Timing
The RTB bus is tightly integrated with the DCC protocol. This is perhaps a unique feature of the bus. Each DCC command represents a “transaction tick” on the bus. This tick is also called a “bus cycle” or “generation tick”. To efficiently use the available bandwidth, the bus transmits large frames (1 Kbyte per frame). Typically 100-120 DCC commands are generated per second and due to the coupling, RTB transmits exactly the same number of FDX/HDX/EDG bus frames. In summary, RTB frame rate depends on DCC frame rate.
Precise micro timing is important for both FDX and HDX. For this reason, the microcontrollers connected to the FDX and HDX bus must have crystal oscillators (<= 50 ppm). At the beginning of each bus cycle, all bus participants are synchronized against the bus master time. By design, the EDG bus does not require this precise timing, allowing accessory modules to run on built-in RC oscillators.
Bus Cycles
All commands sent in a single RTB frame are executed simultaneously on all bus layers (FDX, HDX, EDG). In addition, results are also sent upstream simultaneously, regardless of which bus level they were executed on. This can be described as a bus transaction across multiple bus participants.
FDX
The FDX bus level implements a 4 stage instruction pipeline,
- Fetch: Receive new frame from FDX
- Exec: Execute command
- Merge: Merge result data from HDX bus
- Post: Return result on FDX
HDX
The HDX bus level implements a 3 stage instruction pipeline,
- Fetch: Receive new frame from HDX and relay the data to EDG
- Exec: Execute command
- Post: Merge HDX + EDG result and return result on HDX
EDG
The EDG bus implements a 3 stage instruction pipeline as well,
- Fetch: Receive new frame from EDG
- Exec: Execute command
- Post: Return result on EDG
Latency
My RTB design delivers predictable, low-latency. This is a very important attribute of this layout bus as it ensures events being transmitted to and from the control station in-time.
The absolute value of round-trip latency (40ms) is not the only measure of quality. The second important metric concerns the variation in latency. And here too we see a very stable horizontal stability characteristic.
During the initial layout discovery after a system start, frame collisions may occur on the bus, which negatively affects latency. Once the discovery processing has completed, the bus transitions to its operational mode and the frame latency stabilizes between 40 and 50ms.

