Clifton Laboratories 7236 Clifton Road  Clifton VA 20124 tel: (703) 830 0368 fax: (703) 830 0711



To search within the Clifton Laboratories site, enter your search term below.


Software Updates
Softrock Lite 6.2
Adventures in Electronics and Radio
Elecraft K2 and K3 Transceivers


June 2007 Archive Page

25 June 2007

If you are a radio experimenter of the analytical type, you've likely heard of F.W. Grover's classic book Inductance Calculations, originally published in 1946, reprinted by Dover Books in 1962. I secured a copy via Inter-Library loan four or five years ago and copied a few relevant pages but had given up on finding a reasonably priced copy of the book to add to my library.

I recently discovered that Dover Press reprinted Grover in 2004, and Amazon has an incredibly low price on new hardbound copies of the 2004 printing. I ordered Inductance Calculations last week and it arrived today. The list price is $52.50, but Amazon sells it for $10.50.

The formulas and units in the book can require a bit of work at times. It was written at the early days of digital computers and is heavily oriented towards look up tables and, in some cases, numerical integration (Simpson's rule, for example). And some equations are in the CGS (centimeter-gram-second) unit system instead of the SI system (meters-kilograms-seconds). The CGS unit of inductance is the abhenry, with one abhenry being 10-9 Henry, so a simple conversion to SI units may be required in some cases. Most of the formulas, however, can be directly used with, at most, a scientific calculator. (Grover wrote in the era of slide rules and log tables, after all! A well equipped reader might have access to a Friden or Marchant mechanical calculator with multiplication and division in addition to adding and subtracting. The AM radio station I worked at in the early 1970's whilst attending law school had a Friden mechanical calculator at the transmitter building for computing base current ratios in the directional array.)

Inductance Calculations remains an irreplaceable reference and, at $10.50, should be in the library of any serious experimenter.

My own personal copy of Inductance Calculations.


Sample from Inductance Calculations.




24 June 2007

I've been working for the last three days on interfacing the DSP board with a PIC.

My first approach was a serial interface, transferring one bit every left/right sample period, or about 96 kb/s. I thought that would be adequate data speed, but after thinking about it more, I realized that it is marginal. By the time you allow for synchronization and other overhead, the net throughput is about 2500 32-bit words per second, or 5000 16-bit words/sec. If we use a 320 x 240 pixel display, and if we desire 10 to 12 refreshes per second, there isn't much margin left in a 96 kb/s serial link.

The DSP development board has a memory-mapped 4-bit I/O interface, so yesterday and today have been devoted to starting a 4-bit interface. At the moment, I can read 4-bit data from the DSP into an 18F4620 PIC, and output it over an RS232 serial link. The RS232 serial link won't run fast enough to keep up with the DSP-PIC transfer, so I'm only sampling the data. Over the next week or so, I plan to get the DSP-PIC data transfer operating in both directions. This will provide a platform for commanding the DSP via computer keyboard, through the PIC. Still lots of work to do, but it's making some sense now.

The DSP development board, the PIC development board and the Intronix logic analyzer.
The shot below is the logic analyzer's view of the 4-bit data going into the PIC.

Clock 1 is the strobe signal, with valid data on the trailing edge (positive to ground transition). The four data lines are OUT-0 through OUT-3.

The line +FourBus is what Intronix calls an "interpreter" or data analyzer. I've set it to convert the logic levels of the four out lines to a hex digit. Other options are binary or decimal.

This is much easier than debugging data flow using even a digital storage oscilloscope.





21 June 2007

I've finished the manuscript on ferrite rod antennas and posted a printed copy and CD-ROM to the QEX editor I've been dealing with. Assuming it passes editorial muster, you may read it around the end of the year.

I recently purchased an HP3456A digital multimeter with GPIB interface. This instrument has 4-wire ohm capability and I received the Kelvin clips to make use of that feature a couple days ago. The Kelvin clips came with 0.1% resistors of 1K, 10K, 100K and 1M nominal value to allow one to test the ohmmeter accuracy.

Before I present the results, there may be some who are not familiar with 4-wire ohm measurements or know what a Kelvin clip is.

Let's start with the familiar 2-wire ohmmeter. A simplified version is shown below. The microammeter is calibrated in ohms, but in fact is simply measures current through the circuit, with the scale being a form of analog computer solution of Ohm's law, marked to show the approximate value of Runknown, the resistor being tested.

Conventional 2-wire ohmmeter.
Real ohmmeters include a provision for switching series resistors to provide different scales, and also a way of adjusting for "zero" by shorting the leads together and tweaking a calibration pot until the meter reads 0 ohms.

In fact, a two-wire ohmmeter has many frailties. For example, the resistance between the test lead and the part being measured is unlikely to be the same as when you adjusted the zero setting. And, the battery voltage may not be the same either.

Lord Kelvin, when faced with the problem of making accurate resistance measurements in the 19th century, invented a wonderfully clever solution to these problems. Lord Kelvin viewed the conventional ohmmeter circuit as really two individual circuits; one to supply a known current to the resistor being  tested and the second to measure the voltage across  the resistor being tested. Ohm's law thus allows the unknown resistor to be calculated via R = E/I.

This scarcely seems like an improvement, you may think. We've gone from a simple circuit with one meter to one requiring both a voltmeter and an ammeter. Surely that reduces the accuracy in half you ask. 

Lord Kelvin's 4-wire ohmmeter
In fact yes, we must now make  two measurements, and the accuracy of both will enter into the error budget.

However, look at the advantages of this arrangement. First, the resistance of the test lead and the internal parts of the ohmmeter are effectively removed from the computation. We don't care what these are (shown as Rinstrument in the diagram), as our computation only requires knowledge of the current through the series circuit of Rinstrument and Runknown. The voltmeter's impedance is assumed to be sufficiently high that its burden current does not cause measurement error. And, since the voltmeter draws negligible current, the resistance in its leads and clip lead connections will not materially affect the resulting measurement accuracy.

A Kelvin clip provides a way of easily making the 4-wire connection to the unknown resistance. The photo below should show you how a Kelvin clip is constructed.


Two types of Kelvin clips I own
Kevlin clip with the jaw open. The body of the clip is made from non-conducting plastic. The jaws are electrically isolated from each other.

The Kelvin clip shown at the upper right pivots on a non-conducting plastic spindle. The restoring force to close the jaws is supplied by the short length of surgical latex tubing between the end of the jaw and the clip end.

HP3456A input connection showing both 2-wire and 4-wire ohmmeter connections.

The trick is that the two jaws of each Kelvin clip are electrically independent. One jaw is connected to the ohmmeter's current source and the other jaw connects to the sensing voltmeter circuit. Thus, the only common point is the component.

Now, if you are measuring a 1 MΩ resistor, a 2-wire ohmmeter will be more than adequate, as the imperfections of internal resistance variation and clip lead changes are much smaller than the resistor under test. But, suppose you've been asked to measure a 0.05 Ω current shunt resistor. How can you accurately measure it, without worrying about test lead resistance variation? Or, suppose you have a printed circuit board with a shorted track, with a total resistance of 0.1 Ω. How do you locate the actual short point?

A 4-wire ohmmeter with Kelvin clips make both jobs easy. To demonstrate this, I've measured a 0.5 ohm, 1% 5 watt current sense resistor with the HP 3456A in 4-wire ohms mode with Kelvin clips.

As a matter of fact, it's possible to see a major difference in measured resistance by simply moving the Kelvin clips to the end of the resistor.

Poor measurement technique. Even though we use 4-wire equipment, the measurement includes the wire lead length.

R=0.5095 Ω, about 2% above the nominal 0.50 ohm value. (1% tolerance)

Correct use of 4-wire equipment. The Kelvin clips are applied as close to the resistor body as possible.

R=0.5020 Ω, well within the resistor's 1% tolerance.

If you have a small laboratory power supply with current limiting, you can use it, along with a voltmeter, to measure low value resistors, or to search for a shorted printed circuit board trace, operating in 4-wire mode. Set the power supply to limit the current to a safe value, say 50 mA or so. Apply it to the device being  tested and measure the voltage across it, E.  Then calculate R from R=E/I, where I is the power supply output current. In the case of a PCB with a shorted track, move the voltmeter along the traces and you can find the lowest resistance point rather easily.

Here's the result of the 0.1% resistance measurement, by the way.

Resistor Nominal Value HP3456A 4-wire HP3468A 4-wire Fluke 189 2-wire
1.000 KΩ 1000.56 Ω 1.00059 KΩ 1.0006 KΩ
10.00 KΩ 10.0011 KΩ 10.0015 KΩ 10.001 KΩ
100.0 KΩ 100.035 KΩ 100.044 KΩ 100.04 KΩ
1.000 MΩ 1000.75 KΩ 1.00081 MΩ 1.0009 MΩ

The worst difference between the two HP 4-wire instruments is 90 parts per million. The HP3465A's spec for these ranges is roughly ±30 PPM, whilst the HP3486A's spec is about ±120 PPM. Hence, agreement to the 90 PPM range is well within both instrument's specifications.

Of course, with these relatively high value resistors, 2-wire and 4-wire resistance readings will be close, as the lead errors are generally in the 0.1 to 0.2 ohm range.



19 June 2007

I'm trying to keep several balls in the air at once for the next few weeks. In addition to the DSP work, I've agreed to write several articles for possible publication, so I'll be busy. 

The first article covers a few week's work I did in 2000 building and testing ferrite loop antennas. At the time, I drafted 90% of an article on my results and set it aside until a few days ago. Whether it has improved by aging, like a fine wine, remains to be seen.

This afternoon, I added a software low pass filter to the DSP IF section I've been working with. As the block diagram below illustrates, the result isn't far from a complete IF chain. The major missing part is an AGC system. And, of course, all the frequencies, bandwidths and the like are hard coded. Plus, there's no digital interface to the outside world. All are projects for the next weeks.

And, before I add too many more features, I will restructure the code. It's in the "throw it together and see if it works" form now, and the longer I wait to clean it up, the more difficult the job will be. Moreover, the code's structure mimics an analog IF and detector strip. It does not, for example, take advantage of I & Q sampling and corresponding image rejection, folding spectrum at 0 Hz and the like.

But, before moving to these exotic things, my grounding in the nuts and bolts of the TMS320VC33 coding must improve.

Predicted low pass filter amplitude response
18 June 2007

I'll jump from 2007 to 1947 in this posting. Whilst looking for something else in a storage cabinet, I ran across a 1947 vintage Cornell-Dubilier CDA-5 decade capacitance box, from 100 μμF to 0.01μF, in 100 μμF steps. None of this pF or nF stuff in 1947. Nope, there were "micky mikes" and "micky-micky mikes" and don't you forget it.

I don't remember when I acquired the decade capacitance box, but I think I've had it 25 or 30 years and recall that there was a problem on some ranges when I picked it up at a swap and shop. Desirous of a break from punching assembler code in the TMS320VC33 DSP, I measured the decade capacitance box on all ranges with a digital capacitance meter. Based on the readings, I deduced that both sides of the range switches had one bad capacitor each, a bad 0.002 μF on the large step side and a bad 400 μμF capacitor on the small step side.

I replaced both mica capacitors with modern parts, a 2000 pF polystyrene and a hand selected 390 pF dipped silver mica (measuredat 398 pF) and I hope it will be good for another 60 years.

The decade capacitance box, in brown Bakelite plastic. 
The two bad mica capacitors.

The one marked 400 MMF measured 7 pF, essentially open circuited.

The one marked .002 MFD mesured 995 pF, so half its plates must be disconnected.

Original calibration table, dated 1947. Except for the bad combinations due to the two faulty capacitors, I found these values to be quite close to today's measurements.

For example, 4000 pF is said to be 3930 pF. I measured it at 3900, which is less than 1% difference from the 1947 values. And, my digital capacitance meter is only rated at ±1%, so it's your call to which is the more accurate value.

On the other side of the range switch, for example, I measured the 500 pF setting at 499 pF, whilst the calibration chart says 498 pF. Less than 0.2% difference.

Inside of the decade box with the replacement capacitors installed.

I put the defective parts in a plastic bag inside the case for any future owners that might be interested in historic restoration.

17 June 2007

I'm seeing signs of progress with my DSP work. This morning, I made a simple IF/product detector work in software. The arrangement is:

  • 15 KHz IF bandpass filter with the following parameters:

133 tap, Parks-McClellan FIR filter
Center frequency: 15 KHz
Bandwidth: 200 Hz
Transition bandwidth: 2.2 KHz (shape factor 1:11)
Stopband attenuation: 80 dB
Passband ripple: 0.5 dB

  • Numerical oscillator BFO at 14 KHz, computed on-the-fly by vector rotation
  • Product detector via multiplication of BFO and post-filter signal values

The product detector/mixer is simply a line of code that multiplies the numerical value of the filter output times the numerical value of the BFO signal. Of course, it also needs a low pass filter (to be added later) to knock out the signal and BFO feed through, but I can't hear 14 KHz so my ears provide the necessary filtering. (Product detectors are really mixers, although for historical reasons they are called product detectors.)

As I tune a signal generator through the 15 KHz input frequency range, there's a nice, clean and stable beat note in headphones connected to the Development Board's DAC audio output jack.

Pretty nifty! All those things I learned many years ago about the product of two sine waves being their sum and difference are true. (Not that I had any doubt, mind you, but it's still nice to see direct verification.)

Here's the code required to implement the product detector/mixer. (This is not efficient code, but rather a kludge to demonstrate the concept works.)

  ldf @V1,R1 ; get BFO stored in @V1
  ldf @OUT_L,R0 ; Get current post-filter signal value
  mpyf R1,R0 ; R0xR1 = mix BFO and input together, save product in R0
  mpyf @scale,R0 ; scale back to +/- 500K range

The first two lines load the current value of the BFO and post-filtered input signal into the TMS320VC33's R1 and R0 registers, as these two numbers have been computed by other code and their values placed in the V1 and OUT_L floating point variables. The third line is the actual mixer, multiplying the values held in registers R0 and R1, saving the product in R0. The fourth line scales the product held in R0 to a range the University DSK's D/A converter can handle, via a scale factor previously defined in floating point variable scale.

The 15 KHz filter response looks good. I can't verify the 80 dB design stopband as my HP3465A voltmeter's noise floor is about 500 uV, thus limiting me to about 65 dB dynamic measurement range in this configuration.


133 Tap Parks-McClellan Filter Response
I should add one point about how DSP filter bandwidth is defined. It's a bit different for those of us brought up in the analog RF environment, where we traditionally talk about 3 dB or 6 dB and 60 dB bandwidth values. In the DSP filter world, you define the desired stop-band, i.e., what RF types call the filter's ultimate rejection. You  then define the "transition band" which is the filter width desired between the pass band and the stopband rejection. The DSP filter bandwidth is not necessarily the 3 dB down point, but rather, in this design, the 0.5 dB "ripple" point.

Thus, the measured 0.5 dB bandwidth of the filter is very close to the 200 Hz design target, but the 3 dB bandwidth is about 600 Hz.

One more point and I'll wrap up this discussion. Spectrum analyzers normally use a Gaussian filter response, with a 3 dB : 60 dB bandwidth ratio of 1:15 or so. Hence the above design, although not a true Gaussian filter, is more than acceptable as a 600 Hz spectrum analyzer filter shape. If anything, the skirts are a bit too sharp. (As to why spectrum analyzers use Gaussian filters, it's to accurately pass amplitude information in the minimum time. I've covered the topic in more detail in my Z90 Filter Design article in May/June 2007 QEX.)

On 14 June 2007, I measured a 2 KHz DSP-based filter and noted that it had rather poor ultimate rejection (stopband rejection). This turned out to be a problem with signal leakage between the input signal and the voltmeter, due to capacitive coupling in the test leads. I've fixed that problem and re-measured the filter this afternoon. The filter's ultimate rejection is now below my noise floor limit.
Re-measured filter, with cable cross-talk problem corrected.
16 June 2007

Yesterday, I made some output power measurements on my K2/100 transceiver to verify wattmeter performance data. To generate the two-tone input signal (700 Hz and 1900 Hz) I used a Telulex digital synthesized function generator in two-tone mode. I've used this generator in the past and other than broadband noise being a bit higher than I might like, it's been a good performer at a bargain price.

Yesterday, however, I noticed that the LP100 wattmeter data was bouncing around, and looking at the transceiver's output signal with an oscilloscope, it was apparent why. The two-tone signal peaks were not the same level from peak to peak. Larry's LP100 wattmeter captures 100 or more readings per second, necessary in order to read power from a single 60 wpm dot or to read voice peaks on SSB. It was apparent that the LP100 was accurately reflecting wildly differing peak power values from one envelope cycle to another.

The oscilloscope capture below shows how a two-tone envelop should look, or at least almost how it should look. There's still a slight difference amongst the peaks, amounting to about 0.1 graticule division. At the worst, yesterday's peaks differed nearly one full graticule division.

The problem, of course, was that 60 Hz was mixed with the 700 and 1900 Hz tones, in effect modulating the two test tones. I had recently rearranged the AC power arrangement in this corner of my basement shop, and apparently there was enough difference in ground potential amongst the SG-100, the TDS-340 digital oscilloscope and the Astron 20M DC power supply connected to the K2, to cause a ground loop and thus inject undesired 60 Hz signal into the K2's microphone input.

Envelope of two-tone test, Elecraft K2 at 7 MHz, nominal output power 100 watts PEP. Data taken after 36 dB attenuation.

The "jaggies" or stair-step waveform appearance is an artifact of the digital oscilloscope's quantization in envelope mode at slow sample rates.

There are several ways to solve a ground loop, and this time I added a 600 ohm : 600 ohm audio transformer to break the ground line connection with the SG-100. (In some cases,  the test gear has to be floated using a 60 Hz isolation power transformer.) The result is as shown in the above capture; only a slight trace of 60 Hz hum was left.

However, connecting the transformer was a bit of a Rube Goldberg effort with clip leads, adapters and wires over the test bench, so this morning I decided to make a more permanent audio isolation transformer arrangement. the "iso-dapter", as illustrated below.


Interior View of "Iso-dapter" box.
Exterior of Iso-dapter box. Input and output have four connectors in parallel:
  • 1/8" (3.5mm) stereo phone jack (L & R in parallel)
  • Binding posts on standard 3/4" spacing
  • BNC connector
  • 1/4" (6mm) stereo phone jack (L & R in parallel)

There's nothing complicated about the design. It's a 600 ohm audio  transformer with one set of windings connected in parallel to four different connectors and the second windings connected to four more connectors. Either side may be used as an input and the other as an output. The particular connectors used represent the ones I normally use around the shop and shack. (I have a cable made up with an 8-pin microphone connector for Kenwood and Elecraft on one end and a mono 3.5 mm phone plug on the other end.)

The transformer is actually a split 600 ohm (four 150 ohm windings) transformer, but I've jumpered the windings  together to provide 1:1 impedance. Note also that I've used an inexpensive Radio Shack plastic box so the input and output ground references float with respect to each other, as otherwise the purpose of the transformer isolation would be defeated.

The common mode isolation could be improved with a screened transformer, i.e., one with an electrostatic shield between the primary and secondary windings, with the shield being connected to the ground on either the input or output. This would reduce stray capacitive coupling across the transformer windings and further isolate the input and output connections. I measure 104 pF capacitance between the input and output ground pins. At 60 Hz, this corresponds to 25 MΩ capacitive reactance.

Added features could include a toggle switch to go between normal, open and short on the output side. Or, more connectors could be added, perhaps with two transformers so that left and right stereo channels may be separately maintained.

Here's a frequency response plot of the Iso-dapter:

For the purposes intended, this is more than adequate frequency response The 900 and 1700 Hz test tones will differ less than 0.1 dB.

However, a high quality 600 audio transformer, such as a Western Electric 119C coil, will provide a much flatter response.

By the way, Elecraft's model 2T two-tone generator avoids the ground loop problem, if it is powered from a 9 V battery, as intended. Using AC powered general purpose test equipment carries the risk of ground loop hum. If found, an audio isolation transformer should solve the problem.

I mentioned that the LP100 will accurately read power and SWR with a single dot at the K2's maximum internal keyer speed. Here's an oscilloscope capture of the dot. The power reading was accurately displayed, despite the dot's duration being only about 15 milliseconds.

Single dot sent at the maximum speed setting with the K2's internal keyer
15 June 2007 (AM)

I've uploaded a revised Z100 Operating Manual this morning, version 1.3, dated 14 June 2007. The changes are relatively small and if you have already assembled your Z100, the new manual is not worth downloading and printing. Kits shipped today include version 1.3.

The Z100 manual is available by clicking here, or via the Z100 page or the Documents page.

I received a proof copy this morning of a QST Technical Correspondence letter I've written, to be published in August 2007 edition. The note is titled "MEASURING MOTIONAL PARAMETERS OF A QUARTZ CRYSTAL" and corrects an error in Wes Hayward's excellent book Experimental Methods in RF Design, co-authored with Rick Campbell, KK7B, and Bob Larkin, W7UPA, relating to G3UUR's oscillator frequency shift method of measuring crystal motional parameters. In essence, the equation provided in EMRD omits  the crystal's holder capacitance and hence causes the calculated motional capacitance to be 15-20% low. The corrected equation is:

This equation, along with sample measurements using it, can be found at my Crystal Motional Parameter notes, available at the Documents page, or by clicking the link above.

If you own EMRD and have not already done so, please check Wes's corrections page. The ARRL did a particularly poor job of editing and producing the book and Wes has provided an extensive errata at .

14 June 2007 (AM)

Yesterday evening, I  threw together a quick Liberty Basic program to control my Telulex SG-100 function generator (now a Berkeley Nucleonics Corporation model 625) over the RS232 serial port and my HP 3465A digital voltmeter over the GPIB port (via a Prologix version 4.2 USB-to-GPIB interface unit). The program steps the SG-100 (sinewave output) from a specified starting frequency to a specified end frequency in specified frequency increments. Each frequency step is saved to a data file, along with the 3465A's reading. The data can then be easily imported to a spread sheet, or a graphing program for further analysis. (I use OriginLab's Corp. Origin v. 7.5 scientific and engineering plot program.).  It's a lot easier to run this program than to write down the response values and keyboard them into the computer.

I've verified that the SG-100 and HP 3465A track over the range 100 Hz - 50 KHz within a small fraction of a dB.

Sample graphs are below. You may compare the first plot to the one I made with hand entering values yesterday morning.  The automated data has many more data points and avoids keyboard entry errors.

If you wish to experiment with digital filter designs, has a very nicely implemented interactive design applet. You specify the center frequency, transition band and other parameters and the applet computes the filter coefficients and plots the filter response. If you are at all interested in digital filtering, I recommend visiting the site and experimenting with the filter applets.

Moving Average low pass filter, with 15 taps.

A moving average filter has gentle roll off, and a periodic null/peak form, following a sin(x)/x envelope.

Moving average filters are given an entire chapter in Steven Smith's book "Digital Signal Processing: A Practical Guide for Engineers and Scientists." It's Chapter 15, and can be read on-line (earlier version than the published book, but this chapter seems to be relatively unchanged.) at Click on Chapter 15. (You should read the entire book!)

The DSP's frequency response with no shaping.

The A/D values are simply repeated to the D/A, with no frequency shaping or alteration.

The response is a composite of the A/D's input filters and the D/A's output filters.

The result is not as flat as it should be, as it is about -3 dB at 21 KHz.

A 146 tap, Kaiser window bandpass filter. The filter is centered around 3 KHz, and has a 3 dB bandpass of 2200 Hz.

These parameters were chosen more or less at random, to see how the coefficient program works.

The ripple on either side of the filter is characteristic of digital filters. However, the sidelobe levels seen here are considerably above the design level of -80 dB. In part, this may be due to the SG-100's relatively high broadband noise level passing through the filter's passband and contaminating the output.

[Problem with ultimate rejection fixed--was cable leakage between channels. See revised data on 17 June 2007.]

13 June 2007 (PM)

To help debug DSP communications, I purchased an Intronix LA1034, 34-channel PC-based logic analyzer.  It arrived this morning and I've had a brief chance to use it. With optional (but useful) clips, and 2nd day air shipping, I paid a bit over $400 for it.

The LA1034 is connected to four lines between the TMS320VC33 DSP and the PCM3003 CODEC:

  • LRCIN (Clock 1). LRCIN determines whether the left (LRCIN HIGH) or right (LRCIN LOW) channel is selected.
  • BCKIN (Clock 2). BCKIN is the data clock.
  • PCM IN. PCM IN is the data into the PCM3003 chip. The data is 20-bits, right justified.
  • PCM OUT. PCM OUT is A/D data out of the PCM3003 chip. The data is 20-bits, left justified.

In addition to displaying the status of these four lines, I enabled four "data interpreters" to decode the four data channels: OUTPUT RIGHT, OUTPUT LEFT, INPUT RIGHT and INPUT LEFT. These interpreters decode the data bit stream and display the values as hex values (optional to see the data as hex, decimal, binary, etc.).

A sample screen image is below.  This image represents about one-third of the total data captured, and the image can be scrolled left/right to see other values.

The values such as AE324h are the decoded 20-bit data streams. The data interpreters allow entering offsets (ignore n bits before data) which I have enabled for the right justified D/A input data streams.

The DSP program loops the right channel through from the A/D to the D/A. The left channel passes through a 15 point moving average low pass filter, as shown below.

From my very preliminary exposure to the LA1034, I'm very pleased. It's easy to use and displays a great deal of useful important information in a compact form. If I had this a few days ago, I could have saved several days work chasing why my filter software was not playing correctly.




13 June 2007 (AM)

After several days of running in circles, I have a simple low pass filter running on the TMS320VC33.

I've mentioned the spotty documentation provided by TI. That extends to TI's Burr-Brown division's PCM3003 data sheet. The PCM3003 is a stereo CODEC, i.e., it has a left and right channel A/D converter and a left and right channel D/A converter, all with 20-bit resolution. The University SDK board has a PCM3003 CODEC installed as the primary I/O device.

Most data sheets discuss the expected data output format, i.e., the coded output corresponding to a specific voltage level input. Microchip's data sheets, for example, are very good in this regard. The PCM3003 data sheet, however, only discusses how the serial data is outputted. After a couple of days of strange results that I attributed to problems with my filter algorithm, I started at the beginning, and looked at the PCM3003's data output for specific voltage level inputs. Since the board capacitive couples input and output, this required a low frequency square wave input signal, and capturing the data output with a digital storage oscilloscope.

The rest of the story is that the A/D uses 2's complement output for voltages below Vcc/2, but I had assumed that since the data sheet was silent, the output format was similar to the internal A/D in a PIC Microcontroller, which is linear, from 0 ... 1023 for a 10-bit A/D.

The PCM3003's comparison circuitry is biased to Vcc/2. Input voltages above this are output as 0...524288 (219)  Voltages below Vcc/2 are output in 2's complement form (20-bit length), so that 1 LSB below Vcc/2 is -1, but -1 is encoded as 1048575, or in hex 0xFFFFF.  The TMS320VC33 is a 32-bit device, so it reads 0xFFFFF not as -1, but rather as 1048575. The result is very strange looking output waveforms. After realizing the problem, it was simple to fix the code to convert the PCM3003's format to a form the DSP is happy with.

My test code is a very simple low pass filter that uses a 15 length moving average (boxcar) filter. The response is a sin(x)/x form, easily seen in the frequency domain data I measured this morning.

The moving average nature of the filter is perhaps easier to see in the time domain. My test program loops one channel through with no filtering (Chan 1 on the 'scope) whilst the other channel implements the 15 position moving average filter. Channel 2 shows the filtered output. We expect the square wave to have sloping sides as the signal is averaged up and averaged down. This can easily be seen in Chan 2's trace.

Channel 1's frequency response is about 22 KHz, as it goes through filtering in both the A/D and D/A steps. Hence it's rise and fall time is also degraded from the function generator's sub-microsecond specification.

The DSP's sample frequency is 48.8 KHz, or 20.5 μs. The full 15 moving average period is thus 15 x 20.5 = 307 μs. The digital oscilloscope (Tektronix TDS430) computes rise and fall time with the traditional 90% - 10% points, so we expect it to show a rise/fall of 0.8 x 307 μs, or 245 μs, close enough to the TDS430's 246 μs measurement.


09 June 2007

I've returned from an interesting two day visit with Mike, W4XN, and his wife in Charlottesville, VA, about 100 miles from Clifton. Mike's basement lab looks like an HP showroom, and among other things, we had a chance to measure the phase noise on several different types of HP signal generators, using his 8566A spectrum analyzer and an 8 MHz crystal notch filter I designed and made. I've added his data for the following generators to my Oscillator Noise Measurements page.

  • HP 8640B analog signal generator
  • HP 654A analog function generator
  • HP 3325A synthesized function generator
  • HP 8660C synthesized RF signal generator with each of the following plug-in units:
    • HP 86601A (0.01 to 110 MHz)
    • HP 86602B (1 to 1300 MHz)
    • HP 86603A (1 to 2600 MHz)

I consider myself fortunate to have made Mike's acquaintance recently.


I mentioned the DSP documentation. Here's a photo of it. The lower documents are ones I've printed (double sided) from TI's PDF files supplied with the University DSP development board. I like the convienence of a printed source to refer to.

On top of the TI document set are four books on DSP and digital filtering. One book is hidden by the binding of the top comb-bound document.

The stack is 10" (250 mm) tall.

05 June 2007

As planned, the last two days were also devoted to working with the TMS320VC33 DSK. My plan was to complete working code to read the two A/D converters (stereo, one left channel and one right channel, in a common IC), buffer the results in a circular array and output the buffered values to the D/A converter.  I finished that code this afternoon. Here is a sample result.

The input signal is shown on Chan 1 and the output signal on Chan 2. The measured delay is 3.22 ms.

The 3.22 ms delay is a combination of two elements. First, the buffer delay. This example uses a 127 element buffer array, with a sample rate of 48.8 ks/s. The buffer delay is  thus 127 / 48800 = 2.602 ms.

There is thus an extra delay of about 620 μs. This delay corresponds to zero wait, and is comprised of digital filter delay in both the D/A and A/D.

The second goal I achieved was to complete a program to compute the D/A values "on the fly," i.e., the D/A values are computed for each data point, rather than being looked up from a table. This is an area where the DSP really shines. The output is two sine waves, shifted 90°, (one sine and one cosine waveform) with both values computed as needed for each data point, i.e., once every 20.5 μs. It takes the DSP about 650 ns to compute the next sine / cosine pair values. So, there's still nearly the full 20 μs inter-sample interval available for other work. The computed waveforms are of decent quality, with the phase being within 0.08° of the theoretical 90°.

03 June 2007

In working with the TMS320VC33 University DSK DSP kit, I've tried to set small end-of-day goals. Yesterday's was to have a functioning circular buffer. Today's was to have the digital-to-analog (DAC) portion of the PCM3003 CODEC output a waveform that I had programmed in as a data table.

This is how direct digital synthesis, or DDS, works, albeit at audio frequencies. The programmed data table is for a triangle waveform and here's the output waveform:

I thought the triangle waveform would be output at 1 KHz, not 2 KHz, but I now understand my error, as the routine is being called twice every sample period, once for the left and once for the right channel. Each call updates the table index. That's easy enough to fix by only updating the table index pointer once per call, e.g., update it when the left channel value is written.

Tomorrow's goal will be to work more with an output waveform table.

Here is the output waveform with the dual update fixed. It's 1 KHz, as planned.


Although I'm becoming more accustomed to TI's assembler and DSK3DW "integrated development environment," my original opinion that these tools offer woefully underwhelming stability, features and user friendliness, is reinforced daily.


02 June 2007

Another day in my basement lair working on DSP programming. After considerable headscratching, I've managed to make a functioning circular buffer work in TMS320VC33 assembler.

This might not seem like much of an accomplishment for 8 hours of work, but it was, due to a combination of my failing to carefully read TI's documentation and also assuming that some sample code was in fact correct.

A circular buffer, by the way, is an area in RAM memory that is addressed in a wrap-around or "circular" fashion. You might have 32 bytes of memory in which to store inbound data, for example,. What do you do when the 33rd byte arrives? Depending on the purpose of your code, you might stop inbound data, or take some other action. But, it's a common event in digital signal processing to take the 33rd byte (the newest data) and save it where the oldest data was before. Hence, the newest byte overwrites the oldest byte and the next byte that arrives overwites the next oldest byte, etc.  Thus, the data addressing wraps around the end of the reserved memory. One can also think of this as a buffer array with the head and tail connected, thus forming a circle. Hence the common terminology of a "circular array."

Since DSPs deal with circular arrays so often, they have special instructions to make their use efficient. For example, the TMS320VC33's hardware can keep track of where the next data element is to be stored, providing you have properly set up the size and location of the memory reserved for the circular array. There's where my problem came in. It turns out that you have to reserve more memory than the size of the array. I won't go into details, but if the array is 31 elements long, you must reserve 32 spaces. (The TMS320VC33 uses 32-bit memory, so the elements are not 8-bit byte width.) And, the array memory space must be reserved on an address boundary that is "even" in binary based on the reserved size.

An example is that the 31 element array requires 32 memory spaces and the reserved memory must start on an address such that it is an even multiple of 32. A starting address of, e.g., 48 won't work. Rather, the starting address must be 32, 64, 96, etc.

I misread TI's documentation to say that the reserved space must be ≥ the array size, when in fact it is a strict >. Hence my 32 element circular array with 32 reserved data elements starting on a 32 multiple boundary failed. To make it work, either the length must be changed to 31 or less or if the length is to be 32, then 64 memory locations must be reserved and the starting address must be at a multiple of 64.

After sorting that out�and misreading the same text at least a dozen times�my circular buffer is working as it should.

Circular buffers are very useful in implementing digital filters, as a common filter methodology multiplies past samples by a series of coefficients to produce low pass, high pass, bandpass, etc. responses. This is all very elegantly explained in Steven Smith's book The Scientist and Engineer's Guide to Digital Signal Processing, which he has made available for free download at If you have not already done so, you should read it.

Here's a photo of TI's University DSK printed circuit board.

TI's TMS320VC33 University DSK Printed Circuit Board.

The DSP chip is near the center of the photo. The three ICs at the center are memory (two SRAM and one non-volatile ferroelectric RAM). The small square chip near the parallel port connector is the complex programmable logic device or CPLD. The input and output op-amps and PCM3003 CODEC chips are along the board edge between the two 3.5mm stereo connectors.

The blue and red objects are oscilloscope adapter plugs for a standard 0.1" header.

To provide a sense of scale, the connector at the top is a standard 25-pin parallel printer cable.

A view of my PIC and DSP programming table. The laptop on the right side of the table is used to program PICs and also for Windows development with Delphi.

The monitor next to it is for DSP programming with a Dell SX260 table top computer.

The  test gear in the background is a Tek TDS430 400 MHz digital oscilloscope, an HP8558B spectrum analyzer, a Boonton 102D signal generator and an HP 8640B, option 323 signal generator. There are smaller items on the back of the desk as well.

01 June 2007

As usual, I've archived the May 2007 updates to a separate page, viewable by clicking here or via the links at the top of this page.

Yesterday was devoted to TMS320VC33 DSP work. I had purchased two used Dell SX260 computer at the end of 2006, with the thought of using one in my radio room to update the elderly 266 MHz laptop machine I use there now. The SX260's are essentially a laptop board in a small table top case, but with a generous complement of physical connections, a real hardware parallel port, a real hardware serial port, 6 USB ports, serial keyboard, serial mouse and a 100 MHz Ethernet connection, audio I/O and a VGA video board supporting up to 1600 x 1200 resolution. I decided to use this second Dell computer for my DSP programming and connected it yesterday. I purchased a 20" ViewSonic monitor, VP2030b, supporting 1600 x 1200 resolution, to use with it.  It's much easier to use TI's software programming software with a large screen, as I can open multiple windows and still read the text.  TI's software is still buggy, and klunky, but it's now legible.

By yesterday evening, I had a simple loopback program running on the TMS320VC33. It converts analog audio input to a digital format using the on-board Burr-Brown/TI PCM3003 CODEC. The digital data is then echoed back to the PCM3003's D/A section and output as an analog signal. (CODEC is the acronym for coder-decoder and describes a module that performs both encoding [A/D] and decoding [D/A].) TI refers to these functions as AIC, standing for "Analog Interface Circuit."

Using a company-standard term, AIC, instead of the generic CODEC, is another example of TI going out of its way to complicate things. Understanding TI's documentation first requires you to master its terminology.