The RedPitaya fast analog outputs have a noise level of the order of the 3-4 least significant bits. This noise is correlated with the switching of digital signals on the board, notably switching of the digital output signal itself, which leads to a nonmonotonic DAC performance. With a tiny modification of the board, this problem can be removed: DAC’s are nicely monotonic and noise performance improves so that the outputs have about 13 ENOBs.
Symptoms of the problem
With the RedPitaya V1.1 (the currenly sold version of it), I have observed a somewhat strange performance when it comes to the analog outputs. Since I use it mostly for feedback, I have done quite a few measurements of the analog transfer function realized with the internal PID module.
The measurement is simple: Send a sine of fixed amplitude (always 0 dBm in this post) and variable frequency to the analog input of the RedPitaya (properly terminated with 50 Ohm), set the PID module to a constant proportional gain, and measure the output signal (normalized by the input sine) to recover the effective gain and phase of the digital PID controller. This can be done very efficiently with commercial network analyzers like the Agilent E5061B that we have in our lab at the LKB.
For effective proportional gains down to about -30 dB one obtains pretty much what theory predicts for a perfect PID controller, however at lower gain I get this:
The variable p in the label stands for the proportional gain setting in counts (that is, the integer you assign to the FPGA register holding the proportional gain), where 4096 would nominally correspond to unity gain. A factor of 3 in gain corresponds to a theoretical increase of roughly 10 dB of the transfer function (10*log10(g^2)), but the DC-gain in the low-gain region changes way less than that. Even worse: above a few hundred kHz, we measure higher gain for p=1 than for p=3, that is, a higher p-gain leads to a decreased output signal!
It is fair to say that this only occurs for rather low gains, but since I wanted to realize arbitrary transfer functions with digital filters implemented on the FPGA, I did not want to have to take into account this effect (which just reduces the effective number of bits of the converters, and therefore gives you less dynamic range than you’d expect from 14bit converters). So I started debugging the effect. In this, it was very helpful to get in touch with the Zumy Topcagic from RedPitaya, who was as interested as me in finding the bug and helped me with many suggestions and schematics.
Long story short: The DAC’s on the board provide a unipolar voltage to which a constant offset is added in the anlog circuitry just before the output SMA connectors to make the output swing from -1 to +1 V. The problem is that this offset is directly derived from the +3.3V digital supply voltage. That means, that any change in the digital supply voltage, e.g. due to switching on or off a LED, may also influence the analog output voltage. This is expecially problematic when the supply voltage fluctuates due to the switching of digital pins of the DAC’s: In this case the (undesired) offset fluctuation is added to the (desired) change of the DAC output voltage, and may cause nasty crosstalk or a nonmonotonic dependence of the output voltage on the digitally set value for the output. That is, you tell the RedPitaya to increase the output voltage and it actually decreases!
You can test this on your device in various ways, the easiest being: Output a linear ramp, increasing the DAC register value by 1 unit per 10 ms or so, and monitor it on a scope or on the RedPitaya input. You will observe that this ramp is not perfect. If you have other things working in parallel, such as the LEDs blinking or the second output doing something, then the irregularities will get worse.
The solution: There are two possibilities.
- Use a voltage regulator to stabilize the voltage that is used to create the offsets for the analog outputs. The original design has actually foreseen this option and all you have to do is buy the right regulator and place it on the board, together with a few resistors and capacitors. A detailed description of this modification can be found here. While the design allows you to place both a regulator for positive and negative analog supply voltage, you only need the positive one to remove the bug. As far as I know, RedPitaya is working on making this version the new standard. Result:
- Remove two resistors per output from the board, which will disconnect the noisy offset voltage from the output. This will lead to a unipolar output going from 0 to 2 V (instead of the original -1 to +1 V). But it will also lead to even better performance than the regulator, with less work:
Which resistors must be removed?
With the naming on the picture below, R1 and R2 on the top side of the board are responsible for the offset of output 1, and R3 and R4 for the offset of output 2.
How to remove these resistors?
- Destructive method: Take a fine wire cutter and snap the resistors in question. This is fast and you can be sure that you won’t do any mistake in heating the board too much. But it is irreversible… unless you have a spare pair of those resistors.
- Unsolder. Its not too hard to unsolder these small components, but you should be aware that there is a very good thermal link between these components and the rest of the board. I sucessfully did it several times by setting my iron to 325-350 degrees Celsius, applying a little solder between iron and one contact of the resistor to remove and then gently pressing the iron against the resistor. After typ. 10s the resistor can be lifted to a vertical position with the iron. Then it can be pulled with a tweezer while the second contact is heated a bit. Other sucessful attempts used two solder irons to heat both contacts simultaneously. If nothing comes off after >20s, you are doing something wrong and should stop in order to not overheat the more sensitive components on the board (even though, I heated the entire board with a heat gun once for >2 minutes and it still worked after this), and try again with a higher solder iron temperature or by applying a bit more solder to increase the thermal contact.
Improved noise performance
Doing this operation not only improves the transfer function, it also lowers the analog output noise of the board. Integrating the noise specta between 500 Hz and 1 MHz (below 500 Hz the spectrum analyzer has a huge input noise) yields a 6.6-fold improvement of noise power when going from the regulator version (which itself is not very different from the original board) to the offset removed version.
Performance in the lab
If you drive a 50 Ohm load with an “offset removed” RedPitaya output, the maximum current at +2 V is 40 mA. This is within the specification of the output OpAmps, but you can see that the RedPitaya suffers a little: Now there is a bit of crosstalk at low frequencies between the two outputs when an output is loaded with 50 Ohms. This problem is easily fixed in my applications by careful load impedance design, which is possible because I either use an output to drive high impedances at low frequencies (10 kHz).
For applications from 0 to 300 kHz, I design the load impedance as a high-Z (>1 kOhm) in order to not draw too much current. For frequencies above the range of interest I let it roll off to 50 Ohm to avoid reflections and limit the noise. I do that by putting an RC lowpass before the actual load, with typical values of 50 Ohm for the resistor and 3-30 nF for the capacitor. Even if the output drives 50 Ohm at higher frequencies, crosstalk between the two outputs is limited. I guess this is so because in this frequency range, capacitors on the RedPitaya board can properly buffer the fluctuating load current so that the supply voltage remains effectively constant.
For applications allowing an AC-coupled output (>10 kHz typically), I simply AC-couple the output by inserting a DC-block in series with the RedPitaya output. If you dont have commercial DC-blocks, you can also try to simply put a not-too-large (non-chemical) capacitor in series with the output which avoids any significant low-frequency load of the output.
I’ve been constantly using 4 modified “offset-removed”-RedPitayas in the lab for over two months now and did not have any problems related to the modification. Rather, the digital filters that I implement on the board have the transfer function that I expect from design and the output noise of the RedPitayas is at the level of the least significant bit. Only when I do a slow large-amplitude sweep on a 50 Ohm@DC-load, I see some crosstalk to the other RedPitaya output and the inputs – so I simply avoid doing that. With a bit of luck, RedPitaya will soon bring improved boards to the market which perform similar to this hack.