Electronics > Projects, Designs, and Technical Stuff
STM32F303 based 4 channel 5MS "oscilloscope"
Doctorandus_P:
5Msps is not enough to compete with a "real" scope, but if it has an analog bandwith of 1MHz it sure can be good enough for plenty of applications, and having 4 channels is a big bonus.
In the "low budget" market there are a bunch of hobby level and one-off project to proove the concept, and a lot of these suffer from a lack of any decent input stage.
The DSO Nano & DSO Quad seem to have some decent hardware, but these are too expensive compared to a real scope.
I think the top for a scope thingy at this level would be around EUR 50.
The Nano & Quad also have very horrible user interfaces, and still they seem to be quite popular. :-//
I have bought a DSO-138 and a DSO-shell. out of curiousity. The "shell" has a much better user interface with it's rotary encoder, and it could have been a usefull product (for low bandwith) if it had better triggering. The triggering of both these is a real joke.
They are also pretty noisy. Although the STM32F103C8T6 used has a 12 bit ADC, the effective resolution on the display is more like 5 or 6 bit.
They are also only single channel, so you can't compare input and output of some circuit under measurement.
I also do not understand the use of TFT displays on these things.
They are among the most expensive parts on these low-budget "scopes", and more expensive than a bluetooth or WiFi (ESP8266) module.
(almost) Everybody has a phone nowaday's with much higher resolution than the TFT's in those cheap scopes.
If you search for "gabotronics" you'll find a website with a very small breadboard compatible scope thingie.
On his website he has also made an overview of quite a lot of scope like devices, from one-off proof of concepts to commercially available.
http://www.gabotronics.com/oscilloscopes/view-all-products.htm
http://www.gabotronics.com/resources/hobbyists-oscilloscopes.htm
DDunfield:
I've been fooling with something similar to this on the "back burner". Part of my obsession with building the "perfect" portable lab (perhaps we should have a topic about that).
It's a two-channel scopemeter with external trigger input & function generator output.
As a meter it has V/MA/Ohm on channel one, with a dual display which can show things like: Min, Max, DB, Frequency, Average (and whatever else I think of). Since ADCs are 12 bit the meter is 3.5 digits only ** (as good as the one I currently have in my portable lab).
It can also function as a second meter on the second display, although this one only does voltage - I find that much of the time when I use two meters, at least one of them is voltage - and voltage measurement is "free" with the second channel scope hardware.
As a scope, it is fairly basic but more complete than other simple scopemeters I've looked at: Capture with ability to set trigger position anywhere in the buffer, Zoom, V/T cursors, measurements etc.
There's also a USB (Serial) interface to PC interface.
I've prototyped some of it using an STM32F103 which gives me 1Mhz capture on two channels with a 4K/channel capture buffer. In the process of moving it to an STM32L476 which will give me 5Mhz sampling, and probably 24k/channel buffer as well as better control over power consumption.
Current display is a 1.8" ST7735 based LCD (160x128), but as part of the redesign I'm moving to a 2.8" (320 x 240) - the 1.8 is simply too small for all the information I want to be able to display.
** The STM32L476 has an "oversample" feature of the ADC which is claimed to provide resolution up to 16 bit - I've not looked into it in any detail yet, however if it actually works, it might be possible to make the meter 4.5 digits.
It's only a "spare time when I feel like it" project - sometimes I go weeks without looking at it, and I don't know if I'll ever actually complete it. So far I've got 2-channel capture at 1Msps and triggering fully implemented on the F103, as well as a very basic user interface utilizing the LCD panel, 4 buttons and a rotary encoder.
The F303 does appear to have 4x 5Msps ADCs so it could work for a 4-channel device. At 5Msps and 2 bytes/sample time 4 channels, that's 40Mbytes/sec in DMA operations! Depending on the memory architecture, that could have a noticeable impact on performance. Keep in mind that in order to obtain pre-trigger capture, the DMA will be operating continuously any time the scope is not stopped.
Dave
splin:
--- Quote from: DDunfield on February 18, 2019, 01:32:06 pm ---The F303 does appear to have 4x 5Msps ADCs so it could work for a 4-channel device. At 5Msps and 2 bytes/sample time 4 channels, that's 40Mbytes/sec in DMA operations! Depending on the memory architecture, that could have a noticeable impact on performance.
--- End quote ---
It seems that DMA speed limits total throughput to 16MSPS:
https://www.eevblog.com/forum/microcontrollers/microcontrollers-with-fastest-adcs/msg2089891/#msg2089891
Also, @72MHz there isn't much time for processing the data if you need to search each channel for maxima, minima, averaging (for oversampling), looking for trigger thresholds etc. Even at 16MSPS you only get 4.5 clock cycles per sample!
DDunfield:
--- Quote from: splin on February 18, 2019, 06:58:29 pm ---
--- Quote from: DDunfield on February 18, 2019, 01:32:06 pm ---The F303 does appear to have 4x 5Msps ADCs so it could work for a 4-channel device. At 5Msps and 2 bytes/sample time 4 channels, that's 40Mbytes/sec in DMA operations! Depending on the memory architecture, that could have a noticeable impact on performance.
--- End quote ---
It seems that DMA speed limits total throughput to 16MSPS:
https://www.eevblog.com/forum/microcontrollers/microcontrollers-with-fastest-adcs/msg2089891/#msg2089891
Also, @72MHz there isn't much time for processing the data if you need to search each channel for maxima, minima, averaging (for oversampling), looking for trigger thresholds etc. Even at 16MSPS you only get 4.5 clock cycles per sample!
--- End quote ---
4x5MSPS would be 20, so the 4-channel device may be in trouble. My 2-channel one should work as it's only 10MSPS. I had no trouble getting 2x1MSPS working on the F103, but 2MSPS is a lot less.
You could offer 4 channels active only at lower capture rates - no ideal, but could still useful.
You do everything capture related in hardware:
Use one timer to time the DMA samples. This timer is gated by an input signal which is held active by a second timer being stopped. The DMA runs continuously, refilling the circular buffer over and over, so that you will have pre-trigger data.
The second timer is clocked by the first timer (sample count), and preloaded with the number of samples you wish to capture post-trigger. It is gated by an input signal from the trigger circuitry.
Triggering is done with an external comparator (The L476 has a comparator as a device and a peripheral interconnect matrix so it may be possible to do some of these functions and connections internally - haven't looked that far in to it yet). You need an independent comparator anyway in order to be able to do external trigger, and also if you want to be able to do any conditioning on the trigger signal.
When the trigger occurs, the gate to the second timer activates and it starts counting down for the number of samples post-trigger. When it hits bottom, it un-gates the first timer and the capture stops.
You can use an interrupt on the gate signal to the second timer to inform the software when the trigger event has occured (capture is started), and one on the gate signal to the first timer to inform the software when the capture has completed.
Measurements are typically done post capture. DSO's don't capture continuously, they capture a buffer, do processing on it, then commence another capture. In "real" DSO's the capture memory is not usually on the CPU, so it gets transferred to the CPU via a high speed bus and another capture can be started quickly.
If you have enough RAM (the F103 doesn't) you could simulate this by toggling between two buffers so that you can commence a new capture almost immediately after one completes, but there will always be a minimum holdoff. For most of what I do a longer holdoff wouldn't be a problem, and I'd rather have capture depth.
I'm designing this strictly for my own use so I have the luxury of giving priority to it working the way I want. No point spending money to productize it because it will either be a) unnoticed - in which case you've wasted your investment, or b) popular - in which case it will be immediately cloned and sold on on ebay for cheap in which case you've wasted your investment.
I did experiment with "no external hardware" triggering, the STM32 ADCs have a "watchdog" feature where you can cause an interrupt after the signal goes above or below a certain threshold which is tested on a sample by sample basis. Very small interrupts handlers then start/stop the timers as described above, however there is still some latency at fast capture rates. You can compensate for this by scanning a portion of the capture buffer just before where the trigger interrupt occurred to identify the actual trigger position. It does mean your trigger position may not be exactly the number of samples from the end of the buffer that you desire. I compensated for this using 4096 byte circular buffers on the F103 but only showing 4000 bytes to the user - this gave me 96 bytes worth of "wiggle room" which was more than enough.
It actually worked reasonably well, but I eventually decided on the all-hardware approach as you need an external comparator for EXT trigger anyway, and you can do conditioning on the trigger signal. It also makes the trigger system the same for either internal or external trigger. On the F103 I used a PWM DAC (good thing there's lots of timers), but the L476 has real DACs built in!
Remains to be seen if 10MSPS DMA running continuously will slow down the memory bus to the point where the UI becomes unbearably slow ...
You're making me want to pick it up again...
Dave
Navigation
[0] Message Index
[*] Previous page
Go to full version