Introduction: DIY Serial Line Coding Converters
Serial data communication has become ubiquitous in many industrial applications, and several approaches exist to design any serial data communication interface. It is convenient to employ one of the standard protocols i.e. UART, I2C or SPI. In addition, several other protocols exist for more dedicated applications such as CAN, LIN, Mil-1553, Ethernet or MIPI. Another option to handle serial data is to use customized protocols. These protocols are usually based on line codes. The most common types of line encoding are NRZ, Manchester code, AMI etc. [Configurable Protocol Decoding of Manchester and NRZ-Encoded Signals, Teledyne Lecroy Whitepape].
Examples of the specialized serial protocols include DALI for control of building lighting, and PSI5 which is used to connect sensors to controllers in automotive applications. Both of these examples are based on Manchester encoding. Similarly, the SENT protocol is used for automotive sensor-tocontroller links, and the CAN bus commonly used to enable communication between microcontrollers and other devices in automotive applications are based on NRZ encoding. In addition, many other complex and specialized protocols have been and are being designed using Manchester and NRZ schemes.
Each of the line codes has its own merits. In the process of transmission of a binary signal along a cable, for example, distortion can arise that can be mitigated significantly by using the AMI code [Petrova, Pesha D., and Boyan D. Karapenev. "Synthesis and simulation of binary code converters." Telecommunications in Modern Satellite, Cable and Broadcasting Service, 2003. TELSIKS 2003. 6th International Conference on. Vol. 2. IEEE, 2003]. Besides, the bandwidth of an AMI signal is lower than the equivalent RZ format. Likewise, Manchester code does not have some of the deficiencies that are inherent in NRZ code. For example, use of the Manchester code on a serial line removes DC components, provides clock recovery, and provides a comparatively high level of noise immunity [Hd-6409 Renesas Datasheet].
Therefore, the utility of the standard line codes conversion is obvious. In many applications where line codes are directly or indirectly used, the conversion of binary code is necessary.
In this Instructable, we present how to realize multiple line coding converters using a low-cost Dialog SLG46537 CMIC.
Below we described steps needed understand how the GreenPAK chip has been programmed to create the serial line coding converters. However, if you just want to get the result of programming, download GreenPAK software to view the already completed GreenPAK Design File. Plug the GreenPAK Development Kit to your computer and hit program to create the custom IC for the serial line coding converters.
Step 1: Conversion Designs
Design of the following line code converters are provided in this Instructable:
● NRZ(L) to RZ
The conversion from NRZ(L) to RZ is simple and can be achieved by use of a single AND gate. The Figure 1 shows the design for this conversion.
● NRZ(L) to RB
For conversion of NRZ(L) to RB, we need to achieve three logic levels (-1, 0, +1). For this purpose, we employ a 4066 (quad-bilateral analog switch) to provide bipolar switching from 5 V, 0 V, and -5 V. Digital logic is used to control the switching of the three logic levels by selection of 4066 enable inputs 1E, 2E and 3E [Petrova, Pesha D., and Boyan D. Karapenev. "Synthesis and simulation of binary code converters." Telecommunications in Modern Satellite, Cable and Broadcasting Service, 2003. TELSIKS 2003. 6th International Conference on. Vol. 2. IEEE, 2003].
The logic control is implemented as follows:
Q1= Signal & Clk
Q3= Clk & Signal'
The overall conversion schematic is shown in Figure 2.
● NRZ(L) to AMI
The NRZ(L) to AMI conversion also employs the 4066 IC since AMI code has 3 logic levels. The logic control scheme is summarized in the Table 1 corresponding to the overall conversion schematic shown in Figure 3.
The logic scheme can be written in the following way:
Q1 = (Signal & Clk) & Q
Q2 = (Signal & Clk)'
Q3 = (Signal & Clk) & Q'
Where Q is the output of the D-Flip flop with the following transitional relationship:
Qnext = Signal & Qprev' + Signal' & Qprev
● AMI to RZ
For AMI to RZ conversion two diodes are used to split the input signal into positive and negative parts. An inverting op-amp (or a transistor-based logic circuit) can be employed to invert the separated negative part of the signal. Finally, this inverted signal is passed to an OR gate along with the positive signal to obtain the desired output signal in the RZ format as shown in Figure 4.
● NRZ(L) to Split-phase Manchester
Conversion from NRZ(L) to Split-phase Manchester is straightforward as shown in Figure 5. The input signal along with the clock signal is passed to an NXOR gate to obtain the output signal (according to G. E. Thomas' convention). An XOR gate can also be used to obtain the Manchester code (according to IEEE 802.3 convention) [https://en.wikipedia.org/wiki/Manchester_code].
● Split-phase Manchester to Split-phase Mark code
The conversion from Split-phase Manchester to Split-phase Mark code is shown in Figure 6. The input and the clock signal are passed through an AND gate to clock a D-flip flop.
The D-flip is governed by the following equation:
Qnext = Q'
The output signal is obtained as follows:
Output= Clk & Q + Clk' Q'
● More Line Code Conversions
Using the above conversions one can easily obtain the designs for more line codes. For example, NRZ(L) to Split-phase Manchester code conversion and Split-phase Manchester Code to Split-phase Mark code conversion can be combined to directly obtain NRZ(L) to Split-phase Mark code.
Step 2: GreenPAK Designs
The conversion schemes shown above can be easily implemented in GreenPAK™ designer along with some ancillary external components. The SLG46537 provides ample resources to carry out the given designs. The GreenPAK conversion designs are provided in the same order as before.
Step 3: NRZ(L) to RZ in GreenPAK
The GreenPAK Design for NRZ(L) to RZ in Figure 7 is similar to the one shown in Step 1 except that there is one DLY block added. This block is optional but provides de-glitching for the synchronization errors between the clock and input signals.
Step 4: NRZ(L) to RB in GreenPAK
The GreenPAK design for NRZ(L) to RB is shown in Figure 8. The figure shows how to connect the logic components in the CMIC to achieve the intended design given in Step 1.
Step 5: NRZ(L) to AMI in GreenPAK
Figure 9 illustrates how to configure the GreenPAK CMIC for conversion from NRZ(L) to AMI. This schematic along with auxiliary external components given in Step 1 can be used for the desired conversion
Step 6: AMI to RZ in GreenPAK
In Figure 10 the GreenPAK design for AMI to RZ conversion is shown. The GreenPAK CMIC configured in such a way along with op-amp and diodes can be used to obtain the required output.
Step 7: NRZ(L) to Split-phase Manchester in GreenPAK
In Figure 11 an NXOR gate is employed in the GreenPAK design to obtain the NRZ(L) to Split-phase Manchester conversion.
Step 8: Split-phase Manchester to Split-phase Mark Code in GreenPAK
In Figure 12 the GreenPAK design for Split-phase Manchester to Split-phase Mark code is given. The design for the conversion is complete and no external component is needed for the conversion process. DLY blocks are optional for removing the glitches arising due to synchronization errors between the input and clock signals.
Step 9: Experimental Results
All the designs presented were tested for verification. The results are provided in the same order as before.
Step 10: NRZ(L) to RZ
The experimental results for NRZ(L) to RZ conversion are shown in Figure 13. NRZ(L) is shown in yellow and RZ is shown in blue.
Step 11: NRZ(L) to RB
The experimental results for NRZ(L) to RB conversion are given in Figure 14. NRZ(L) is shown in red and RB is shown in blue.
Step 12: NRZ(L) to AMI
Figure 15 shows the experimental results for NRZ(L) to AMI conversion. NRZ(L) is shown in red and AMI is shown in yellow.
Step 13: AMI to RZ
Figure 16 shows the experimental results for AMI to RZ conversion. AMI is split into positive and negative parts shown in yellow and blue. The converted output RZ signal is shown in red.
Step 14: NRZ(L) to Split-phase Manchester
Figure 17 shows the experimental results for NRZ(L) to Split-phase Manchester conversion. NRZ(L) signal is shown in yellow and the converted output Split-phase Manchester signal is shown in blue.
Step 15: Split-phase Manchester to Split-phase Mark Code
Figure 18 shows the conversion from Split-phase Manchester to Split-phase Mark code. The Manchester code is shown in yellow while the Mark code is shown in blue.
Line codes form the basis of several serial communication protocols which are universally used in diverse industries. Conversion of line codes in an easy and low-cost way sought in many applications. In this Instructable details are provided for conversion of several line codes using Dialog's SLG46537 along with some ancillary external components. The presented designs have been verified, and it is concluded that conversion of line codes can be done easily using Dialog's CMICs.