Digital Communication over BNC cable

BNC Connector

Common signal voltages: +1Vdc, +5Vdc, +10Vdc, +15Vdc, +28Vdc, and a few others up to about +100Vdc.
But for this chat I'm going to assume +5Vdc only.

Simply put, bits of data get streamed through the center signal wire over time.

But it actually takes time to change voltage, so it's not a square wave. The transition time between bits is called the 'attack time'.

Any voltage above a certain threshold point is considered a 1
any voltage below a certain threshold point is considered a 0
The digital output doesn't change state unless the voltage passes either the above the upper threshold, or below the lower threshold

But after a signal goes through a wire, it's a little messier.
But if you give it a long enough attack time, and a long enough data time, it's readable.

The slope in the above is the attack time, during which no state should be interpreted.

So, engineers design cable such that 95% of the time, after waiting the attack time, that during the data time (using the threashold technique), they'll get good data.
The rest they leave to error correction.

Error Correction using Hamming(11,7) code

(Exerpted from wikipedia)

This is enough information to detect and correct a single bit error and at the same time detect (but not correct) a double bit error.

Consider the 7-bit data word "0110101". To demonstrate how Hamming codes are calculated and used to detect an error, see the tables below. They use d to signify data bits and p to signify parity bits.

Firstly the data bits are inserted into their appropriate positions and the parity bits calculated in each case using even parity.

Calculation of Hamming code parity bits
p1 p2 d1 p3 d2 d3 d4 p4 d5 d6 d7
Data word (without parity): 0 1 1 0 1 0 1
p1 1 0 1 0 1 1
p2 0 0 1 0 0 1
p3 0 1 1 0
p4 0 1 0 1
Data word (with parity): 1 0 0 0 1 1 0 0 1 0 1

The new data word (with parity bits) is now "10001100101".

We now assume the final bit gets corrupted and turned from 1 to 0.
Our new data word is "10001100100";
and this time when we analyse how the Hamming codes were created we flag each parity bit as 1 when the even parity check fails.

Checking of parity bits (switched bit d7 highlighted)
p1 p2 d1 p3 d2 d3 d4 p4 d5 d6 d7 Parity check Parity bit
Received data word: 1 0 0 0 1 1 0 0 1 0 0
p1 1 0 1 0 1 0 Fail 1
p2 0 0 1 0 0 0 Fail 1
p3 0 1 1 0 Pass 0
p4 0 1 0 0 Fail 1

The final step is to evaluate the value of the parity bits (remembering the bit with lowest index is the least significant bit, i.e., it goes furthest to the right). The integer value of the parity bits is 11, signifying that the 11th bit in the data word (including parity bits) is wrong and needs to be flipped.

p4 p3 p2 p1
Binary 1 0 1 1
Decimal 8 2 1 S = 11

Flipping the 11th bit changes 10001100100 back into 10001100101.

Removing the Hamming parity codes gives the original data word of 0110101.

Finally, suppose two bits change, at positions x and y. If x and y have the same bit at the 2k position in their binary representations, then the parity bit corresponding to that position checks them both, and so will remain the same. However, some parity bit must be altered, because x ? y, and so some two corresponding bits differ in x and y. Thus, the Hamming code detects all two bit errors.

A theoretical PCM example, with error correction

Decimal data to be sent: {9, 11, 12, 13, 14, 14, 15, 15, 14, 14, 13, 12, 11, 9, 7, 6, 5, 3, 2, 1, 0, 0, 0, 0, 1, 1, 2, 3, 5, 6}
Hexidecimal data to be sent: {9BCDEEFFEEDCB97653210000112356}
Hamming error code added to end {9BCDEEFFEEDCB97653210000112356081ABE180283424}
In binary, this would be {10011011 ... 00100100}
So, down the cable, this is the voltages that get sent.

This is the data that's received {9BCDEEFFEEDCB97653210000112356081ABE180283424}
Error correction is applied, resulting in this data {9BCDEEFFEEDCB97653210000112356}
Converted back to decimal for us humans, that's: {9, 11, 12, 13, 14, 14, 15, 15, 14, 14, 13, 12, 11, 9, 7, 6, 5, 3, 2, 1, 0, 0, 0, 0, 1, 1, 2, 3, 5, 6}
which, converted to Pulse Code Modulation (PCM) looks like this:

Timecode by Biphase Mark Code

The problem with the above is getting the two computers to agree on when the attack phase begins.
One way around that problem is to use Biphase Mark Code.

Every bit of the original data is represented as two logical states which, together, form a bit. Every logical 1 in the input is represented as a couple of two different bits (10 or 01) in the output. The input logical 0 is represented as two equal bits (00 or 11) in the output. Every logical level at the start of a cell in inversion of the level at the end of the previous cell. In BMC output the logical 1 and 0 are represented with the same voltage amplitude but opposite polarities. BMC coding provides a better synchronization since there is a change in the polarity at least every two bits, and since every bit of data results in a change of voltage, the clock frequency can be derived from the data, so the clocks do not need to be syncronized, nor does the clock need to be sent as a signal.

Packet data transfer, a home theatre example

One of the problems with home theatre, is that various devices take different amounts of time to process data, sometimes as much as a half a second. This can lead to lip sync time problems, where the lips move or the guns fire on the video screen up to half a second different from when they come out of the speaker.

With video, this can happen due to scalers and 3:2 pulldown and other equipment that's processing the video image -- processing which takes time.
With audio, this can be the delay it takes to decode a format such as DTS into it's decompressed multi-channel information, or artifical speaker distance delays -- processing which takes time.
One hypothetical way around this is for the dvd player to break up the information into packets, and send it early, so that each device can process it as much as it can beforehand

The timecode is in the form of hours, minutes, seconds, and frames. There are 24 frames per second, and the beginning of the movie is time zero. So the format is hh:mm:ss:fr, such as 01:59:59:23. Each frame is a 24th of a second long.

A packet consists of header information, and data the device will understand.

Thus the DVD player could send packets in this order:
The Video packets are only processed by the video hardware. The audio packets are only processed by the audio hardware. The timecode packets are processed by both the video and the audio hardware.
Notice how the timecode packets are all 1 second behind the other data. This is to give everything enough time to do pre-processing of the packet, before displaying it.
So the data over the wire could look like this, with each device storing its processed results until a timecode packet arrives giving it permission to release it:

other information

AES3 AES/EBU and S/PDIF packet encoding protocol.

Sound on Sound: PERFECT COPIES, EVERY TIME? Transferring Digital Audio Using PC Soundcards