STM32F303 based 4 channel 5MS "oscilloscope" - Page 1
Forum section: electronics / projects

author: Miyuki
author_rank: Frequent Contributor
timestamp: July 19, 2017, 11:55:12 am
content: Don't they already exist? Just for sure to not inventing wheel againSTM32F303 look like nice chip for small DIY but usable oscilloscope, have 4 decent ADC with 5MS per channel at 12bit and little faster at lower accuracy, also have memory controller to connect external SRAMIs here any issue why they are not all over ebay ?

author: MosherIV
author_rank: Super Contributor
timestamp: July 19, 2017, 12:04:32 pm
content: QuoteThe key part of that specification is 'per channel'As far as I am aware, the ST32F series only have 1 (or 2 at most) ADC(s) per microcontrollerYou can only acheive the max 5Million samples per sec on a single channel, after that you have to multiplex and the sample rate is shared accordingly.Yes, you can couple the ADC to the DMA to the SDRAM controller but it also drops the transfer rate from the ADC to the DMA channel.QuoteThere are cheaper microcontrollers eg the one used on Arduinos.It would be easier to do the capture with FPGAs (see Analogue Discovery 2 and Redpitaya)Just 2 off the top of my head.

author: Miyuki
author_rank: Frequent Contributor
timestamp: July 19, 2017, 12:38:08 pm
content: QuoteF303 have 4 separated ADC capable of 5MSPS at 12bit and 7.2 at 8 bitQuoteI don't know about any other cheap microcontroller with similar ADC capabilityFPGA is nice, but not for "small" DIY project, and this boards cost like factory scope, so no reason to use them as scope

author: MosherIV
author_rank: Super Contributor
timestamp: July 19, 2017, 12:53:57 pm
content: QuoteOK, I did not know that.However, as I said, once you have daisy chained the DMA and SD RAM controller, the data rate would not be sustainable.Especially for 4 channels.QuoteNo, I miss led you there. The Atmel devices do not have comparable ADCs but the criteria is cheapness !http://www.ebay.co.uk/itm/Assembled-DSO138-2-4-Inch-TFT-Digital-Oscilloscope-1Msps-Probe-US-Plug-Power-/222582456820?var=&hash=item33d2f2c1f4:m:mY9_zw6EIvPgeIXn0icnISgThe processor is the 2nd most expensive part in that kit - so it has to be CHEAP !!BTW 5Million samples per second sound like a lot but that only gives that only gives you a possible bandwidth of 2.5MHzNot really enough for a decent oscilloscope.

author: JPortici
author_rank: Super Contributor
timestamp: July 19, 2017, 12:55:12 pm
content: dsPIC33EP GS series (likehttp://www.microchip.com/wwwproducts/en/dsPIC33EP64GS504) has 5 ADCs, 3.125 MSPS per ADC and it's around 11.8 ENOBalso PIC32MK/MZ, but it's not really "cheap" anymore (though you should compare them with cortex M7)actually any decent manufacturer will have a line of cheap MCUs with multicore adcs, not everyone will have a good adc onboard

author: Kalvin
author_rank: Super Contributor
timestamp: July 19, 2017, 02:25:30 pm
content: How about LPC4370FET100 board for EUR 18 with 80 Msps 12-bit ADC up to six channels***:http://www.embeddedartists.se/products/lpcxpresso/lpclink2.phpThey have created a Labtool with following features:- 11 channel logic analyzer (up to 100Msamples per second)- 2 channel oscilloscope (up to 60 Msamples per second, 6MHz BW)- 11 channel digital signal generator (up to 80 Msamples per second)- 2 channel analog signal generator (40kHz BW)Labtool product page:http://www.embeddedartists.se/products/app/labtool.phpLPC4370FET100 Datasheet:http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/lpc-cortex-m-mcus/lpc4300-cortex-m4-m0/32-bit-arm-cortex-m4-plus-2-x-m0-mcu-282-kb-sram-ethernet-two-hs-usbs-80-msps-12-bit-adc-configurable-peripherals:LPC4370FET100Maybe these links will get you started.*** The ADC may not be simultaneously sampling which means that there will be some timing skew between the channels.

author: MosherIV
author_rank: Super Contributor
timestamp: July 19, 2017, 02:50:53 pm
content: FYI people have been turning the STM32F series chips into oscilloscopes for a while, check this out :The STM32F429 ADC does not have the capture rate of the one you mentioned. The STM32F429 disco board has the advantage of a built in touch screen. The board is pretty cheap for what it is at £25

author: C
author_rank: Super Contributor
timestamp: July 19, 2017, 04:46:54 pm
content: Miniscope v2d: STM32 oscilloscope and arbitrary waveform generatorhttp://tomeko.net/miniscope_v2d/One of the first I found around 2012.You can find a bunch on AliExpresshttps://www.aliexpress.com/wholesale?catId=0&initiative_id=AS_20170719083619&SearchText=dso203Search forPocket Oscilloscope on YouTubehttps://www.youtube.com/results?search_query=Pocket+OscilloscopeThink most DSO nano are using STM32

author: DaJMasta
author_rank: Super Contributor
timestamp: July 19, 2017, 06:00:47 pm
content: Quote from: Miyuki on July 19, 2017, 12:38:08 pmJust as a point of order, FPGAs don't have to be massive, high pin count BGA devices. You can get a smaller one and get some of the hardware level performance benefits without going whole hog and dropping $50 on a chip. Take a look at some of the entry level FPGA dev kit boards and see what sorts of things have been done with them - especially for specific tasks or things that can be paralleled up, they can offer a lot of performance.

author: victagayun
author_rank: Newbie
timestamp: February 16, 2019, 11:04:53 am
content: Quote from: Kalvin on July 19, 2017, 02:25:30 pmI cannot seem to find any documents and/or videos on how it is used as oscilloscope.https://www.embeddedartists.com/products/lpc-link2/

author: Doctorandus_P
author_rank: Super Contributor
timestamp: February 16, 2019, 04:04:28 pm
content: 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.htmhttp://www.gabotronics.com/resources/hobbyists-oscilloscopes.htm

author: DDunfield
author_rank: Regular Contributor
timestamp: February 18, 2019, 01:32:06 pm
content: 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

author: splin
author_rank: Frequent Contributor
timestamp: February 18, 2019, 06:58:29 pm
content: Quote from: DDunfield on February 18, 2019, 01:32:06 pmIt seems that DMA speed limits total throughput to 16MSPS:https://www.eevblog.com/forum/microcontrollers/microcontrollers-with-fastest-adcs/msg2089891/#msg2089891Also, @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!

author: DDunfield
author_rank: Regular Contributor
timestamp: February 19, 2019, 12:00:05 am
content: Quote from: splin on February 18, 2019, 06:58:29 pm4x5MSPS 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