Saturday, November 27, 2021

S-parameter conversion and visualization
S-parameters

It's a common practice for RF, microwave and high speed design engineers to pre-process and validate the scattering parameters (S-parameters) reciprocity, passivity and causality before proceed to use it. This notebook will walk through a sample implementation in python to show a simple way of S-parameter manipulation and plot to provide a quick examination through visual inspection. It will cover the following steps:

  • load a sample 4-port S-parameter file hosted on the Internet (load file through its URL)
  • single-ended S-parameter to mixed-mode conversion
  • Output magnitude in dB for specific measured frequency points of interest
  • Insertion loss plot for report and visual inspection quality check purposes




Saturday, July 17, 2021

PRBS13Q and pre-coded PAM4 test pattern generation

PRBS13Q Include contents generated by interactive python notebook in the Blogger post is more difficult than I had thought. Although there are so many suggested solutions out there on the web, it doesn't really work for me. Whether it's a hacking into the particular post template to include the Javascript, or customization of the CSS to display nbconvert created html simply doesn't apply as my Blogger account doesn't even have that "Template" or "Advanced CSS" feature enabled for some reason. Probably because it's a free version, thus only providing bare minimum capabilities? Anyway, after surfing the net for a while, I came out the following procedure through trial and error as a workaround:
  • Upload the ipynb file to gist and create the link as suggested by some of the proposed solutions.
  • Manual create a simple html file and embed the gist link in-between the <body></body>.
  • Create post in "html" instead of "component" view.
  • Preview and publish.
Here comes my first notebook post: not very satisfied, but readable.

Friday, January 31, 2014

Spectrum Analyzer Based Phase Noise/Jitter Measurement with Golden PLL in Excel


Demo of the GUI
Today is a big day to all Chinese in the world, the Lunar Chinese New Year, and I’d like to wish all a lucky, happy, healthy and wealthy year of horse ahead!
It’s a time for many Chinese to party and eat to the heart’s content with good excuses to avoid feeling guilty and at the same time make the resolution for the whole new year. More than often, we tend to wait for a “proper” time for the real action to follow for reasons such as “busy to clear things on hand first”, “need to wait for a good chunk of time” and in the end, the chances are "the right time" never comes. But sometimes, if we chose to “slot it in” and “start it now”, we could be amazed at how easy it can be done (relative to what we had thought) and how much we can achieve with small steps a time. The excel sheet to be described can do a lot of things for an engineer who are interested in phase noise and/or jitter measurement. More importantly, the concept can be extended and applied to integrate test and measurement automation with automatic report generation (data post processing and visualization) in Excel. However, it get started only as a simple worksheet to calculate the RMS RJ value from the user supplied phase noise data which took less than 5 minutes to create. It is then fairly easily expanded into what it is now with the capabilities to:
  1. Take in phase noise in “frequency-phase noise” data pairs and calculate the RMS RJ value. This is the spectrum analyzer based clock source random jitter measurement method described in FC-MJSQ and can be used to study the characteristics of different kinds of clock sources.
  2. Pass the phase noise data through PLL and calculate the PLL filtered RMS RJ value. It can be used to study the PLL characteristics and its jitter shaping effect on clock sources.
  3. Pass the phase noise data through PLL first and then a golden PLL. It can be used for transmitter compliance test.
  4. One-button click to perform phase noise measurement from the clock source directly if spectrum analyzer is connected to the host PC through GPIB. This will automate the phase noise raw data acquisition into the Excel instead of manually cut/paste.
  5. One-button click to perform screen capture of the spectrum analyzer for documentation and reporting purposes.
Here is the step-by-step guide on how to make this Excel sheet:

To achieve capability 1:
Cut/paste or import from text-based files such as “*.txt” or “*.csv” for the raw phase noise data into the Excel sheet column A and B and key in the trapezoidal integration equation in column C (start from C3) as shown in Figure 2. You can drag the equation that is filled into C3 all the way down to fill in the column C with the same equation.
Figure 2: trapezoidal integration equation
The summation of column C is the SSB noise power and the RMS phase noise Phi (in unit of radius) is the square root of twice the SSB power, in Excel, Phi = SQRT(2*SUM(C:C)).

To achieve capability 2:
You can calculate the transfer function of your PLL and put the data into column D in dB, the phase noise output through the PLL is simply the addition of raw phase noise and the PLL transfer function in dB and is presented in column E as shown in Figure 3. As an example, the second order PLL transfer function for PCIe described in [1] is used with a 3dB loop bandwidth of 15MHz and a damping factor of 0.54.

Figure 3: TX PLL transfer function
The trapezoidal integration equation is used in column F to calculate the SSB noise power after the raw data goes through the PCIe PLL.
Figure 4: SSB noise power at the TX PLL output

To achieve capability 3:
Use the same method and integration equation as before to implement the first type golden PLL defined in [2]. The completed input is shown in Figure 5 as below.
Figure 5: first type golden PLL transfer function
The SSB noise power for the raw phase noise, the output from (TX) PLL and the output from the golden PLL are calculated and presented in K2 to M2 as shown in Figure 6.
Figure 6: SSB noise power calculation
To make the phase noise/jitter results more presentable, a new sheet is used as GUI with the layout shown in Figure 7, where the phase jitter in second is dependent on the carrier frequency.
Figure 7: calculated phase noise output
At this point, you can also plot all the transfer functions as shown in Figure 8 and the phase noise as shown in Figure 9.
Figure 8: transfer function plots

Figure 9: phase noise plots
To achieve capability 4:
I had thought that this feature could take some time to figure out on how to implement. However, a quick search brings me to the Agilent website, where a very good article is presented on exactly the same topic “Controlling instruments with Excel and the bundled Visual Basic forApplications”.
Of course, I certainly don’t want to hard code the GPIB port and address for the spectrum analyzer. Thus, the input interface as in Figure 10 is provided. Instead of using the cell values directly, the named ranges are used so that when the “GUI” is reformatted, there is no need to change the codes because of the shifting of the cell positions.
Figure 10: named ranges for GPIB interface information
Put a command button onto the Excel sheet and “assign Macros” Button1_Click() as shown below will automate the phase noise data downloading into the Excel.

Sub Button1_Click()
    
    Dim ioMgr As VisaComLib.ResourceManager
    Dim instrument As VisaComLib.FormattedIO488
    Dim idn As String
    Dim lpl() As String
    Dim freq() As Double
    Dim dBc() As Double
    Dim rowStart As Integer
    Dim iLastRow As Long
    Dim lpln As Integer
   
    Set ioMgr = New VisaComLib.ResourceManager
    Set instrument = New VisaComLib.FormattedIO488
    Set instrument.IO = ioMgr.Open(Sheets("MainGUI").Range("gpib_port").Value & "::" &   Sheets("MainGUI").Range("gpib_addr").Value) ‘ this is the same as below line
    'Set instrument.IO = ioMgr.Open("GPIB0::03")
    instrument.IO.Timeout = 10000

    lpln = CInt(Sheets("MainGUI").Range("C11").Value) ‘ provide the option to chose the trace
    instrument.WriteString ":FETC:LPL" & lpln & "?"
    lpl = instrument.ReadList(VisaComLib.IEEEASCIIType.ASCIIType_BSTR, ",")
    instrument.IO.Timeout = 5000
   
    rowStart = 2
    For i = (LBound(lpl)) To (UBound(lpl) - 1) Step 2
        ReDim Preserve freq(0 To i / 2)
        ReDim Preserve dBc(0 To i / 2)
        freq(i / 2) = lpl(i)
        dBc(i / 2) = lpl(i + 1)
    Next i
   
   Sheets("LPLData").Range("A" & rowStart & ":A" & (UBound(dBc) + rowStart)).Value = Application.Transpose(freq)
   Sheets("LPLData").Range("B" & rowStart & ":B" & (UBound(dBc) + rowStart)).Value = Application.Transpose(dBc)
   
    'clear the old f-PN contents
    rowStart = UBound(dBc) + rowStart + 1
    iLastRow = Sheets("LPLData").Cells(Rows.Count, "a").End(xlUp).Row
    Sheets("LPLData").Range("A" & rowStart & ":" & "Z" & iLastRow).Clear
    Call TFCalc  ‘ calculate the transfer function
    Call updatePlots  ‘ update the plots

End Sub

To achieve capability 5:
It’s just one more command button with a little bit more coding. You can look into the codes under Button2_Click() if you are interested.
Of course, it’s handy to add in some more features such as the start/stop frequency so that you have the option to change the frequency span for the phase noise measurement. The option to choose which trace to download: raw data trace or the smoothed data trace. And the flexibility of changing the 3dB cut off frequency of the golden PLL.
By now, we are almost done. As all the raw data are organized into one sheet named “LPLData” and the input/output GUI into another sheet named “MainGUI”, automatically download the phase noise raw data doesn’t pose any issue as it has been taken care of by the Macros. However, manually cut/paste the data from external sources into the Excel sheet may risk overwriting the equations inside the cells, thus corrupting the excel sheet. To avoid this situation, instead of input the equations manually into the Excel sheet, the transfer function calculation and the trapezoidal integration equations have been packed into Macros, making this process fully automated. In addition, an extra Excel sheet named as “PNData” is used for external phase noise data manual input as shown in Figure 12.
Figure 12: phase noise manual input interface

A typical procedure for manually input the phase noise data is outlined in the following:
  1. Navigate to sheet “PNData”, click on “Delete PN Data” to clear old data points.
  2. Copy the external data and paste them into column A and B from row 2 onwards.
  3. Navigate to sheet “MainGUI” and click “Manual PN Data”.  All the calculations will be done automatically with results updated instantly.
The sample code used for PCIe PLL transfer function calculation is given as below:
Function HdB(f3db As Double, zeta As Double, f) As Double
    Dim i As Integer
    Dim n As Double
    Dim d As Double
    Dim w As Double
    Dim w2 As Double
    Dim wn As Double
    Dim H As Double
    w = 2 * Application.WorksheetFunction.Pi() * f 'omega
    w3 = 2 * Application.WorksheetFunction.Pi() * f3db  'omega 2
    wn = w3 / Sqr(1 + 2 * zeta ^ 2 + Sqr((1 + 2 * zeta ^ 2) ^ 2 + 1)) 'omega n
    n = wn * Sqr(wn ^ 2 + 4 * w ^ 2 * zeta ^ 2) 'numorator
    d = Sqr((wn ^ 2 - w ^ 2) ^ 2 + (2 * w * wn * zeta) ^ 2) 'denominator
    H = 20 * Application.WorksheetFunction.Log10(n / d)
    HdB = H
End Function

The finished GUI is shown in Figure 13.
Figure 13: finished GUI

References:
1. PCI ExpressTM Jitter Modeling Revision 1.0RD
2. Fiber Channel - Methodologies for Jitter and Signal Quality Specification - MJSQ 

Saturday, November 10, 2012

Confidence Level and Test Time Excel Calculator at Specified BER and Data Rate

     For those who have the experience of receiver jitter tolerance (RXJTOL) test using a bit error rate tester (BERT) build-in function are mostly likely familiar with the configuration parameters such as the measurement BER depth, confidence level, error gating time or transmitted bits. On the one hand, most of the industry standards will specify these test requirements explicitly such as "test at a BER value of 1E-12 with 95% confidence level" and leave you with no choice but to follow. But some will not specify explicitly, thus you need to make a wise engineering judgement for BER, confidence level settings considering the data rate of the DUT to strike a balance between test accuracy and test time. On the other hand, when there is a requirement of DUT and BERT interactions during the RXJTOL test, you have to write your own test codes instead of using the BERT build-in test function. In this case, you again need to have a good understanding of the relationship among BER, CL, data rate and measured error numbers so that your test algorithm can be properly implemented.

    To serve the above-mentioned purpose without sweat on the mathematics, you can actually make use of some online calculators such as the one from JitterTime. You can input target BER, data rate, measured errors and test time to calculate the confidence level. However, if you has a target CL in mind and want to know the test time or number of bits transmitted, then you need to "play with" the test time iteratively until you hit your CL target if use this online calculator. Alternatively, you need to look at the graph on the same website to find your answer indirectly.

    To make life easier, I implemented similar calculators in Excel based on the same Poisson equation. It not only provides the flexibility of using the calculator without the access of the Internet but also provides the capability of calculating the test time and transmitted number of bits for specific CL targets using bisection root finding method with a 0.01 second accuracy. It can be downloaded here and hopefully can be of some use for you.

    Take note, if you find that the Excel calculator doesn't response to your input. It's most likely because of your Excel disabled the Macro.  If that is the case, you need to enable the Macro by going to "Options..." to "Enable the contents" first.


Sunday, May 20, 2012

Measurement Automation: How to Save Screens of 86100C DCA-J, SDA830 and E4440A/E4445A to Local PC Through GPIB

Picture from agilent.com
Measurement automation can save you a lot of pain in many cases on top of the advantages of higher productivity and greater accuracy in case of performing repeated day-to-day test and measurement tasks. Several examples using simple GPIB commands to capture screen pictures from different instruments to a local PC are given in this article with the complete workable VEE codes shown how to implement. They are easily portable with any programming languages such as Matlab and C or scripts like Perl and Python. If you are interested in how to:

  • Save screen image from Agilent DCA-J 86100C to local PC as GIF files.
  • Save screen image from LeCroy SDA830ZI-A to local PC as PNG files.
  • Save screen image from Agilent E4440A/E4445A spectrum analyzer to local PC as GIF files.
  • Dump raw spectrum data from Agilent E4440A/E4445A spectrum analyzer to local PC as text files.
  • Dump raw phase noise log plot data from Agilent E4440A/E4445A spectrum analyzer to local PC as text files.

Please read on here ...


Saturday, February 11, 2012

Finally, 50G Hz electrical BW with 32Gbps hardware CDR module is available for DCA from Agilent


    I have been looking for high bandwidth, high fidelity CDR modules for high speed (25Gbps and beyond) SerDes characterizations and finally it's here! It is Agilent 86108B Precision Waveform Analyzer which claimed to have "industry best intrinsic jitter below 50 femtoseconds, channel bandwiths to 50GHz, and clock recovery to 32Gbps ...."

If you are interested to know more, "Tips and Techniques for Accurate Characterization of 28Gb/s " is one of their good application notes to start with.