
我们有不到一个星期的时间OpenScope Kickstarterand we thought it would be a great to spend time with our lead design engineer, Keith Vogel on how he designed OpenScope and to answer the question: How good is good?

拉里萨:Keith, you started working on OpenScope about two years ago. One of the really remarkable things about this product is how much is actually using the resources of the MCU. What kind of results can you actually get using just the analog circuitry on a micro controller?
基思:The initial design requirement for the OpenScope was to be WiFi enabled 1MHz scope. But then we had to ask ourselves what makes a 1MHz scope useful, and what other features are needed. Using the experience of our Analog Discovery we concluded that we also needed a function generator, some sort of DC power supplies and a logic analyzer. This was challenging task considering we were going to implement this on a 200MHz PIC32MZ. To achieve this, most of the instrumentation firmware had to be offloaded on to the PIC32MZ’s peripherals so that the CPU could be freed up to service the WiFi/Network Stack and other housekeeping tasks. The PIC32MZ has 5 dedicated 3.125MS/s ADC, 1 shared ADC, 8 DMAs, 6 UARTs, 6 SPIs, 9 PWMs, 9 timers, and more. The idea was to set up these peripherals, get them running and let them go without CPU intervention.
拉里萨:Wow. So pretty much every single resource that is available to the PICMZ. Do you have an example?
基思:Yes, for example, the function generator; we put a pattern in memory, point the DMA at the memory, set up a timer to trigger the DMA at 10MS/s, and just let the DMA push the data buffer out to the IO port at a very regular 10MS/s; once it is set up, no CPU needed. The R2R ladder on the board acts as a DAC converting the 10bits of data toan analog signal. A low pass filter smooths the waveform. We get great results at 100KHz, and good results up to 1 MHz with only a -2db attenuation at 1 MHz.
拉里萨:So really good?
基思:是的,让我们看一下我的替补席上示波器拍摄的一些屏幕截图。
如果我设置了OpenScope生成3V,则在100kHz处峰值波形,以下图是我得到的:

Then, if I make the timing tighter (from 4uS to 4nS, then we get a graph that is pretty much the same).

这是OpenScope产生的3V峰至峰值1 MHz波形…-2dB衰减。每个时期只有10个样本创建波形!
拉里萨:I think it’s amazing that you got such a low noise waveform generator like this running in the PICMZ just using the peripherals and an R2R ladder (no DAC). Did you have to do something special to the onboard ADCs to be able to get that kind of sample rate with such low loss of signal? Is the Oscilloscope similar?
基思:Yes, the sampling of the ADC work in a similar fashion. A timer is set up to trigger the ADCs, the ADC completion event is setup to trigger a DMA transfer to memory. Once set up, the ADC just sample and the DMA transfer the samples into a buffer with no CPU utilization. The PIC32MZ ADCs only sample at 3.125MS/s and we thought that only having 3+ samples for a 1MHz scope was probably too few, so we interleaved 2 ADCs to double the sample rate. The OpenScope has 2 analog scope channels so we used 4 of the 5 dedicated ADCs to get 2 6.25MS/s ADCs.
拉里萨:That’s a lot of data that is being transferred from the on-board ADCs. In most microcontroller designs, I would think the entire microcontroller would be used up trying to handle that data, but it sounds like you got around that by using the DMA (Direct Memory Access). Is that right?
基思:是的,基本上,所有内容都在微控制器的外围设置中运行,几乎没有接触CPU。这使得CPU可以自由运行WiFi/网络堆栈,SD卡,命令解析,LED和其他任务。这还允许所有仪器(例如逻辑分析仪,波形生成器等)同时运行。
拉里萨:Okay, that’s impressive, the microcontroller sounds completely utilized. Is there a way that you could test it?
基思:是的,一个非常有趣的测试是回环测试where the output of the Waveform Generator loops back into the Oscilloscope inputs and sampled. This utilizes a lot of the OpenScope resources, 2 PWMs, 2 ADCs, 3 DMAs, 4 Timers; while running an SPI for the WiFi, another SPI for the SD card, a UART for COM port communications (which uses another 2 DMAs + the UART) and since the DC outputs are always running, another 2 PWMs for them. Summing this all up for this simple test we are running…
1. 5 DMAs
2. 4 Timers
3. 4 PWM
4. 2 ADCs
5. 2 Spis
6. 1 UART
7. CPU is running the WiFi/Network stack, HTTP server, LEDs, and instrument communications.
现在知道的是……恰好是电路的出色表现?简单的回环测试应采样我们认为我们正在生成的内容,并将通过大量的OpenScopes硬件和软件运行。因此,让我们将我们的100kHz采样波形与我们生成的波形进行比较。
On the Tek scope, I get this graph:

When we compare this output to the Oscilloscope in Waveforms Live using the OpenScope, we see this graph!

这是我们实际样品!很安慰ting to see that they look the same Not only is our wavegen good, but our sampling is too!
但是,让我们进一步。我们实现了计算five中的FFT的能力[这是该软件Beta测试最近启用的新功能]。如果我们采用100kHz波形的FFT,则只能在100kHz处看到能量。

如您所见,我们几乎死了100kHz,并且在任何其他频率上都没有能量。实际上,非常干净!
Another very comforting observation is that there is no energy at 303kHz! This is the frequencies our PWMs run at, and we are running 4 of them with no energy there at that frequency. Our filtering of the PWMs is clearly working, keeping the PWM out of the analog signals.
拉里萨:因此,硬件隔离得很好,因此PWM不会影响模拟信号,我们确切地看到了我们想要的清洁信号类型。这适用于正弦波,但是其他类型的波形呢?
基思:Let’s take this further: We know that a square wave is composition of every odd frequency above the base frequency. If we have our wave gen generate a square wave we should see the odd frequencies and not much else. We will use 10kHz square wave so we can easily several orders of composite frequencies in the FFT.
The graph is taken from my Tek scope, reading a square wave from the OpenScope Waveform Generator.

将此与从波形中的OpenSCope读取示波器的读数。
拉里萨:它看起来与Tek范围完全相同。
基思:Exactly. If we take an FFT…

You can see spikes at 10kHz, 30kHz, 50kHz, 70kHz, 90kHz…… Nice clean spikes way out there for 20+ terms.
拉里萨:Okay, so the square wave is clean. What about the sawtooth wave?
基思:Okay, for fun… here’s the sawtooth wave and the FFT.


如预期的那样,您会在每个连续的订单上看到尖峰。很好干净。
拉里萨:Okay, point proven. Sine, square and sawtooth all look really clean. Anything else we should ask?
基思:You might ask, what exactly is going at those higher frequencies? Well, there seems to be some low level energy up there. That is really aliasing in the FFT due to the sampling rate. Remember, I am sampling at 6.25MS/s and at 500kHz I am only getting 12.5 samples per period.

这是我们6.25ms/s的500kHz采样波形,清晰可见采样效果。
I would refer you back to our 100kHz sine wave FFT, where there is no higher frequency components in the waveform (as opposed to a square or saw tooth waves where high composite frequencies exist)

在这里,您可以看到我们干净至3MHz以上。那里没有混音,因为那里没有频率组件。
As a result of looking at the FFTs, we can conclude that we have good separation from our digital circuits and our analog circuits, that we don’t have induce external energy and our circuits are working well.
拉里萨:这是您介绍Bode情节的Kickstarter伸展目标的地方吗?
基思:是的,因为它们是如此有用。
Bode plots are generated by stimulating a circuit with a sine wave and then looking at the resultant waveform, both in magnitude and phase. To do a good Bode plot you take the FFT of the input and compare it to the FFT of the output and plot the magnitude differences. Most Bode plots will plot magnitude in db. Most oscilloscopes are rated at their -3db attenuation point. The rule of thumb is that the maximum useful frequency a scope is good for is 1/5 it’s rated -3db frequency and 1/5Th这是抽样率。因此,如果您的范围为5MHz,则可以测量1 MHz波。或者,如果您以5ms/s进行采样,则可以合理地测量1MHz。但这假定一个典型的1英石order drop off of the frequency. The OpenScope exceeds 2.5MHz at -3db, but drops off more closely to a second order cutoff. The OpenScope’s analog circuits are useful up to 1 MHz, and with a sampling rate of 6.25MS/s also meets the 5:1 sampling criterial to be useful at 1 MHz. Here are the Bode plots for the analog input of the OpenScope.

最坏的情况是通过模拟输入的统一增益(0DB)。如您所见,OpenScope在0.5dB内均固定在最多1 MHz之内,并在-3dB时急剧下降至近3 MHz。

这是最好的案例条件,OpenScope以3/40的收益运行Th(-22.5db). Here we are flat well within ¼ db up to nearly 2MHz and then very sharply dropping off to a -3db at 3.5 MHz
拉里萨:那讲得通。您对“ Openscope上的模拟有多好”的分开答案是什么?”
基思:经验法则将使OpenScope有效地测量500kHz(2.5MHz为-3dB / 5);但是由于截止非常尖锐,因此OpenScope实际上可用于测量多达1 MHz。6.25ms/S采样率比当时的模拟电路更像是一个因素。所以总结一下?我要说的是,这非常好,它将使您完成大多数项目的音频速度,并且由于我们非常使用微控制器,因此董事会的成本非常便宜,可以不破坏您的袖珍书。
拉里萨:Thank you, Keith!
Go and visit ourKickstarter Campaign并确保在评论中提出问题!

嘿,这是一篇很棒的文章。
与工程师的访谈是一个很棒的概念。我遇到了大多数新概念,以了解其非常有用的文章且易于理解。