11 February 2022

112-bit period stream To 5N1 frames (just for fun)

I recently re-thinked to the odd 112-bit period stream sent by UK MoD via STANAG-4285 and described  here, more than anything else I was intrigued by the "stuff" used for the manipulation of the streams. Looking at the bitstream of figure 1, one can see that either the sync sequence and the Initialization Vectors are 16 times bitwise expanded, thus that "stuff" shall sit in the middle between the crypto device and the STANAG-4285 modem, assuming that it is not embedded or implemented in one of the two devices. 

Fig. 1

During the receive phase it shall perform a downsampling of the received 112-bit period stream by a factor of 16 while in the transmit phase it will expand the source 5N1 frames bitwise by the same factor: in a few words, in some way the stuff acts like a multiplexer/demultiplexer (figure 2).

Given that:
Z = serial input/output 
Yn = input/output channels

Tx side (expander):
each input bit is applied to all the input channels and their selection speed is 16x the speed of the input bits, ie:
bit 00 → Y0,Y1,Y2,...,Y15 → Z
bit 01 → Y0,Y1,Y2,...,Y15 → Z
...
bit 15 → Y0,Y1,Y2,...,Y15 → Z

this way each input bit is 16 times transferred into the serial output and thus performing the 16x expander.

Rx side (downsampler):
The selection of the output channels is in sync with the input bits (same speed), ie:
bit 00 → Y0
bit 01 → Y1
...
bit 15 → Y15

since all the sixteen bits have the same value (1 or 0), it turns out that draining the output only from Y0 (or from any other single channel) we get the needed downsampling by 16.

Fig. 2

I started thinking about how that "stuff" could be implemented: software or wired-logic solution. The software solution is easy to code and may be based on a PC as well as on Single Board Computers such as Raspberry Pi or Banana Pi or also on microcontrollers as Arduino, obviously the serial interfaces are needed. Just as a Proof of Concept, and  to have some fun, I decided to to demonstrate the wired-logic feasibility with multiplexer/demultiplexer breakout board module CD74HC4067 and two Arduino boards connected via I2C communication bus in the Master-Slave configuration (1). 
 
In the downsampler Rx configuration (figure 3), one Arduino board ("Uno") acts as Slave and it's requested to send the 112-bit period stream, this board represents the output of the S4285 modem; the second Arduino board ("Mega2560") is the master and drives the dmux CD74HC4067:
• requests data to the slave and forwards them to the dmux serial input 
• selects the output channel Yn through the address bus S0-S3
• withdraws the Y0 output and forwards it to a LED (ie the following crypto device)
The master board also controls the HD44780 LCD which is added to display the received 5N1 frames after their downsampling ...almost useless since data are dispalyed on the serial ports (COM3 on the sender, COM4 on the receiver: see figure 5).
 
 
Fig. 3 - Downsamnpler Rx connections


Fig. 4 - downsampler at work

Fig. 5 - serial port monitor of sender (COM3) and dowsampler (COM4)

As aforementioned, this post is not intended to build the conversion circuit 112-5N1 but to simulate its operation through the use of a simple demultiplexer ... and to have some fun. In a next post I will also try the reverse operation 5N1-112 but always using the module CD74HC4067 this time as a multiplexer. By the way, I used the CD74HC4067 as it can be used both as a multiplexer and as a demultiplexer, in this circuit it can be replaced with the SN74154 (dmux only).  
 

 

(1) The I2C communication bus is very popular and broadly used by many electronic devices because it can be easily implemented in many electronic designs which require communication between a master and multiple slave devices or even multiple master devices. The easy implementations comes with the fact that only two wires are required for communication. The two wires, or lines are called Serial Clock (SCL) and Serial Data (SDA).  The SCL line is the clock signal which synchronize the data transfer between the devices on the I2C bus and it’s generated by the master device. The other line is the SDA line which carries the data.

No comments:

Post a Comment