Bitscope: Limitations for Mojo FPGA measurements

Note: This is currently published without any images.  I intend to re-run the measurements discussed here, and then include a few screenshots of the output, and will update this post when I do so.

The Bitscope are oscilloscopes and logic analysers that operate via a serial connection (USB or RS-232) to a computer that hosts the scope display.  The 100 MHz analog input bandwidth of the Bitscope I plan on using implies that it *might* just be possible (although pretty unlikely) that it can measure the raw 50 MHz clock of the Mojo.  Although I couldn’t find details on the sampling rate of the Bitscope, I guess that most of that BW is used to allow for very fast sub-sampling, rather than for single waveform capture, and so the very fast signals that the Mojo is capable of outputting will not be directly measurable with the Bitscope.

To test this, I configured the FPGA to output eight different clocks, each of which had a period twice as long as the previous one.  That is, a clock (clk2) with a period twice that of the FPGA, another (clk4) with a period four times as long, another (clk8)  eight times as long, sixteen (clk16), thirty-two (clk32), etc.

Measuring each of these clocks in turn showed that the Bitscope was able to observe all of them, however the quality of the measurement was extremely poor for all but the slowest few.  For clk256, clk128, & clk64, the waveforms looked as they should — relatively sharp square pulses with the expected repetition rate.  As the clock divisor was lowered below 64, the measurements were less and less clean, and no longer looked as expected.

Implications for Mojo measurements

Since the PWM I intend to use for development is based on a counter with 10 (or more) bits, the period will be at least 1024 times as long as the base clock frequency of the FPGA.  In the case of a 50% duty cycle, this will be identical to clk1024, as so will be clearly measurable using the Bitscope.

Measurements of the precise duty cycle, however, will not be possible with the Bitscope.  Since clock signals with a divisor of less than 64 were not cleanly observable with the Bitscope, this means that it will be difficult to distinguish duty-cycle differences of less than this (~25% of a 10-bit PWM).  It might be possible to measure differences as low as 12.5% of the PWM’s duty cycle, but certainly no better than this.

Path forward

If it is necessary to make higher precision measurements than this, then I can see three possible ways forward.

Buy a better scope

This is the obvious answer, although not necessary the right answer.  Throwing more money at a problem can normally fix it, but sometimes a little extra thought can produce a solution without having to pay for (and wait for) expensive equipment to be delivered.

So, yes, measurements would be possible by upgrading to a scope with a sampling rate of >500 MS/s and an input BW of >1 GHz, but surely we are smarter than that?

Sub-sampling the Bitscope

The Bitscope comes with the ability to build up the waveform over several captures, thereby allowing an apparent high sampling rate.  If the waveform changes slowly over time — that is, if the frame does not vary too much between captures — then this would be a nice way to make higher frequency measurements of the Mojo’s output.

In this case no additional equipment is necessary.  All that is needed is to ensure that the Mojo’s output waveforms do not vary too quickly (that is, they are relatively constant over a period of 1 s or so), and the patience to read the Bitscope’s manual.

Analogue filter

Since the purpose of the measurement is to observe the PWM output to ensure that it will have the correct effect when input to a filtering circuit, a very simple filter could be constructed from R’s and C’s, with the output of this being the signal of interest.

Using the contents of the Arduino starter kit (chosen because I have them lying around, and so don’t have to buy anything), it’s possible to construct simple RC filters with 3 dB points at ~7 kHz (R = 220 ohms, C = 0.1 uF) or ~14 kHz (R = 110 ohms, C = 0.1 uF).  Compared to the ~50 kHz (50 MHz / 2^10) frequency of the PWM, either of these should be sufficient to suppress the fundamental component.

In this case two of three lumped element components are needed, however these have negligible cost, and are very easy to find.  All that remains to be done is to test the circuit.

Leave a comment