# Physical layer

The data transport consists of a bidirectional, redundant ring system.
Fig.4: Principle of bidirectional data transport
It carries main audio data, monitor audio data and status data from the distributed inputs to the data collector and audio data and control data from a data collector to the distributed inputs.
One input will be the first who receives data from both sides. He will ignore one side and send his data to the other because the received data is redundant. If the flow of control and music data fails, the previous ignored side will be checked for valid data. With this mechanism it is possible to detect single defects – and blank them out!
The audio data shall be at 48kHz sampling rate. A Codec needs 256*48kHz = 12.288Mhz bus clock. It shall be possible to find an UART working with 6144 kBaud bus clock with a standard 8-bit coding. So 12 Bytes per frame can be used: 3 left main 3 right main, 6 monitor.
Beside of the data, the distributed inputs are supplied with DC voltage of 48V. This makes it necessary to use DC/DC converter modules in the inputs, but reduces the current flowing over the supply wire. If necessary, more than one power supply in the physical ring can be used in parallel to power the inputs.
Fig. 5: Power and data flow in a distributed system

# Connector system

The practical implementation of a ring is rather nasty and not suitable for a quick on-stage installation. Nevertheless, only the ring is really fault tolerant against broken wires.
A single wire with a simple plug which can be plugged-in somewhere on the stage and the connection is always correct is much easier to use as a double connected ring.
The compromise: Stage boxes (as many as required) are connected as a ring, the distributed inputs are connected to them. Even more, chains of distributed inputs shall be possible.

## Sockets and connectors for distributed inputs

For keeping the data ring closed it is necessary to have female connections which have bypass switches: With the connector plugged in, the physical ring is looped-through the input, without connector, the physical ring is closed. Short circuits during plugging would disturb data flow or, even worse, brake down supply and reset the whole system which will lead to audible black outs. One connection system which fulfils the needs of bypass switch and shortcut free plugging is the German TAE analogue telephone connection (see Wikipedia TAE connector). (The Austrian telephone sockets have more pins, so redundancy for power supply would be possible. But often they have not all contacts (Only 6) - and they are more expensive.)
* Fig. 6: TAE connector
* Fig.7: TAE socket
The TAE socket has 6 contacts. Contacts 1-6 and 2-5 are closed via switch in the female connector if no connector is plugged in. Contacts 3-4 don’t have this feature. The contacts are not gold plated – but for a short-term use like on-stage there is no time for oxidation. And the plugs are not too small and sensitive, the cable outlet is protected – even more suitable for use on-stage. The coding “F” shall be used. (other connectors? Well, there must be a bypass switch, so the USA telephone or network sockets don’t work. Nevertheless, better solutions are welcome.)
Very important in this system is ground and supply. Pin 3 has positive 48V, Pin 4 is connected to ground. The two signal wire pairs on Pin 1/2 and 5/6 are used bidirectional. So it is possible to detect a broken link and use the other signal path. If the distributed inputs are equipped with a socket (to create chains) it is necessary to change the signal direction (left side of the ring – right side of the ring). So every two inputs the signal is repeated – and not only bypassed a lot of times. This enhances signal transfer stability even in long chains because the inputs act as a signal repeater.
Shielded cables are necessary for the interconnection. Proposal: symmetrical network wires with a RF impedance of 100 ohms are used. Between stage box and input, a 4 pair network wire may be used: 2 pairs for data communication, the others for supply. May be an USB 3.0 wire (with 3 pairs plus supply wires) is also suitable, but it has an impedance of 90 Ohms.

## Sockets and connectors for the stage boxes

The stage boxes consist mainly from the telephone standard socket “F F”, which has 2 outlets. Two connectors can be plugged in. With the standard “NFN” telephone socket, pin 3 and 4 cannot be accessed separately for adding (PTC-) fuses. Only the single “F” and the double “F F“ socket give this possibility. (In fact, it is possible to cut off the coding nozzle from the connector – and then it is possible to use N or F connector in N or F sockets).
The data transfer from and to the data collector shall be done via 100 ohms network wires. Only one pair is required - so the other three may carry the 48V supply. Alternatively, a 1 pair network wire and a 1 pair supply wire with large copper diameter may be used.
The power lines are critical to short circuits, so a reasonable distance between 48V and GND is necessary. Having up to 254 distributed inputs with a power consumption of 2W each will result in a total power consumption of 508W. So, the power lines in the stage box ring have to withstand up to 10.6A. The telephone “F” connectors are limited to about 0.5A. For protection against overload, PTC resistors (poly switch fuse) shall be used in the stage box to limit the output current to 0.5A. So the length of every input chain (power consumption 2W each) is limited to 12. The number of stage boxes is not limited. For power connection and data XLR-connectors with 4 poles are recommended. (Better solutions are welcome.) Pin 4 (near marking) is used as GND, pins 2+3 are used for data, and pin 1 carries 48V. So, the distance between GND and 48V is maximum.
4-Pole-XLR_connector for connecting the stage boxes to a ring

# Complete wiring diagram

This scetch describes the complete wiring diagram for power supply, data collector, stage box, distributed input with socket and remote mixing console:
Fig. 11: Example of the wiring diagram of the ChoirWire

# Electrical data transmission and reception

The data wires are used bidirectional. So the transceiver has to blank-out his own sent signal analogue. Even more, it is recommended to use a magnetic transformer. So together with galvanic isolated DC/CD converters (48V to 5V) it is easy to make the distributed inputs galvanic isolated. Disturbances from mains will be reduced to a minimum. The data transfer rate will be 48kHz * 128bits = 6.144MBit, so the necessary band with of the transformer is (6.144MBit / 10Bits/byte =) 614kHz to (6.144MBit/2Bit * 5 =) 15.36 MHz. (at least 6.144MBit/2Bit*3 = 9.216MHz). For eliminating the DC offset, a kind of "Alternate mark" RZ coding is used. In an UART-like communication the idle level on the signal wire is high, the active level is low. So a "silent" line is high (idle) for the UART, means that there are no transmission pulses on the communication wire.
Implementation example: The generation of an alternating signal is done with a divider (D-FlipFlop), which flips at every sent low signal. Disadvantage is, that the transmission clock is needed. A standard SPI output of a micro controller can do this. With a tristate line driver and three resistors, the three voltage levels are generated. In tristate (SPI-TX signal high), a medium voltage is applied to the transceiver amp. If the SPI-TX signal is low, the flip flop level is output. The transceiver shall output the serial signal with an impedance of about 90 Ohms. Because of the wire and receiver impedance and the output swing of a video amplifier, the voltage swing on the signal wire is 1Vpp. An differential amplifier is mixing the transmitted and received signal to the receive channel so that the own sent signal is eliminated. A window comparator circuit (with small hysteresis) detects a "voltage around zero" (<40% of input swing) of a "voltage present" (>60% of input swing). Via OR (here with diodes and pullup), a UART compatible signal for the micro is generated to receive data.
Fig. 12: Transceiver example

# Logical data transfer

There are two data directions:
- the Control & monitor data from the Data collector to the distributed inputs and
- the Status & music data from the distributed slaves to the data collector.

## Data transfer

This description is valid for both directions: From inputs to data collector and vice versa.
There are 128 bit times for data transmission in one 48kHz cycle. So 12 Bytes with 1start bit, 1stop bit and 8 data bytes can be transmitted,
LSB first (standard UART).
The distributed inputs receive the music data (main and monitor) from the predecessor and add their own music data to it. The transmission starts with the LSB first. So it is possible to reduce the delay to one bittime per distributed input, if a logic device is
used: Receive the LSB from the previous input, add own LSB, and send it out. (Example: data rate 48kHz * 128bits = 6144kb/s --> Bittime is 0.1627µs = Delay per input --> 41.65µs delay for 256 inputs archeivable.)
The data collector adds the music data from the left and the right physical ring and has then the complete music data. The complete music data are then sent back via the two signal wires to the physical ring. So, everywhere in the net, the reception of the main mix output and 2-4 monitor channels is possible. ("Virual x-bars")
To give a maximum of flexibility to quality, four transmission modes are selectable:
| Mode | main channels | monitor channels | sum of channels |
| 0 (default) | 16bit L, 16bit R | 2x15bit, 2x16bit | 6 channels |
| 1 | 23bit L, 23bit R | 2x24bit | 4 channels |
| 2 | 23bit L, 23bit R | 3x16bit | 5 channels |
| 3 | 23bit L, 23bit R | 4x12bit | 6 channels |
Within the music data, two control bits are integrated. So 96kBits control data per second can be transmitted. It is mandatory, that the data bits have allways the same position. After Reset, when the mode is not known, the main channels are used with 16bits with. The monitor channels need a few milliseconds. The monitor channels are ignored (no signal output) until the input has received a configuration command (7).
Mode 0 (default):
| byte1 | byte2 | byte3 | byte4 | byte5 | byte6 | byte7 | byte8 | byte9 | byte10 | byte11 | byte12 |
| Mon1_LSB | Mon1_MSB | Mon2_LSB | D1+Mon2 | mainL_LSB | mainL_MSB | Mon3_LSB | Mon3_MSB | Mon4_LSB | D2+Mon4 | mainR_LSB | mainR_MSB |
| b7..b0 | b15..b7 | b7..b0 | D1,b14..b8 | b7..b0 | b15..b8 | b7..b0 | b15..b7 | b7..b0 | D2,b14..b8 | b7..b0 | b15..b8 |
Mode 1:
| byte1 | byte2 | byte3 | byte4 | byte5 | byte6 | byte7 | byte8 | byte9 | byte10 | byte11 | byte12 |
| Mon1_LSB | Mon1_mid | Mon1_MSB | D1+mainL | mainL_mid | mainL_MSB | Mon2_LSB | Mon2_mid | Mon2_MSB | D2+mainR | mainR_mid | mainR_MSB |
| b7..b0 | b15..b8 | b23..b16 | D1,b6..b0 | b14..b7 | b22..b15 | b7..b0 | b15..b8 | b23..b16 | D2,b6..b0 | b14..b7 | b22..b15 |
Mode 2:
| byte1 | byte2 | byte3 | byte4 | byte5 | byte6 | byte7 | byte8 | byte9 | byte10 | byte11 | byte12 |
| Mon1_LSB | Mon1_MSB | Mon2_LSB | D1+mainL | mainL_mid | mainL_MSB | Mon2_MSB | Mon3_LSB | Mon2_MSB | D2+mainR | mainR_mid | mainR_MSB |
| b7..b0 | b15..b8 | b7..b0 | D1,b6..b0 | b14..b7 | b22..b15 | b15..b8 | b7..b0 | b15..b8 | D2,b6..b0 | b14..b7 | b22..b15 |
Mode 3:
| byte1 | byte2 | byte3 | byte4 | byte5 | byte6 | byte7 | byte8 | byte9 | byte10 | byte11 | byte12 |
| Mon1_LSB | Mon2/Mon1 | Mon2_MSB | D1+mainL | mainL_mid | mainL_MSB | Mon3_LSB | Mon4/Mon3 | Mon4_MSB | D2+mainR | mainR_mid | mainR_MSB |
| b7..b0 | b3..b0/B11..b8 | b11..b4 | D1,b6..b0 | b14..b7 | b22..b15 | b7..b0 | b3..b0/B11..b8 | b11..b4 | D2,b6..b0 | b14..b7 | b22..b15 |

## Data transfer with the two data bits 1+2

Prior goal is to transfer music and not to transfer unnecessary data. So this 96kB/s is used as an asynchronous data transfer: The data stream consists of the content of consecutive data bits D1-D2-D1-D2-D1-D2-D1-D2 and so on. The idle state is logic‘1’. A data transfer is started by a start bit transition to ‘0’. Then the 8 bit data content is sent byte by byte, LSB
first, to simulate a standard UART protocol. So it is easy to route the transmitted/received data bits to general IO ports where they can be received/transmitted by other standard UARTs. For adjusting all possible 256 inputs with a new volume value and letting 10Bits sync pause, this will take (256 x 40Bits ./. 96kBit/s = )
107ms. This is fast enough, especially if only the inputs in use are addressed.

### Control data transfer from data collector to inputs

| Byte1 | Byte2 | Byte3 |
| Address of the distributed input | Parameter switch | Parameter value |
Fig.13: data bytes for control messages
For the reason of compatibility the following parameter switches must have the same meaning and are mandatory for all ChoirWire nodes:
| Parameter (Byte2) | Meaning (of Byte3) | Value range | Value range physical |
| 0 | Master volume left | 0, 1..255 | OFF, -76.2dB…0dB in 0.3dB/bit |
| 1 | Master volume right | 0, 1..255 | OFF, -76.2dB…0dB in 0.3dB/bit |
| 2 | Monitor 1 volume | 0, 1..255 | OFF, -76.2dB…0dB in 0.3dB/bit |
| 3 | Monitor 2 volume | 0, 1..255 | OFF, -76.2dB…0dB in 0.3dB/bit |
| 4 | Monitor 3 volume | 0, 1..255 | OFF, -76.2dB…0dB in 0.3dB/bit |
| 5 | Monitor 4 volume | 0, 1..255 | OFF, -76.2dB…0dB in 0.3dB/bit |
| 6 | Solo volume addon | -128…0…127 | -38,4dB…0dB…+37,8dB 0,3dB/bit |
| 7 | Select Feedback | 0 1 2 3 4 5 6 7 | VU average of main left + right VU Main left VU Main right VU Monitor 1 VU Monitor 2 VU Monitor 3 VU Monitor 4 Power supply (0..31 = 80..100%) |
| 8 | Configuration | bit1, bit0 bit2 bit3 | 00 = 4 monitor channels 12bit 01 = 3 monitor channels 16bit 10 = 2 monitor channels 24bit 11 = monitor channels off Switch on solo volume offset and solo lamp signalize addressing request |
| 9 | Low pass adjust | -128…0…127 | -100%...0%...+100% |
| 10 | Middle adjust | -128…0…127 | -100%...0%...+100% |
| 11 | Middle frequency | 0..255 | 200Hz…5000Hz |
| 12 | High pass adjust | -128…0…127 | -100%...0%...+100% |
| 13 | reserved | | |
| 14 | reserved | | |
| 15 | reserved | | |
| 16 ... 63 | Free range for special use | | |
| 64 ... 255 | reserved for future use | | |
Fig. 14: Table with possible parameters

### Status data transfer from inputs to data collector

The last addressed input answers with his Address, all other inputs keep silence.
| Byte1 | Byte2 |
| Address of last addressed input | selected answer |
The coding of byte 2 is difficult, but ensures fast reaction.
| Bit7 | Bit6 | Bit5 | Bit4... Bit0 |
| NoAnswer from next input (broken wire) | Solo addon switch On or Off | TBD | actual signal level: 0…31 = -75.6dB….0dB of maximum output level, 2.4dB per bit. |
The data from the predecessor have to be buffered in the inputs to avoid data collisions due to transfer times. If a data transfer from the predecessor is running, the input must wait with the transmission of its data. If an input is transferring status data, the data of the predecessor is buffered in a FIFO buffer. Also the data collector has to buffer the data coming from the left or right arm of the physical ring. The data to inputs are longer (3Bytes) than the feedback data (2Byes). So there is enough time to transmit all the data – but buffers are needed to handle collisions due to delay times.

## Start of communication and synchronisation

The communication starts from the data collector in both directions (left and right ring arm). Because the idle phase of the data stream is shorter than a byte, every 2nd frame is sent only.
Fig.15: Sync step 1
If the start of communication is recognized correctly, the music data is sent back with half speed. So, the Data collector (or precedent distributed input) can synchronize.
Fig.16: Sync step 2
If and as long the Data collector has correct communication, he starts sending every frame. If there has been silence on the other side of input 2,3, it starts transmitting the control flow for the next input block.
Fig.17: Sync step 3
Because of the full speed transmission of the Data collector, the input 2 and 3 send back with full speed. The Input1will receive data from both side, so no “idle side” is found. It has to decide for one direction. The first correct received frame will fix this. The time difference may come from line delay or program sequence. In this example the left ring was first.
Fig.18: Sync step 4
For Input 1, there is correct data on both sides, so it knows that the ring is closed. After receiving the control data with full speed, it sends back to the left side only, but also with full speed.
Fig.19: Sync step 5
The state transitions of sync and data transfer as state chart:
Fig.20: state transition diagram
* “Data received” means a full 12 byte frame received without stopbit errors.

## Mixing console data transfer

For the data transfer from the data collector to the mixing console, a standard audio wire with 3 pin XLR connectors can be used. Alternative, Sub-D connectors with 9 pins are provided so a RS232 null modem cable can be used.
Fig.21: XLR connector Fig.22: RS232 null modem cable
The female connector is on the mixing console, the male connector in the data collector. Pin 1 is connected to ground, pin 2 is used for data transfer from mixing console to data collector, Pin 3 for data transfer from data collector to mixing console.
Sub-D 9pin male on data collector: Pin 5 is connected to ground, pin 2 is RX and used for data transfer from mixing console to data collector, pin 3 is TX and used for data transfer from the data collector to mixing console.
The simple RS232 levels shall be used there for the 96kBaud signals with the known standard levels. So a laptop (with USB to COM adaptor) can be used as mixing console as a software solution. For a better handling, a mixing console with buttons and slider will be more suitable on stage to control the distributed inputs.