Thursday, March 19, 2009

Adaptive Signal Processing, Polyphase Filter Banks, for the old and new

Recently I have spent enough time on adaptive signal processing algorithms to have driven my friends crazy (yes, I do have friends). Everyone wants the polyphase filter bank code. I completely sympathize. While I am not a Dionysius (a Greek king), I invite you to be Damocles and feel the sword as you sit in my chair for a few sentences and then I won't bore you any more with this.

The polyphase filter bank code is "done". It has been for months. The implementation of the filter banks in question? A completely trivial matter for someone with as much digital signal processing experience as I have suffered, err uhh, enjoyed. There is a problem. The problem is significant and I am absolutely determined to solve it. Polyphase filter banks should be everywhere, ubiquitous if you will. They should be easily used, and easy to get right. This is a major problem but it really is the only one I am interested in pursuing to the end. I find that all of the major players, from my new friends and colleagues, to those I have never had the pleasure of meeting, have failed to address an overall structure.

The structure in question is how to do all of this in a completely automated way. You give me a few design parameters, ones that are obvious, I give you back a pointer to a filter bank object and from that moment on, you give me signal, and I give you output. What is difficult about this? The filter bank's signal performance is completely determined by the filters and the filter performance is determined by the size of the computer word. If you ask me to implement a filterbank with brick wall edges and 100 dB adjacent channel suppression, the filter design and the flow of signal through the filter bank needs new work done by fred harris and I (soon to be published). If you need perfect reconstruction with these parameters (the channelization is reversible to high accuracy through a synthesis operation), I return with a "you are a fool" and tell you the best you can hope for is ...... The nature of the filters inside depends on whether or not you want linear phase or not and .......

The construction of all of this filter determination code has been the object of study for brains better than mine for decades (Julius O. Smith comes to mind) but it is not all collected into one object. I am determined to crack this nut once and for all. Irrespective of how much respect I have for my filter bank colleagues, they have written enough papers on one-off designs. They have charged enough money for one-off consulting. Through the power of doing this right and then giving it away GPL and probably publishing a treatise, I am determined to make this a sea change, once and for all.

The work done by fred harris and I needs publication approval from my masters. These are the ones that feed my children, send them to school, and allow me to drive a fancy sports car and go to Broadway twice a month. The approval is coming. The filter bank FILTER DESIGN work is being done and we will all have it soon.

Thank you for your patience. Understand that I do the other things knowing they are not as important as the filter bank code. They are nevertheless necessary. They show off the differences between these sdr signal processing chains and what is possible in traditional "narrow band high performance radios" to the SIGNIFICANT advantage of the SDR's. I may be mad, but there is method to my aggravating pace.

Sunday, March 08, 2009

Image Rejection along A Road Less Traveled.

"I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I--
I took the one less traveled by,
And that has made all the difference" (Frost)

Some time ago we began the process of studying, learning, suffering, failing, and then succeeding that always accompanies the creative process. Many wrong paths were taken. Life always intervenes as ruts in any roads taken. I write this for all those who have suffered with us, demonstrating the utmost patience and most especially to tell our long suffering European friends (with HF broadcaster images) that relief has arrived.

We have known for some time the mathematics of fixing the image suppression due to amplitude and phase imbalance in the QSD. Alex Shavkoplyas has done a fantastic job of following down one road in Rocky. It is a beautiful thing and my favorite cattle prod, Phil Harman, asked me very pointedly "What is the matter with you on this?" I explained and it immediately began to gnaw at me how can we do this. My apologies in advance for it haven taken so long to reach a place of an acceptable algorithm. I wrote a paper that I put in DCC (replete with errors). I followed that up with an article for QEX. I am grateful it was never published. Now the good one will be.

Unlike Rocky, we cannot take more than seconds, much less minutes and hours to converge to a useful image suppression result. Once rocky learns on a particular piece of hardware with its ROCK-bound frequency, it only needs to tweak for changes in temperature, age of crystal components, etc. You the user would be quite unhappy if it were commanded by Big Brother (Flex, DttSP) that you could not tune your radio but once a day! I suspect that amateur radio operator Winston Smith would be in rebellion and Gerald "OBrien" Youngblood could not even torture you to accept it. I know my Julia (Shann N2HPE) has suffered the torture of this with me. I am eternally grateful for her partnership. The ministry of truth has convinced you to be patient. For this I thank you.

Knowing the theory and mathematical equations necessary to accomplish a task does not make it easy to accomplish this in an algorithm. Image present is the result of nonlinearities in the QSD, RFIC, or any SSB mixer (IQ mixer). So nonlinearity must be present in the correct fix up. Nonlinearity introduced on purpose in a system hailed by all for the linearity and signal handling capability of its front end seems at best contradictory, at worst, immolation! Nevertheless, it is required. The application of these nonlinear processes must be done with some care.

Our first attempts at deriving an algorithm that would work in DttSP and PowerSDR succeeded. But they were calibration dependent. Calibration at the factory means man hours and increasing costs to Flex the manufacturer. We accepted the less than acceptable status quo until a month ago because we just didn't have a useful plan to do otherwise. Doubts, internal as well as external, began to consume. The realist among us went "who cares". The idealist averred as to how this was unacceptable. Shouldn't there be a middle way?

Traveling to Austin to work on an implementation of the image suppression algorithm became the top of the list of myriad demands on my time. The top of the heap being the work that is being done by Flex for my employer and sponsor. Knowing the mathematics as described above allows one to write down an iterative procedure where sequential estimation is used to estimate the solution (based on approximations to Newton's algorithm in an application of the fixed point theorem to real life).

The TEN LINES OF CODE were written in an hour. They were working immediately. It was clear that we needed to use something like this but it was unclear how to use it in the system as a whole. It will cause some dislocation to manufacturing, require dislocation to calibration, and require dislocation to the user access to those pieces that the user, heretofore, had come to expect. Klaus Lohman, in expert testing, pointed out an issue which seems troubling but in the end, isn't. But this had to be addressed. We learned that some of the parameters of our search algorithm were wrong. These resulted in occasional numerical instability. We did not have a plan on how to roll this out at all, but we knew we must.

Last week I returned to Austin and the magic of working in a partnership filled with respect but constant questioning allowed by mutual trust, Eric and I worked out a way to use this in any system that would attempt to use it. It is not enough to have the right algorithm in DttSP. The correct application is dependent ON THE USER not the algorithm designer so it requires knowledge of how one correctly uses it in a system for it to be effective.

So eight weeks ago, I added the math to DttSP v3.0. Four weeks ago I put a version in PowerSDR. Last week Eric Wachsmann and I made it practical. The practical comes in asking simply how can this mathematical magic be made useful to the user. It turned out to be remarkably simple. When you tune the radio and you tune it far enough that you change the synthesizer frequency, the algorithm starts a retraining cycle. This must be made stable. So, it starts VERY fast so that the image is almost suppressed completely in about 50ms but then it begins a step by step decrease in gain in the algorithm and at the end of the about 500ms, it has converged. So we can just turn it off then right? Wrong. The algorithm even works on noise BUT its answer is off because loud signal is a better input than noise. So we could not turn the algorithm off completely. We learned we need to leave it turned on at a low convergence rate. Then we ran into the problem that again, you Winston Smith, are not going to allow OBrien dictate to you what to do and think. You are going to tune rapidly and foul this learning algorithm up and the stack would run dry! That too turned out to be relatively easy to fix. If you change the DDS, the convergence algorithm is stopped and restarted and that is done in a thread safe manner.

Now that this lengthy TMI (too much information) account is done, we encourage you to use it. This information is provided for one reason only. So you who have suffered the long wait with us understand something of the creative process and why that MUST be married with the practical.

branches/n4hy/iqtest/bin/Release contains the new code.

I have been experimenting with fixes to the ANF and NR algorithm and I have fixed the complex but separable versions in this branch as well. The ANF and NR is most decidedly not stable code as it will continue to receive work all week long until we have convergence to the acceptable algorithm there as well.

The necessary steps to see this in the trunk must be done in stages. We need resampling in the IQ processing chain. We need to turn the receive training algorithm off when you are transmitting so that transmit training algorithm will run with the benefit of the perfectly adjusted receiver. All of this must be seamless. We learn from experience that you are mostly uninterested in how, you just want the damn thing to work.

Following this, the entire IQ imbalance conversation concerning Flex, QSD, etc. should be long gone. This will be useful for RFIC's, QSD, etc. It will work on RX and TX if you have full duplex hardware (Flex 3000,5000, RFX boards for GnuRadio). It will work on RX on the oldest and meanest of our hardware applications (for example, it will work on SDR-1000) and an appliqué for Flex 5000 and Flex 3000 will allow it to train the transmitter image to the noise floor in YOUR OWN RECEIVER not to mention your ionospheric neighbors.

I will tell you that success is sweet. But I am entirely aware of how long it took. I reject any gratitude because at the end of the process I am really quite critical of my having taken so long to arrive at what, in the end, amounts to no more than 20 lines of code and I had to have excellent help getting there.

Thursday, March 05, 2009

Beagle Board in a case

Dear reader:

As you know from my ramblings, there is great interest in achieving high performance with low power in an easily programmable chip in order to do software radio. That is, I can order it to be an HD radio, FM stereo receiver, police band scanner, HDTV receiver, etc. just by changing the software.

While this may seem extreme, rapid progress IS being made.

Texas Instruments released the OMAP family and many of us have become interested in pursuing the bleeding edge of technologies, including the OMAP family. In particular many of us have built up systems using the Beagle Board. The Beagle Board is nice, but you still have to download a bill of materials, screw driver the thing together, and pray it will do the right thing.

Stop the presses, this is no longer required. Though one can put together a system that is less expensive than the Always Innovating offerings, one would still have to buy parts, assemble, and then cross your fingers. With the Always Innovating computers, this is no longer necessary. Go check them out.